From 282c8d3f335e6f11b75747e620e42d31d4015675 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 9 Sep 2006 18:25:49 +0000 Subject: [PATCH] [roidelapluie] gajim-remove send_xml. Fixes #2081 --- src/gajim-remote.py | 7 +++++++ src/remote_control.py | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/gajim-remote.py b/src/gajim-remote.py index 49ab144b7..934f8b3ff 100755 --- a/src/gajim-remote.py +++ b/src/gajim-remote.py @@ -236,6 +236,13 @@ class GajimRemote: (_('account'), _('Starts chat, using this account'), True) ] ], + 'send_xml': [ + _('Send custom XML'), + [ + ('xml', _('XML to send'), True), + ('account', _('Account, if not, xml\'ll be send to all your accounts'), False) + ] + ], } if self.argv_len < 2 or \ sys.argv[1] not in self.commands.keys(): # no args or bad args diff --git a/src/remote_control.py b/src/remote_control.py index 7e723dc8b..82dbc54b6 100644 --- a/src/remote_control.py +++ b/src/remote_control.py @@ -171,6 +171,7 @@ class SignalObject(DbusPrototype): self.get_status, self.get_status_message, self.start_chat, + self.send_xml, ]) def raise_signal(self, signal, arg): @@ -605,6 +606,14 @@ class SignalObject(DbusPrototype): NewChatDialog(account) return True + def send_xml(self, *args): + xml, account = self._get_real_arguments(args, 2) + if account: + gajim.connections[account[0]].send_stanza(xml) + else: + for acc in gajim.contacts.get_accounts(): + gajim.connections[acc].send_stanza(xml) + if dbus_support.version[1] >= 30 and dbus_support.version[1] <= 40: method = dbus.method signal = dbus.signal @@ -636,3 +645,4 @@ class SignalObject(DbusPrototype): account_info = method(INTERFACE)(account_info) get_unread_msgs_number = method(INTERFACE)(get_unread_msgs_number) start_chat = method(INTERFACE)(start_chat) + send_xml = method(INTERFACE)(send_xml)