comparison src/plugins/plugin_misc_groupblog.py @ 619:1de01a2154e2

plugin group blog: getItems for comments fixed when we are the publisher of the parent node
author Goffi <goffi@goffi.org>
date Mon, 17 Jun 2013 13:55:11 +0200
parents e2c33a16d235
children 0e16288d6816
comparison
equal deleted inserted replaced
618:e2c33a16d235 619:1de01a2154e2
350 ret = [] 350 ret = []
351 for item in items: 351 for item in items:
352 gbdata = self.item2gbdata(item) 352 gbdata = self.item2gbdata(item)
353 ret.append(gbdata) 353 ret.append(gbdata)
354 # if there is a comments node, we subscribe to it 354 # if there is a comments node, we subscribe to it
355 if "comments_node" in gbdata and pub_jid.userhostJID() != client.jid.userhostJID(): 355 if "comments_node" in gbdata:
356 try: 356 try:
357 # every comments node must be subscribed 357 # every comments node must be subscribed, except if we are the publisher (we are already subscribed in this case)
358 self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], 358 if pub_jid.userhostJID() != client.jid.userhostJID():
359 profile_key=client.profile) 359 self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"],
360 profile_key=client.profile)
360 # we get all comments of the node, and handle them 361 # we get all comments of the node, and handle them
361 defer_getItems = self.host.plugins["XEP-0060"].getItems(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], profile_key=client.profile) 362 defer_getItems = self.host.plugins["XEP-0060"].getItems(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], profile_key=client.profile)
362 defer_getItems.addCallback(self._handleCommentsItems, jid.JID(gbdata["comments_service"]), gbdata["comments_node"], client.profile) 363 defer_getItems.addCallback(self._handleCommentsItems, jid.JID(gbdata["comments_service"]), gbdata["comments_node"], client.profile)
363 except KeyError: 364 except KeyError:
364 warning("Missing key for comments") 365 warning("Missing key for comments")