Skip to content
Snippets Groups Projects
Commit d2659b2c authored by nkour's avatar nkour
Browse files

moving function to right place

parent e418a3e0
No related branches found
No related tags found
No related merge requests found
......@@ -108,16 +108,18 @@ def get_first_contact_instance_from_jid(account, jid):
def get_contact_instance_with_highest_priority(account, jid):
contact_instances = contacts[account][jid]
which_has_highest_prio = 0 # which resource has highest priority?
which = 0
for c in contact_instances[1:]:
which += 1
if c.priority > which_has_highest_prio:
which_has_highest_prio = which
return contacts[account][jid][which_has_highest_prio]
return get_highest_prio_contact_from_contacts(contact_instances)
def get_contact_name_from_jid(account, jid):
return contacts[account][jid][0].name
def get_highest_prio_contact_from_contacts(contacts):
prim_contact = None # primary contact
for contact in contacts:
if prim_contact == None or int(contact.priority) > \
int(prim_contact.priority):
prim_contact = contact
return prim_contact
def get_jid_without_resource(jid):
return jid.split('/')[0]
......
......@@ -25,14 +25,6 @@ from common import i18n
_ = i18n._
def get_prim_contact_from_list(contacts):
prim_contact = None # primary contact
for contact in contacts:
if prim_contact == None or int(contact.priority) > \
int(prim_contact.priority):
prim_contact = contact
return prim_contact
def convert_bytes(string):
suffix = ''
# IEC standard says KiB = 1024 bytes KB = 1000 bytes
......
......@@ -814,7 +814,7 @@ class RosterTooltip(BaseTooltip, StatusTable):
self.hbox.set_homogeneous(False)
self.create_table()
# primary contact
prim_contact = helpers.get_prim_contact_from_list(contacts)
prim_contact = gajim.get_highest_prio_contact_from_contacts(contacts)
# try to find the image for the contact status
state_file = prim_contact.show.replace(' ', '_')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment