# HG changeset patch # User Goffi # Date 1302825790 -7200 # Node ID f56108eb2880754b39317462905872339bfc6325 # Parent 0aa6ca6cdbddedb1dbfb067a42474b518c5875de plugin group blog: a custom cb is now used to specitfy node and groups targetted by the blog diff -r 0aa6ca6cdbdd -r f56108eb2880 src/plugins/plugin_misc_groupblog.py --- a/src/plugins/plugin_misc_groupblog.py Tue Apr 12 20:40:47 2011 +0200 +++ b/src/plugins/plugin_misc_groupblog.py Fri Apr 15 02:03:10 2011 +0200 @@ -67,7 +67,7 @@ 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 @@ '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}