Changeset 3456 for branches/gajim_0.8.2
- Timestamp:
- 09/06/05 14:03:23 (3 years ago)
- Location:
- branches/gajim_0.8.2/src
- Files:
-
- 2 modified
-
gajim-remote.py (modified) (10 diffs)
-
remote_control.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gajim_0.8.2/src/gajim-remote.py
r3443 r3456 39 39 40 40 def send_error(error_message): 41 ''' Writes error message to stderr and exits ''' 42 sys.stderr.write(error_message + '\n') 43 sys.stderr.flush() 44 sys.exit(1) 41 ''' Writes error message to stderr and exits ''' 42 sys.stderr.write(error_message + '\n') 43 sys.stderr.flush() 44 sys.exit(1) 45 45 46 try: 46 47 import dbus … … 156 157 send_error(self.compose_help()) 157 158 self.command = sys.argv[1] 158 159 159 if self.command == 'help': 160 160 if self.argv_len == 3: … … 173 173 id = self.sbus.add_signal_receiver(self.show_vcard_info, 174 174 'VcardInfo', INTERFACE, SERVICE, OBJ_PATH) 175 except :175 except Exception, e: 176 176 send_error(_('Service not available')) 177 177 … … 223 223 interface = self.service.get_object(OBJ_PATH, INTERFACE) 224 224 else: 225 send_error(_('Unknown D-Bus version: %s') % _version )225 send_error(_('Unknown D-Bus version: %s') % _version[1]) 226 226 227 227 # get the function asked … … 297 297 if res != '': 298 298 ret_str += '\t' + res 299 elif type(val) == dict: 300 ret_str += self.print_info(level+1, val) 299 301 ret_str = '%s(%s)\n' % (spacing, ret_str[1:]) 300 302 elif isinstance(prop_dict, dict): … … 316 318 if res != '': 317 319 ret_str += '%s%s: \n%s' % (spacing, key, res) 318 else:319 self.send_warning(_('Unknown type %s ') % type(val))320 320 return ret_str 321 321 … … 442 442 if args and len(args) >= 5: 443 443 props_dict = self.unrepr(args[4].get_args_list()[0]) 444 445 444 if props_dict: 446 445 print self.print_info(0,props_dict[0]) … … 448 447 # so we leave the leak - nothing can be done 449 448 if _version[1] >= 41: 450 self.sbus.remove_signal_receiver(s how_vcard_info, 'VcardInfo',449 self.sbus.remove_signal_receiver(self.show_vcard_info, 'VcardInfo', 451 450 INTERFACE, SERVICE, OBJ_PATH) 452 451 … … 464 463 def gtk_quit(self): 465 464 if _version[1] >= 41: 466 self.sbus.remove_signal_receiver(s how_vcard_info, 'VcardInfo',465 self.sbus.remove_signal_receiver(self.show_vcard_info, 'VcardInfo', 467 466 INTERFACE, SERVICE, OBJ_PATH) 468 467 gtk.main_quit() … … 489 488 return None 490 489 490 491 491 if __name__ == '__main__': 492 492 GajimRemote() -
branches/gajim_0.8.2/src/remote_control.py
r3170 r3456 279 279 if self.disabled: 280 280 return 281 282 281 [jid] = self._get_real_arguments(args, 1) 282 if not isinstance(jid, unicode): 283 jid = unicode(jid) 283 284 if not jid: 284 285 # FIXME: raise exception for missing argument (0.3+) … … 288 289 289 290 for account in accounts: 290 if gajim.contacts[account]. has_key(jid):291 if gajim.contacts[account].__contains__(jid): 291 292 self.vcard_account = account 292 gajim.connections[account].register_handler('VCARD',293 self._receive_vcard)294 293 gajim.connections[account].request_vcard(jid) 295 294 break … … 303 302 result = gajim.contacts.keys() 304 303 if result and len(result) > 0: 305 return result 304 result_array = [] 305 for account in result: 306 result_array.append(account.encode('utf-8')) 307 return result_array 306 308 return None 307 309 … … 325 327 else: 326 328 # 'for_account: is not recognised:', 327 # FIXME: there can be a return status for this [0.3+]328 329 return None 329 330 else: … … 358 359 return True 359 360 return False 360 361 def _receive_vcard(self,account, array):362 if self.vcard_account:363 gajim.connections[self.vcard_account].unregister_handler('VCARD',364 self._receive_vcard)365 self.unregistered_vcard = None366 if self.disabled:367 return368 if _version[1] >=30:369 self.VcardInfo(repr(array))370 else:371 self.emit_signal(INTERFACE, 'VcardInfo',372 repr(array))373 361 374 362 def _get_real_arguments(self, args, desired_length):
