Correct missing pubsub#event stanzas and interfaces.
This commit is contained in:
parent
eb1a32fc90
commit
861d279b08
1 changed files with 29 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue