diff options
author | Lance Stout <lancestout@gmail.com> | 2011-09-01 13:36:11 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-09-01 13:36:11 -0700 |
commit | 7e5e9542e9873a251986bedfe274904e629920d0 (patch) | |
tree | 42e1ccf02383d5ea60591c26634b3d2e7d087e9f /sleekxmpp/plugins/xep_0060/stanza/pubsub.py | |
parent | d7fc2aaa9cd8427f73c78f1e6bfbc1c9e1569cf6 (diff) | |
download | slixmpp-7e5e9542e9873a251986bedfe274904e629920d0.tar.gz slixmpp-7e5e9542e9873a251986bedfe274904e629920d0.tar.bz2 slixmpp-7e5e9542e9873a251986bedfe274904e629920d0.tar.xz slixmpp-7e5e9542e9873a251986bedfe274904e629920d0.zip |
Add support for notify attribute when retracting an item.
Diffstat (limited to 'sleekxmpp/plugins/xep_0060/stanza/pubsub.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0060/stanza/pubsub.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py index 1a1de17a..45781c44 100644 --- a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py +++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py @@ -129,6 +129,23 @@ class Retract(ElementBase): plugin_attrib = name interfaces = set(('node', 'notify')) + def get_notify(self): + notify = self._get_attr('notify') + if notify in ('0', 'false'): + return False + elif notify in ('1', 'true'): + return True + return None + + def set_notify(self, value): + del self['notify'] + if value is None: + return + elif value in (True, '1', 'true', 'True'): + self._set_attr('notify', 'true') + else: + self._set_attr('notify', 'false') + class Unsubscribe(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' @@ -252,6 +269,11 @@ class PubsubStateEvent(ElementBase): intefaces = set(tuple()) +register_stanza_plugin(Iq, PubsubState) +register_stanza_plugin(Message, PubsubStateEvent) +register_stanza_plugin(PubsubStateEvent, PubsubState) + + register_stanza_plugin(Iq, Pubsub) register_stanza_plugin(Pubsub, Affiliations) register_stanza_plugin(Pubsub, Configure) @@ -274,7 +296,3 @@ register_stanza_plugin(Retract, Item) register_stanza_plugin(Subscribe, Options) register_stanza_plugin(Subscription, SubscribeOptions) register_stanza_plugin(Subscriptions, Subscription, iterable=True) - -register_stanza_plugin(Message, PubsubStateEvent) -register_stanza_plugin(Iq, PubsubState) -register_stanza_plugin(PubsubStateEvent, PubsubState) |