plugin group blog: a custom cb is now used to specitfy node and groups targetted by the blog
This commit is contained in:
parent
e3391fdd80
commit
b73a453903
1 changed files with 8 additions and 1 deletions
|
|
@ -67,7 +67,7 @@ class GroupBlog():
|
|||
self.host = host
|
||||
self._blog_nodes={}
|
||||
for i in range(1,21):
|
||||
self.host.plugins["XEP-0163"].addPEPEvent("MICROBLOG_%02d" % i, NS_MICROBLOG % i, self.host.plugins["XEP-0277"].microblogCB, None)
|
||||
self.host.plugins["XEP-0163"].addPEPEvent("MICROBLOG_%02d" % i, NS_MICROBLOG % i, self.groupblogCB, None)
|
||||
|
||||
host.bridge.addMethod("cleanBlogCollection", ".communication", in_sign='s', out_sign='',
|
||||
method=self.cleanBlogCollection,
|
||||
|
|
@ -96,6 +96,13 @@ class GroupBlog():
|
|||
'param_0':'jid of the group node published',
|
||||
'param_1':'%(doc_profile)s'
|
||||
})
|
||||
|
||||
def groupblogCB(self, itemsEvent, profile):
|
||||
for item in itemsEvent.items:
|
||||
microblog_data = self.host.plugins["XEP-0277"]._item2mbdata(item)
|
||||
microblog_data["node"] = itemsEvent.nodeIdentifier
|
||||
microblog_data["groups"] = "\n".join(self._blog_nodes[profile].get(itemsEvent.nodeIdentifier, []))
|
||||
self.host.bridge.personalEvent(itemsEvent.sender.full(), "MICROBLOG", microblog_data, profile)
|
||||
|
||||
def _getRootNode(self, entity):
|
||||
return "%(entity)s_%(root_suff)s" % {'entity':entity.userhost(), 'root_suff':MBLOG_COLLECTION}
|
||||
|
|
|
|||
Loading…
Reference in a new issue