From d5e42ac0e7282500583bf17f21eb2f944600ce76 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 19 Jul 2010 13:58:53 -0400 Subject: Condensed all of the stanzaPlugin functions into a single registerStanzaPlugin function. Updated plugins and tests to use new function. --- sleekxmpp/basexmpp.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'sleekxmpp/basexmpp.py') diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 9728c3f4..c9439ea3 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -16,6 +16,7 @@ from . xmlstream.handler.xmlcallback import XMLCallback from . xmlstream.handler.xmlwaiter import XMLWaiter from . xmlstream.handler.waiter import Waiter from . xmlstream.handler.callback import Callback +from . xmlstream.stanzabase import registerStanzaPlugin from . import plugins from . stanza.message import Message from . stanza.iq import Iq @@ -35,12 +36,6 @@ if sys.version_info < (3,0): reload(sys) sys.setdefaultencoding('utf8') - -def stanzaPlugin(stanza, plugin): - stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin - stanza.plugin_tag_map["{%s}%s" % (plugin.namespace, plugin.name)] = plugin - - class basexmpp(object): def __init__(self): self.id = 0 @@ -62,13 +57,9 @@ class basexmpp(object): self.registerStanza(Message) self.registerStanza(Iq) self.registerStanza(Presence) - self.stanzaPlugin(Iq, Roster) - self.stanzaPlugin(Message, Nick) - self.stanzaPlugin(Message, HTMLIM) - - def stanzaPlugin(self, stanza, plugin): - stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin - stanza.plugin_tag_map["{%s}%s" % (plugin.namespace, plugin.name)] = plugin + registerStanzaPlugin(Iq, Roster) + registerStanzaPlugin(Message, Nick) + registerStanzaPlugin(Message, HTMLIM) def Message(self, *args, **kwargs): return Message(self, *args, **kwargs) -- cgit v1.2.3