Ticket #2026: remote-send_single_message.diff
| File remote-send_single_message.diff, 3.2 kB (added by maciekp@…, 2 years ago) |
|---|
-
src/remote_control.py
161 161 self.change_status, 162 162 self.open_chat, 163 163 self.send_message, 164 self.send_single_message, 164 165 self.contact_info, 165 166 self.send_file, 166 167 self.prefs_list, … … 269 270 return True 270 271 return False 271 272 273 def send_single_message(self, *args): 274 ''' send_single_message(jid, subject, message, keyID=None, account=None) 275 send 'message' to 'jid', using account (optional) 'account'. 276 if keyID is specified, encrypt the message with the pgp key ''' 277 jid, subject, message, keyID, account = self._get_real_arguments(args, 5) 278 if not jid or not message: 279 return None # or raise error 280 if not keyID: 281 keyID = '' 282 283 connected_account, contact = self.get_account_and_contact(account, jid) 284 285 if connected_account: 286 connection = gajim.connections[connected_account] 287 res = connection.send_message(jid, message, keyID, 288 type='normal', 289 subject=subject) 290 return True 291 return False 292 272 293 def open_chat(self, *args): 273 294 ''' start_chat(jid, account=None) -> shows the tabbed window for new 274 295 message to 'jid', using account(optional) 'account' ''' … … 580 601 open_chat = method(INTERFACE)(open_chat) 581 602 contact_info = method(INTERFACE)(contact_info) 582 603 send_message = method(INTERFACE)(send_message) 604 send_single_message = method(INTERFACE)(send_single_message) 583 605 send_file = method(INTERFACE)(send_file) 584 606 prefs_list = method(INTERFACE)(prefs_list) 585 607 prefs_put = method(INTERFACE)(prefs_put) -
src/gajim-remote.py
138 138 (_('account'), _('if specified, the message will be sent ' 139 139 'using this account'), False), 140 140 ] 141 ], 142 'send_single_message':[ 143 _('Sends new single message to a contact in the roster. Both OpenPGP key ' 144 'and account are optional. If you want to set only \'account\', ' 145 'without \'OpenPGP key\', just set \'OpenPGP key\' to \'\'.'), 146 [ 147 ('jid', _('JID of the contact that will receive the message'), True), 148 (_('subject'), _('message subject'), True), 149 (_('message'), _('message contents'), True), 150 (_('pgp key'), _('if specified, the message will be encrypted ' 151 'using this public key'), False), 152 (_('account'), _('if specified, the message will be sent ' 153 'using this account'), False), 154 ] 141 155 ], 142 156 'contact_info': [ 143 157 _('Gets detailed info on a contact'), … … 253 267 def print_result(self, res): 254 268 ''' Print retrieved result to the output ''' 255 269 if res is not None: 256 if self.command in ('open_chat', 'send_message', 's tart_chat'):257 if self.command == 'send_message':270 if self.command in ('open_chat', 'send_message', 'send_single_message', 'start_chat'): 271 if self.command in ('send_message', 'send_single_message'): 258 272 self.argv_len -= 2 259 273 260 274 if res is False:
