chat_control : fix possible var name confusion

roster : Fix resource problem, gajim.contacts.get_contact() can return first contact instead of specified resource. Fixes #3789.
This commit is contained in:
Jean-Marie Traissard 2008-03-23 17:44:47 +00:00
parent 8aa1573e78
commit a0d8aea90b
2 changed files with 12 additions and 7 deletions

View File

@ -1217,8 +1217,9 @@ class ChatControl(ChatControlBase):
if acct_info: # We already found a contact with same nick
break
for jid in gajim.contacts.get_jid_list(account):
contact_ = gajim.contacts.get_first_contact_from_jid(account, jid)
if contact_.get_shown_name() == self.contact.get_shown_name():
other_contact_ = \
gajim.contacts.get_first_contact_from_jid(account, jid)
if other_contact_.get_shown_name() == self.contact.get_shown_name():
acct_info = ' (%s)' % \
gobject.markup_escape_text(self.account)
break

View File

@ -4350,6 +4350,7 @@ class RosterWindow:
type_ = model[path][C_TYPE]
jid = model[path][C_JID].decode('utf-8')
resource = None
contact = None
iter = model.get_iter(path)
if type_ in ('group', 'account'):
if self.tree.row_expanded(path):
@ -4386,12 +4387,15 @@ class RosterWindow:
fjid += '/' + resource
if self.open_event(account, fjid, first_ev):
return
c = gajim.contacts.get_contact(account, jid, resource)
if not c or isinstance(c, list):
c = gajim.contacts.get_contact_with_highest_priority(account, jid)
# else
contact = gajim.contacts.get_contact(account, jid, resource)
if not contact or isinstance(contact, list):
contact = \
gajim.contacts.get_contact_with_highest_priority(account, jid)
if jid == gajim.get_jid_from_account(account):
resource = c.resource
self.on_open_chat_window(widget, c, account, resource = resource, session = session)
resource = contact.resource
self.on_open_chat_window(widget, contact, account, \
resource = resource, session = session)
def on_roster_treeview_row_activated(self, widget, path, col = 0):
'''When an iter is double clicked: open the first event window'''