Condensed all of the stanzaPlugin functions into a single registerStanzaPlugin function.

Updated plugins and tests to use new function.
This commit is contained in:
Lance Stout
2010-07-19 13:58:53 -04:00
parent e6bec8681e
commit d5e42ac0e7
23 changed files with 98 additions and 106 deletions

View File

@@ -19,6 +19,16 @@ else:
xmltester = type(ET.Element('xml'))
def registerStanzaPlugin(stanza, plugin):
"""
Associate a stanza object as a plugin for another stanza.
"""
tag = "{%s}%s" % (plugin.namespace, plugin.name)
stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin
stanza.plugin_tag_map[tag] = plugin
class JID(object):
def __init__(self, jid):
self.jid = jid
@@ -392,4 +402,4 @@ class StanzaBase(ElementBase):
def __copy__(self):
return self.__class__(xml=copy.deepcopy(self.xml), stream=self.stream)