don't add twice the same room jid in browser. fixes #4256

This commit is contained in:
Yann Leboulanger 2008-08-29 10:38:34 +00:00
parent 7f1a132caa
commit f64cd6d238
1 changed files with 8 additions and 5 deletions

View File

@ -947,6 +947,9 @@ _('This service does not contain any items to browse.'))
for item in items: for item in items:
jid = item['jid'] jid = item['jid']
node = item.get('node', '') node = item.get('node', '')
# If such an item is already here: don't add it
if self._find_item(jid, node):
continue
self._total_items += 1 self._total_items += 1
self._add_item(jid, node, item, force) self._add_item(jid, node, item, force)
self.window.services_treeview.set_model(self.model) self.window.services_treeview.set_model(self.model)
@ -963,8 +966,7 @@ _('This service does not contain any items to browse.'))
self._update_error(iter, jid, node) self._update_error(iter, jid, node)
else: else:
# We got our info # We got our info
self._update_info(iter, jid, node, self._update_info(iter, jid, node, identities, features, data)
identities, features, data)
self.update_actions() self.update_actions()
def _add_item(self, jid, node, item, force): def _add_item(self, jid, node, item, force):
@ -1672,7 +1674,8 @@ class MucBrowser(AgentBrowser):
# Bottom row # Bottom row
# Iter compare is broke, use the path instead # Iter compare is broke, use the path instead
try: try:
ex, ey = view.tree_to_widget_coords(rect.x + rect.height, rect.y + rect.height) ex, ey = view.tree_to_widget_coords(rect.x + rect.height,
rect.y + rect.height)
end = view.get_path_at_pos(ex, ey)[0] end = view.get_path_at_pos(ex, ey)[0]
# end is the last visible, we want to query that aswell # end is the last visible, we want to query that aswell
end = (end[0] + 1,) end = (end[0] + 1,)
@ -1726,7 +1729,7 @@ class MucBrowser(AgentBrowser):
name = identities[0].get('name', '') name = identities[0].get('name', '')
for form in data: for form in data:
typefield = form.getField('FORM_TYPE') typefield = form.getField('FORM_TYPE')
if typefield and typefield.getValue() ==\ if typefield and typefield.getValue() == \
'http://jabber.org/protocol/muc#roominfo': 'http://jabber.org/protocol/muc#roominfo':
# Fill model row from the form's fields # Fill model row from the form's fields
users = form.getField('muc#roominfo_occupants') users = form.getField('muc#roominfo_occupants')