Allow to have several SelfContact jids in merged accounts mode. Previously only one was shown.
This commit is contained in:
parent
1fdcb84e36
commit
09b3af3367
|
@ -123,10 +123,11 @@ class RosterWindow:
|
||||||
return group_iter
|
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.
|
''' Return the gtk.TreeIter of SelfContact or None if not found.
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
|
jid -- the jid of SelfContact
|
||||||
account -- the account of SelfContact
|
account -- the account of SelfContact
|
||||||
model -- the data model (default TreeFilterModel)
|
model -- the data model (default TreeFilterModel)
|
||||||
|
|
||||||
|
@ -135,9 +136,16 @@ class RosterWindow:
|
||||||
if not model:
|
if not model:
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
iterAcct = self._get_account_iter(account, model)
|
iterAcct = self._get_account_iter(account, model)
|
||||||
iter = model.iter_children(iterAcct)
|
iterC = model.iter_children(iterAcct)
|
||||||
if iter and model[iter][C_TYPE] == 'self_contact':
|
|
||||||
return iter
|
# 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
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,7 +165,7 @@ class RosterWindow:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if jid == gajim.get_jid_from_account(account):
|
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:
|
if iter:
|
||||||
return [iter]
|
return [iter]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue