From 7ad014368709873ed8ab760acc62264278f7723f Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 20 Jul 2010 12:18:38 -0400 Subject: Updated pubsub stanzas to use xep_0004 stanza objects, and updated tests to match. --- sleekxmpp/plugins/stanza_pubsub.py | 50 +++----------------------------------- 1 file changed, 4 insertions(+), 46 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/plugins/stanza_pubsub.py b/sleekxmpp/plugins/stanza_pubsub.py index e04f1a7f..96d02f93 100644 --- a/sleekxmpp/plugins/stanza_pubsub.py +++ b/sleekxmpp/plugins/stanza_pubsub.py @@ -257,7 +257,7 @@ class Configure(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'configure' plugin_attrib = name - interfaces = set(('node', 'type', 'config')) + interfaces = set(('node', 'type')) plugin_attrib_map = {} plugin_tag_map = {} @@ -266,22 +266,8 @@ class Configure(ElementBase): if not t: t == 'leaf' return t - def getConfig(self): - config = self.xml.find('{jabber:x:data}x') - form = xep_0004.Form() - if config is not None: - form.fromXML(config) - return form - - def setConfig(self, value): - self.xml.append(value.getXML()) - return self - - def delConfig(self): - config = self.xml.find('{jabber:x:data}x') - self.xml.remove(config) - registerStanzaPlugin(Pubsub, Configure) +registerStanzaPlugin(Configure, xep_0004.Form) class DefaultConfig(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#owner' @@ -293,21 +279,6 @@ class DefaultConfig(ElementBase): def __init__(self, *args, **kwargs): ElementBase.__init__(self, *args, **kwargs) - - def getConfig(self): - config = self.xml.find('{jabber:x:data}x') - form = xep_0004.Form() - if config is not None: - form.fromXML(config) - return form - - def setConfig(self, value): - self.xml.append(value.getXML()) - return self - - def delConfig(self): - config = self.xml.find('{jabber:x:data}x') - self.xml.remove(config) def getType(self): t = self._getAttr('type') @@ -315,6 +286,7 @@ class DefaultConfig(ElementBase): return t registerStanzaPlugin(PubsubOwner, DefaultConfig) +registerStanzaPlugin(DefaultConfig, xep_0004.Form) class Options(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' @@ -538,22 +510,8 @@ class EventConfiguration(ElementBase): plugin_attrib_map = {} plugin_tag_map = {} - def getConfig(self): - config = self.xml.find('{jabber:x:data}x') - form = xep_0004.Form() - if config is not None: - form.fromXML(config) - return form - - def setConfig(self, value): - self.xml.append(value.getXML()) - return self - - def delConfig(self): - config = self.xml.find('{jabber:x:data}x') - self.xml.remove(config) - registerStanzaPlugin(Event, EventConfiguration) +registerStanzaPlugin(EventConfiguration, xep_0004.Form) class EventPurge(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' -- cgit v1.2.3