Changeset 3443 for branches/gajim_0.8.2
- Timestamp:
- 09/06/05 13:20:56 (3 years ago)
- Files:
-
- 1 moved
-
branches/gajim_0.8.2/src/gajim-remote.py (moved) (moved from branches/gajim_0.8.2/scripts/gajim-remote.py) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gajim_0.8.2/src/gajim-remote.py
r3282 r3443 33 33 signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C exits the application 34 34 35 import i18n35 from common import i18n 36 36 37 37 _ = i18n._ 38 38 i18n.init() 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 45 try: 42 46 import dbus … … 150 154 if self.argv_len < 2 or \ 151 155 sys.argv[1] not in self.commands.keys(): # no args or bad args 152 se lf.send_error(self.compose_help())156 send_error(self.compose_help()) 153 157 self.command = sys.argv[1] 154 158 … … 165 169 if self.command == 'contact_info': 166 170 if self.argv_len < 3: 167 se lf.send_error(_('Missing argument "contact_jid"'))171 send_error(_('Missing argument "contact_jid"')) 168 172 try: 169 173 id = self.sbus.add_signal_receiver(self.show_vcard_info, 170 174 'VcardInfo', INTERFACE, SERVICE, OBJ_PATH) 171 175 except: 172 se lf.send_error(_('Service not available'))176 send_error(_('Service not available')) 173 177 174 178 res = self.call_remote_method() … … 188 192 if res == False: 189 193 if self.argv_len < 4: 190 se lf.send_error(_('\'%s\' is not in your roster.\n\194 send_error(_('\'%s\' is not in your roster.\n\ 191 195 Please specify account for sending the message.') % sys.argv[2]) 192 196 else: 193 se lf.send_error(_('You have no active account'))197 send_error(_('You have no active account')) 194 198 elif self.command == 'list_accounts': 195 199 if isinstance(res, list): … … 210 214 self.sbus = dbus.SessionBus() 211 215 except: 212 se lf.send_error(_('Session bus is not available.'))213 214 if _version[1] >= 30 and _version[1] <= 42:216 send_error(_('Session bus is not available.')) 217 218 if _version[1] >= 30: 215 219 obj = self.sbus.get_object(SERVICE, OBJ_PATH) 216 220 interface = dbus.Interface(obj, INTERFACE) … … 252 256 str += ' ' + argument[0] + ' - ' + argument[1] + '\n' 253 257 return str 254 se lf.send_error(_('%s not found') % command)258 send_error(_('%s not found') % command) 255 259 256 260 def compose_help(self): … … 455 459 if len(args) > argv_len: 456 460 if args[argv_len][2]: 457 se lf.send_error(_('Argument "%s" is not specified. \n\461 send_error(_('Argument "%s" is not specified. \n\ 458 462 Type "%s help %s" for more info') % (args[argv_len][0], BASENAME, self.command)) 459 463 … … 482 486 return res 483 487 except: 484 se lf.send_error(_('Service not available'))488 send_error(_('Service not available')) 485 489 return None 486 487 def send_error(self, error_message):488 ''' Writes error message to stderr and exits '''489 sys.stderr.write(error_message + '\n')490 sys.stderr.flush()491 sys.exit(1)492 490 493 491 if __name__ == '__main__':
