Allow to have several SelfContact jids in merged accounts mode. Previously only one was shown.

This commit is contained in:
Stephan Erb 2008-05-07 17:42:42 +00:00
parent 1fdcb84e36
commit 09b3af3367
1 changed files with 13 additions and 5 deletions

View File

@ -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: