Mercurial > libervia-backend
diff src/plugins/plugin_misc_groupblog.py @ 616:8782f94e761e
plugin groupblog: comment item is specified through microblog data, there is no more a specific signal type
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 16 Jun 2013 18:49:02 +0200 |
parents | 6f4c31192c7c |
children | dafdbe28ca2f |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_groupblog.py Mon May 20 23:21:29 2013 +0200 +++ b/src/plugins/plugin_misc_groupblog.py Sun Jun 16 18:49:02 2013 +0200 @@ -182,12 +182,12 @@ publisher = "" # FIXME: publisher attribute for item in SàT pubsub is not managed yet, so # publisher is not checked and can be easily spoofed. This need to be fixed # quickly. - microblog_data = self.item2gbdata(item) - microblog_data["comments_service"] = event.sender.userhost() - microblog_data["comments_node"] = event.nodeIdentifier + microblog_data = self.item2gbdata(item, "comment") + microblog_data["service"] = event.sender.userhost() + microblog_data["node"] = event.nodeIdentifier microblog_data["verified_publisher"] = "true" if publisher else "false" - self.host.bridge.personalEvent(publisher.full() if publisher else microblog_data["author"], "MICROBLOG_COMMENT", microblog_data, profile) + self.host.bridge.personalEvent(publisher.full() if publisher else microblog_data["author"], "MICROBLOG", microblog_data, profile) return False return True @@ -208,9 +208,10 @@ break - def item2gbdata(self, item): + def item2gbdata(self, item, _type="main_item"): """ Convert item to microblog data dictionary + add access data """ microblog_data = self.host.plugins["XEP-0277"].item2mbdata(item) + microblog_data["type"] = _type self._parseAccessData(microblog_data, item) return microblog_data @@ -340,9 +341,9 @@ # if there is a comments node, we subscribe to it if "comments_node" in gbdata and pub_jid.userhostJID() != client.jid.userhostJID(): try: - self.host.plugins["XEP-0060"].subscribe(gbdata["comments_service"], gbdata["comments_node"], + self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], profile_key=client.profile) - self.host.plugins["XEP-0060"].getItems(gbdata["comments_service"], gbdata["comments_node"], profile_key=client.profile) + self.host.plugins["XEP-0060"].getItems(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], profile_key=client.profile) except KeyError: warning("Missing key for comments") return ret