diff options
Diffstat (limited to 'sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py b/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py index c7263577..7f77d721 100644 --- a/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py +++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py @@ -15,14 +15,14 @@ class Event(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'event' plugin_attrib = 'pubsub_event' - interfaces = set(('node',)) + interfaces = set() class EventItem(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'item' plugin_attrib = name - interfaces = set(('id', 'payload')) + interfaces = set(('id', 'payload', 'node', 'publisher')) def set_payload(self, value): self.xml.append(value) @@ -76,7 +76,7 @@ class EventConfiguration(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'configuration' plugin_attrib = name - interfaces = set(('node', 'config')) + interfaces = set(('node',)) class EventPurge(ElementBase): @@ -86,6 +86,30 @@ class EventPurge(ElementBase): interfaces = set(('node',)) +class EventDelete(ElementBase): + namespace = 'http://jabber.org/protocol/pubsub#event' + name = 'delete' + plugin_attrib = name + interfaces = set(('node', 'redirect')) + + def set_redirect(self, uri): + del self['redirect'] + redirect = ET.Element('{%s}redirect' % self.namespace) + redirect.attrib['uri'] = uri + self.xml.append(redirect) + + def get_redirect(self): + redirect = self.xml.find('{%s}redirect' % self.namespace) + if redirect is not None: + return redirect.attrib.get('uri', '') + return '' + + def del_redirect(self): + redirect = self.xml.find('{%s}redirect' % self.namespace) + if redirect is not None: + self.xml.remove(redirect) + + class EventSubscription(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'subscription' @@ -102,8 +126,9 @@ class EventSubscription(ElementBase): register_stanza_plugin(Message, Event) register_stanza_plugin(Event, EventCollection) register_stanza_plugin(Event, EventConfiguration) -register_stanza_plugin(Event, EventItems) register_stanza_plugin(Event, EventPurge) +register_stanza_plugin(Event, EventDelete) +register_stanza_plugin(Event, EventItems) register_stanza_plugin(Event, EventSubscription) register_stanza_plugin(EventCollection, EventAssociate) register_stanza_plugin(EventCollection, EventDisassociate) |