summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-07-19 13:58:53 -0400
committerLance Stout <lancestout@gmail.com>2010-07-19 13:58:53 -0400
commitd5e42ac0e7282500583bf17f21eb2f944600ce76 (patch)
tree28decf6b57e7072748f59c05d84de0f1fdf4101d /sleekxmpp/basexmpp.py
parente6bec8681e07ced607db1fbcbc5e356c3936f1d1 (diff)
downloadslixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.tar.gz
slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.tar.bz2
slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.tar.xz
slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.zip
Condensed all of the stanzaPlugin functions into a single registerStanzaPlugin function.
Updated plugins and tests to use new function.
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py17
1 files changed, 4 insertions, 13 deletions
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)