remove useless function get_contcats_from_jid (same as get_contact). see #3275

This commit is contained in:
Yann Leboulanger 2007-07-03 10:22:41 +00:00
parent 20965b9ba5
commit 33946aeeef
4 changed files with 9 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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