comparison src/plugins/plugin_xep_0277.py @ 1760:30efe084471c

plugin XEP-0060: None is no more used in addManagedNode, but all nodes prefixed with a registered one are now triggered
author Goffi <goffi@goffi.org>
date Fri, 18 Dec 2015 15:06:58 +0100
parents 6fd0881fe1fc
children d17772b0fe22
comparison
equal deleted inserted replaced
1759:81923b3f8b14 1760:30efe084471c
70 def __init__(self, host): 70 def __init__(self, host):
71 log.info(_(u"Microblogging plugin initialization")) 71 log.info(_(u"Microblogging plugin initialization"))
72 self.host = host 72 self.host = host
73 self._p = self.host.plugins["XEP-0060"] # this facilitate the access to pubsub plugin 73 self._p = self.host.plugins["XEP-0060"] # this facilitate the access to pubsub plugin
74 self.rt_sessions = sat_defer.RTDeferredSessions() 74 self.rt_sessions = sat_defer.RTDeferredSessions()
75 self.host.plugins["XEP-0060"].addManagedNode(None, items_cb=self._itemsReceived) 75 self.host.plugins["XEP-0060"].addManagedNode(NS_MICROBLOG, items_cb=self._itemsReceived)
76 76
77 host.bridge.addMethod("mbSend", ".plugin", 77 host.bridge.addMethod("mbSend", ".plugin",
78 in_sign='ssa{ss}s', out_sign='', 78 in_sign='ssa{ss}s', out_sign='',
79 method=self._mbSend, 79 method=self._mbSend,
80 async=True) 80 async=True)
118 118
119 ## plugin management methods ## 119 ## plugin management methods ##
120 120
121 def _itemsReceived(self, itemsEvent, profile): 121 def _itemsReceived(self, itemsEvent, profile):
122 """Callback which manage items notifications (publish + retract)""" 122 """Callback which manage items notifications (publish + retract)"""
123 if not itemsEvent.nodeIdentifier.startswith(NS_MICROBLOG):
124 return
125 def manageItem(data, event): 123 def manageItem(data, event):
126 self.host.bridge.psEvent(C.PS_MICROBLOG, itemsEvent.sender.full(), itemsEvent.nodeIdentifier, event, data, profile) 124 self.host.bridge.psEvent(C.PS_MICROBLOG, itemsEvent.sender.full(), itemsEvent.nodeIdentifier, event, data, profile)
127 125
128 for item in itemsEvent.items: 126 for item in itemsEvent.items:
129 if item.name == C.PS_ITEM: 127 if item.name == C.PS_ITEM: