diff options
author | Nathan Fritz <fritzy@netflint.net> | 2010-05-27 04:58:57 -0700 |
---|---|---|
committer | Nathan Fritz <fritzy@netflint.net> | 2010-05-27 04:58:57 -0700 |
commit | 3a28f9e5d247b9124e0d14c26c2a6e79aaee86ff (patch) | |
tree | 0d0cbd55785b8c06a86268e6de66201924f3dd55 /sleekxmpp/plugins/stanza_pubsub.py | |
parent | 0bda5fd3f28da14478db87c98fb89f647994deaa (diff) | |
download | slixmpp-3a28f9e5d247b9124e0d14c26c2a6e79aaee86ff.tar.gz slixmpp-3a28f9e5d247b9124e0d14c26c2a6e79aaee86ff.tar.bz2 slixmpp-3a28f9e5d247b9124e0d14c26c2a6e79aaee86ff.tar.xz slixmpp-3a28f9e5d247b9124e0d14c26c2a6e79aaee86ff.zip |
added pubsub state stanzas and scheduled events
Diffstat (limited to 'sleekxmpp/plugins/stanza_pubsub.py')
-rw-r--r-- | sleekxmpp/plugins/stanza_pubsub.py | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/sleekxmpp/plugins/stanza_pubsub.py b/sleekxmpp/plugins/stanza_pubsub.py index 1dd73d99..0a75e1e7 100644 --- a/sleekxmpp/plugins/stanza_pubsub.py +++ b/sleekxmpp/plugins/stanza_pubsub.py @@ -10,6 +10,39 @@ def stanzaPlugin(stanza, plugin): stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin stanza.plugin_tag_map["{%s}%s" % (plugin.namespace, plugin.name)] = plugin +class PubsubState(ElementBase): + namespace = 'http://jabber.org/protocol/psstate' + name = 'state' + plugin_attrib = 'psstate' + interfaces = set(('node', 'item', 'payload')) + plugin_attrib_map = {} + plugin_tag_map = {} + + def setPayload(self, value): + self.xml.append(value) + + def getPayload(self): + childs = self.xml.getchildren() + if len(childs) > 0: + return childs[0] + + def delPayload(self): + for child in self.xml.getchildren(): + self.xml.remove(child) + +stanzaPlugin(Iq, PubsubState) + +class PubsubStateEvent(ElementBase): + namespace = 'http://jabber.org/protocol/psstate#event' + name = 'event' + plugin_attrib = 'psstate_event' + intefaces = set(tuple()) + plugin_attrib_map = {} + plugin_tag_map = {} + +stanzaPlugin(Message, PubsubState) +stanzaPlugin(PubsubState, PubsubStateEvent) + class Pubsub(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'pubsub' @@ -321,18 +354,6 @@ class Options(ElementBase): stanzaPlugin(Pubsub, Options) stanzaPlugin(Subscribe, Options) -#iq = Iq() -#iq['pubsub']['defaultconfig'] -#print(iq) - -#from xml.etree import cElementTree as ET -#iq = Iq() -#item = Item() -#item['payload'] = ET.Element("{http://netflint.net/p/crap}stupidshit") -#item['id'] = 'aa11bbcc' -#iq['pubsub']['items'].append(item) -#print(iq) - class OwnerAffiliations(Affiliations): namespace = 'http://jabber.org/protocol/pubsub#owner' interfaces = set(('node')) |