diff --git a/src/common/contacts.py b/src/common/contacts.py index 9506919ada68560c51617276c0eccc9a37d9085f..fd7c53d6896774b3f94b0e1923405f16c1cf06af 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -226,13 +226,6 @@ class Contacts: return None return [] - def get_contacts_from_jid(self, account, jid): - '''we may have two or more resources on that jid''' - if jid in self._contacts[account]: - contacts_instances = self._contacts[account][jid] - return contacts_instances - return [] - def get_contact_from_full_jid(self, account, fjid): ''' Get Contact object for specific resource of given jid''' barejid, resource = common.gajim.get_room_and_nick_from_fjid(fjid) @@ -253,7 +246,7 @@ class Contacts: return prim_contact def get_contact_with_highest_priority(self, account, jid): - contacts = self.get_contacts_from_jid(account, jid) + contacts = self.get_contact(account, jid) if not contacts and '/' in jid: # jid may be a fake jid, try it room, nick = jid.split('/', 1) @@ -270,7 +263,7 @@ class Contacts: '''Returns all contacts in the given group''' group_contacts = [] for jid in self._contacts[account]: - contacts = self.get_contacts_from_jid(account, jid) + contacts = self.get_contact(account, jid) if group in contacts[0].groups: group_contacts += contacts return group_contacts diff --git a/src/gajim.py b/src/gajim.py index 12f1a13c9ff24e5cccb697bdbfba3d66976849ef..5068acc4b18c25c31a11f05b8cfb8ad0a0d74559 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -543,7 +543,7 @@ class Interface: # Update contact jid_list = gajim.contacts.get_jid_list(account) if ji in jid_list or jid == gajim.get_jid_from_account(account): - lcontact = gajim.contacts.get_contacts_from_jid(account, ji) + lcontact = gajim.contacts.get_contact(account, ji) contact1 = None resources = [] for c in lcontact: @@ -1274,7 +1274,7 @@ class Interface: sub = array[2] ask = array[3] groups = array[4] - contacts = gajim.contacts.get_contacts_from_jid(account, jid) + contacts = gajim.contacts.get_contact(account, jid) # contact removes us. if (not sub or sub == 'none') and (not ask or ask == 'none') and \ not name and not groups: diff --git a/src/remote_control.py b/src/remote_control.py index c9583f50ff3f73efbbbc3ede5b85685fc1356687..6234378949a6ad7f83662f08f80a16600c5e9812 100644 --- a/src/remote_control.py +++ b/src/remote_control.py @@ -531,12 +531,12 @@ class SignalObject(dbus.service.Object): nick_in_roster = None # Is jid a nick ? for account in accounts: # Does jid exists in roster of one account ? - if gajim.contacts.get_contacts_from_jid(account, jid): + if gajim.contacts.get_contact(account, jid): return jid if not nick_in_roster: # look in all contact if one has jid as nick for jid_ in gajim.contacts.get_jid_list(account): - c = gajim.contacts.get_contacts_from_jid(account, jid_) + c = gajim.contacts.get_contact(account, jid_) if c[0].name == jid: nick_in_roster = jid_ break diff --git a/src/roster_window.py b/src/roster_window.py index 550e8c9fa0f2bb8120279f37ece993f0669b68f9..c819b76b37909238159598716ef7855b94c0af5d 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3717,7 +3717,7 @@ class RosterWindow: if not contact: # If there is another resource, it may be a message from an invisible # resource - lcontact = gajim.contacts.get_contacts_from_jid(account, jid) + lcontact = gajim.contacts.get_contact(account, jid) if (len(lcontact) > 1 or (lcontact and lcontact[0].resource and \ lcontact[0].show != 'offline')) and jid.find('@') > 0: contact = gajim.contacts.copy_contact(highest_contact) @@ -3883,7 +3883,8 @@ class RosterWindow: '''close all the windows from an account if force is True, do not ask confirmation before closing chat/gc windows ''' - self.close_all_from_dict(gajim.interface.instances[account]) + if account in gajim.interface.instances: + self.close_all_from_dict(gajim.interface.instances[account]) for ctrl in gajim.interface.msg_win_mgr.get_controls(acct = account): ctrl.parent_win.remove_tab(ctrl, ctrl.parent_win.CLOSE_CLOSE_BUTTON, force = force)