From 1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Nov 2011 22:58:48 +0100 Subject: /rawxml command --- src/core.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 \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 [type] [status]\nPresence: Send a directed presence to 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 + """ + 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 [type] [status] -- cgit v1.2.3