[Dicson] add support for key 'body' in the Message Action, and add jid via roster command. Fixes #5195
This commit is contained in:
parent
770b21fa60
commit
b83f9ae5d6
|
@ -120,7 +120,10 @@ class GajimRemote:
|
||||||
('jid', _('JID of the contact that you want to chat with'),
|
('jid', _('JID of the contact that you want to chat with'),
|
||||||
True),
|
True),
|
||||||
(_('account'), _('if specified, contact is taken from the '
|
(_('account'), _('if specified, contact is taken from the '
|
||||||
'contact list of this account'), False)
|
'contact list of this account'), False),
|
||||||
|
(_('message'),
|
||||||
|
_('message content. The account must be specified or ""'),
|
||||||
|
False)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'send_chat_message':[
|
'send_chat_message':[
|
||||||
|
@ -257,7 +260,8 @@ class GajimRemote:
|
||||||
[
|
[
|
||||||
(_('uri'), _('URI to handle'), True),
|
(_('uri'), _('URI to handle'), True),
|
||||||
(_('account'), _('Account in which you want to handle it'),
|
(_('account'), _('Account in which you want to handle it'),
|
||||||
False)
|
False),
|
||||||
|
(_('message'), _('Message content'), False)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'join_room': [
|
'join_room': [
|
||||||
|
@ -506,6 +510,25 @@ class GajimRemote:
|
||||||
if not '?' in uri:
|
if not '?' in uri:
|
||||||
self.command = sys.argv[1] = 'open_chat'
|
self.command = sys.argv[1] = 'open_chat'
|
||||||
return
|
return
|
||||||
|
if 'body=' in uri:
|
||||||
|
# Open chat window and paste the text in the input message dialog
|
||||||
|
self.command = sys.argv[1] = 'open_chat'
|
||||||
|
message = uri.split('body=')
|
||||||
|
message = message[1].split(';')[0]
|
||||||
|
try:
|
||||||
|
message = urllib.unquote(message)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
pass
|
||||||
|
sys.argv[2] = uri.split('?')[0]
|
||||||
|
if len(sys.argv) == 4:
|
||||||
|
# jid in the sys.argv
|
||||||
|
sys.argv.append(message)
|
||||||
|
else:
|
||||||
|
sys.argv.append('')
|
||||||
|
sys.argv.append(message)
|
||||||
|
sys.argv[3] = ''
|
||||||
|
sys.argv[4] = message
|
||||||
|
return
|
||||||
(jid, action) = uri.split('?', 1)
|
(jid, action) = uri.split('?', 1)
|
||||||
try:
|
try:
|
||||||
jid = urllib.unquote(jid)
|
jid = urllib.unquote(jid)
|
||||||
|
@ -519,7 +542,10 @@ class GajimRemote:
|
||||||
sys.argv.append(sys.argv[3])
|
sys.argv.append(sys.argv[3])
|
||||||
sys.argv[3] = ''
|
sys.argv[3] = ''
|
||||||
return
|
return
|
||||||
|
if action.startswith('roster'):
|
||||||
|
# Add contact to roster
|
||||||
|
self.command = sys.argv[1] = 'add_contact'
|
||||||
|
return
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def call_remote_method(self):
|
def call_remote_method(self):
|
||||||
|
|
|
@ -2887,7 +2887,7 @@ class Interface:
|
||||||
|
|
||||||
return chat_control
|
return chat_control
|
||||||
|
|
||||||
def new_chat_from_jid(self, account, fjid):
|
def new_chat_from_jid(self, account, fjid, message=None):
|
||||||
jid, resource = gajim.get_room_and_nick_from_fjid(fjid)
|
jid, resource = gajim.get_room_and_nick_from_fjid(fjid)
|
||||||
contact = gajim.contacts.get_contact(account, jid, resource)
|
contact = gajim.contacts.get_contact(account, jid, resource)
|
||||||
added_to_roster = False
|
added_to_roster = False
|
||||||
|
@ -2904,6 +2904,9 @@ class Interface:
|
||||||
if len(gajim.events.get_events(account, fjid)):
|
if len(gajim.events.get_events(account, fjid)):
|
||||||
ctrl.read_queue()
|
ctrl.read_queue()
|
||||||
|
|
||||||
|
if message:
|
||||||
|
buffer = ctrl.msg_textview.get_buffer()
|
||||||
|
buffer.set_text(message)
|
||||||
mw = ctrl.parent_win
|
mw = ctrl.parent_win
|
||||||
mw.set_active_tab(ctrl)
|
mw.set_active_tab(ctrl)
|
||||||
# For JEP-0172
|
# For JEP-0172
|
||||||
|
|
|
@ -329,8 +329,8 @@ class SignalObject(dbus.service.Object):
|
||||||
return DBUS_BOOLEAN(True)
|
return DBUS_BOOLEAN(True)
|
||||||
return DBUS_BOOLEAN(False)
|
return DBUS_BOOLEAN(False)
|
||||||
|
|
||||||
@dbus.service.method(INTERFACE, in_signature='ss', out_signature='b')
|
@dbus.service.method(INTERFACE, in_signature='sss', out_signature='b')
|
||||||
def open_chat(self, jid, account):
|
def open_chat(self, jid, account, message):
|
||||||
'''Shows the tabbed window for new message to 'jid', using account
|
'''Shows the tabbed window for new message to 'jid', using account
|
||||||
(optional) 'account' '''
|
(optional) 'account' '''
|
||||||
if not jid:
|
if not jid:
|
||||||
|
@ -372,7 +372,7 @@ class SignalObject(dbus.service.Object):
|
||||||
connected_account = first_connected_acct
|
connected_account = first_connected_acct
|
||||||
|
|
||||||
if connected_account:
|
if connected_account:
|
||||||
gajim.interface.new_chat_from_jid(connected_account, jid)
|
gajim.interface.new_chat_from_jid(connected_account, jid, message)
|
||||||
# preserve the 'steal focus preservation'
|
# preserve the 'steal focus preservation'
|
||||||
win = gajim.interface.msg_win_mgr.get_window(jid,
|
win = gajim.interface.msg_win_mgr.get_window(jid,
|
||||||
connected_account).window
|
connected_account).window
|
||||||
|
|
Loading…
Reference in New Issue