From 09b3af33677de61e80c709ef7c979c013421a2b4 Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Wed, 7 May 2008 17:42:42 +0000 Subject: [PATCH] Allow to have several SelfContact jids in merged accounts mode. Previously only one was shown. --- src/roster_window.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/roster_window.py b/src/roster_window.py index b44925588..902844ced 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -123,10 +123,11 @@ class RosterWindow: return group_iter - def _get_self_contact_iter(self, account, model = None): + def _get_self_contact_iter(self, jid, account, model = None): ''' Return the gtk.TreeIter of SelfContact or None if not found. Keyword arguments: + jid -- the jid of SelfContact account -- the account of SelfContact model -- the data model (default TreeFilterModel) @@ -135,9 +136,16 @@ class RosterWindow: if not model: model = self.modelfilter iterAcct = self._get_account_iter(account, model) - iter = model.iter_children(iterAcct) - if iter and model[iter][C_TYPE] == 'self_contact': - return iter + iterC = model.iter_children(iterAcct) + + # There might be several SelfContacts in merged account view + while iterC: + if model[iterC][C_TYPE] != 'self_contact': + break + iter_jid = model[iterC][C_JID] + if iter_jid and jid == iter_jid.decode('utf-8'): + return iterC + iterC = model.iter_next(iterC) return None @@ -157,7 +165,7 @@ class RosterWindow: return [] if jid == gajim.get_jid_from_account(account): - iter = self._get_self_contact_iter(account, model) + iter = self._get_self_contact_iter(jid, account, model) if iter: return [iter] else: