prevent loop is pubsub disco (even if server answer looks strange) fixes #3292

This commit is contained in:
Yann Leboulanger 2007-07-10 22:52:19 +00:00
parent 5f1eaeb312
commit 96e92dd809
1 changed files with 13 additions and 3 deletions

View File

@ -1837,6 +1837,15 @@ class DiscussionGroupsBrowser(AgentBrowser):
self._total_items += 1
self._add_item(jid, node, item, force)
def _in_list_foreach(self, model, path, iter, node):
if model[path][1] == node:
self.in_list = True
def _in_list(self, node):
self.in_list = False
self.model.foreach(self._in_list_foreach, node)
return self.in_list
def _add_item(self, jid, node, item, force):
''' Called when we got basic information about new node from query.
Show the item. '''
@ -1858,9 +1867,10 @@ class DiscussionGroupsBrowser(AgentBrowser):
parent_node = node_splitted.pop(0)
parent_iter = self._get_child_iter(parent_iter, parent_node)
node_splitted[0] = parent_node + '/' + node_splitted[0]
self.model.append(parent_iter, (jid, node, name, dunno, subscribed))
self.cache.get_items(jid, node, self._add_items, force = force,
args = (force,))
if not self._in_list(node):
self.model.append(parent_iter, (jid, node, name, dunno, subscribed))
self.cache.get_items(jid, node, self._add_items, force = force,
args = (force,))
def _get_child_iter(self, parent_iter, node):
child_iter = self.model.iter_children(parent_iter)