remove useless function get_contcats_from_jid (same as get_contact). see #3275
This commit is contained in:
parent
20965b9ba5
commit
33946aeeef
|
@ -226,13 +226,6 @@ class Contacts:
|
||||||
return None
|
return None
|
||||||
return []
|
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):
|
def get_contact_from_full_jid(self, account, fjid):
|
||||||
''' Get Contact object for specific resource of given jid'''
|
''' Get Contact object for specific resource of given jid'''
|
||||||
barejid, resource = common.gajim.get_room_and_nick_from_fjid(fjid)
|
barejid, resource = common.gajim.get_room_and_nick_from_fjid(fjid)
|
||||||
|
@ -253,7 +246,7 @@ class Contacts:
|
||||||
return prim_contact
|
return prim_contact
|
||||||
|
|
||||||
def get_contact_with_highest_priority(self, account, jid):
|
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:
|
if not contacts and '/' in jid:
|
||||||
# jid may be a fake jid, try it
|
# jid may be a fake jid, try it
|
||||||
room, nick = jid.split('/', 1)
|
room, nick = jid.split('/', 1)
|
||||||
|
@ -270,7 +263,7 @@ class Contacts:
|
||||||
'''Returns all contacts in the given group'''
|
'''Returns all contacts in the given group'''
|
||||||
group_contacts = []
|
group_contacts = []
|
||||||
for jid in self._contacts[account]:
|
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:
|
if group in contacts[0].groups:
|
||||||
group_contacts += contacts
|
group_contacts += contacts
|
||||||
return group_contacts
|
return group_contacts
|
||||||
|
|
|
@ -543,7 +543,7 @@ class Interface:
|
||||||
# Update contact
|
# Update contact
|
||||||
jid_list = gajim.contacts.get_jid_list(account)
|
jid_list = gajim.contacts.get_jid_list(account)
|
||||||
if ji in jid_list or jid == gajim.get_jid_from_account(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
|
contact1 = None
|
||||||
resources = []
|
resources = []
|
||||||
for c in lcontact:
|
for c in lcontact:
|
||||||
|
@ -1274,7 +1274,7 @@ class Interface:
|
||||||
sub = array[2]
|
sub = array[2]
|
||||||
ask = array[3]
|
ask = array[3]
|
||||||
groups = array[4]
|
groups = array[4]
|
||||||
contacts = gajim.contacts.get_contacts_from_jid(account, jid)
|
contacts = gajim.contacts.get_contact(account, jid)
|
||||||
# contact removes us.
|
# contact removes us.
|
||||||
if (not sub or sub == 'none') and (not ask or ask == 'none') and \
|
if (not sub or sub == 'none') and (not ask or ask == 'none') and \
|
||||||
not name and not groups:
|
not name and not groups:
|
||||||
|
|
|
@ -531,12 +531,12 @@ class SignalObject(dbus.service.Object):
|
||||||
nick_in_roster = None # Is jid a nick ?
|
nick_in_roster = None # Is jid a nick ?
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
# Does jid exists in roster of one account ?
|
# 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
|
return jid
|
||||||
if not nick_in_roster:
|
if not nick_in_roster:
|
||||||
# look in all contact if one has jid as nick
|
# look in all contact if one has jid as nick
|
||||||
for jid_ in gajim.contacts.get_jid_list(account):
|
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:
|
if c[0].name == jid:
|
||||||
nick_in_roster = jid_
|
nick_in_roster = jid_
|
||||||
break
|
break
|
||||||
|
|
|
@ -3717,7 +3717,7 @@ class RosterWindow:
|
||||||
if not contact:
|
if not contact:
|
||||||
# If there is another resource, it may be a message from an invisible
|
# If there is another resource, it may be a message from an invisible
|
||||||
# resource
|
# 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 \
|
if (len(lcontact) > 1 or (lcontact and lcontact[0].resource and \
|
||||||
lcontact[0].show != 'offline')) and jid.find('@') > 0:
|
lcontact[0].show != 'offline')) and jid.find('@') > 0:
|
||||||
contact = gajim.contacts.copy_contact(highest_contact)
|
contact = gajim.contacts.copy_contact(highest_contact)
|
||||||
|
@ -3883,7 +3883,8 @@ class RosterWindow:
|
||||||
'''close all the windows from an account
|
'''close all the windows from an account
|
||||||
if force is True, do not ask confirmation before closing chat/gc windows
|
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):
|
for ctrl in gajim.interface.msg_win_mgr.get_controls(acct = account):
|
||||||
ctrl.parent_win.remove_tab(ctrl, ctrl.parent_win.CLOSE_CLOSE_BUTTON,
|
ctrl.parent_win.remove_tab(ctrl, ctrl.parent_win.CLOSE_CLOSE_BUTTON,
|
||||||
force = force)
|
force = force)
|
||||||
|
|
Loading…
Reference in New Issue