plugin group blog: getItems for comments fixed when we are the publisher of the parent node

This commit is contained in:
Goffi 2013-06-17 13:55:11 +02:00
commit 9bec52525b

View file

@ -352,11 +352,12 @@ class GroupBlog(object):
gbdata = self.item2gbdata(item)
ret.append(gbdata)
# if there is a comments node, we subscribe to it
if "comments_node" in gbdata and pub_jid.userhostJID() != client.jid.userhostJID():
if "comments_node" in gbdata:
try:
# every comments node must be subscribed
self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"],
profile_key=client.profile)
# every comments node must be subscribed, except if we are the publisher (we are already subscribed in this case)
if pub_jid.userhostJID() != client.jid.userhostJID():
self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"],
profile_key=client.profile)
# we get all comments of the node, and handle them
defer_getItems = self.host.plugins["XEP-0060"].getItems(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], profile_key=client.profile)
defer_getItems.addCallback(self._handleCommentsItems, jid.JID(gbdata["comments_service"]), gbdata["comments_node"], client.profile)