diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-11 22:58:48 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-11 22:58:48 +0100 |
commit | 1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3 (patch) | |
tree | 8d7238507d0028d9c97d72b966682e7eae53a7c2 /src | |
parent | 101b20724f897824e047b32dcd01bf365d4aa9ba (diff) | |
download | poezio-1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3.tar.gz poezio-1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3.tar.bz2 poezio-1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3.tar.xz poezio-1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3.zip |
/rawxml command
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core.py b/src/core.py index 5f173d63..6cd7b97b 100644 --- a/src/core.py +++ b/src/core.py @@ -26,6 +26,7 @@ import singleton import collections from sleekxmpp.xmlstream.stanzabase import JID +from sleekxmpp.xmlstream.stanzabase import StanzaBase log = logging.getLogger(__name__) @@ -133,6 +134,7 @@ class Core(object): 'unload': (self.command_unload, _('Usage: /unload <plugin>\nUnload: Unload the specified plugin'), self.plugin_manager.completion_unload), 'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None), 'presence': (self.command_presence, _('Usage: /presence <JID> [type] [status]\nPresence: Send a directed presence to <JID> and using [type] and [status] if provided.'), None), + 'rawxml': (self.command_rawxml, _('Usage: /rawxml\nRawXML: Send a custom xml stanza.'), None), } self.key_func = { @@ -1162,6 +1164,20 @@ class Core(object): if isinstance(current, tabs.MucTab) and current.joined and show not in ('away', 'xa'): current.send_chat_state('active') + def command_rawxml(self, arg): + """" + /rawxml <xml stanza> + """ + if not arg: + return + + try: + StanzaBase(self.xmpp, xml=ET.fromstring(arg)).send() + except: + import traceback + self.information(_('Could not send custom stanza'), 'Error') + log.debug(_("Could not send custom stanza:\n") + traceback.format_exc()) + def command_presence(self, arg): """ /presence <JID> [type] [status] |