[Lukas] split get_contact into get_contacts and get_contact. get_contact_from_full_jid uses get_contact. Maybe could be merged with optional argument, but it's clearer this way. Fixes #3275
This commit is contained in:
parent
070369fc2a
commit
8abd062365
7 changed files with 56 additions and 55 deletions
|
@ -4,6 +4,7 @@
|
||||||
## Copyright (C) 2006-2007 Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2006-2007 Nikos Kouremenos <kourem@gmail.com>
|
||||||
## Copyright (C) 2006 Travis Shirk <travis@pobox.com>
|
## Copyright (C) 2006 Travis Shirk <travis@pobox.com>
|
||||||
## Copyright (C) 2006 Dimitur Kirov <dkirov@gmail.com>
|
## Copyright (C) 2006 Dimitur Kirov <dkirov@gmail.com>
|
||||||
|
## Copyright (C) 2007 Lukas Petrovicky <lukas@petrovicky.net>
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published
|
## it under the terms of the GNU General Public License as published
|
||||||
|
@ -1838,7 +1839,7 @@ class ChatControl(ChatControlBase):
|
||||||
show_transports = gajim.config.get('show_transports_group')
|
show_transports = gajim.config.get('show_transports_group')
|
||||||
if (not show_transports and gajim.jid_is_transport(jid)) or \
|
if (not show_transports and gajim.jid_is_transport(jid)) or \
|
||||||
(not show_offline and typ == 'chat' and \
|
(not show_offline and typ == 'chat' and \
|
||||||
len(gajim.contacts.get_contact(self.account, jid)) < 2):
|
len(gajim.contacts.get_contacts(self.account, jid)) < 2):
|
||||||
gajim.interface.roster.really_remove_contact(self.contact,
|
gajim.interface.roster.really_remove_contact(self.contact,
|
||||||
self.account)
|
self.account)
|
||||||
elif typ == 'pm':
|
elif typ == 'pm':
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
##
|
##
|
||||||
## Copyright (C) 2006 Yann Le Boulanger <asterix@lagaule.org>
|
## Copyright (C) 2006 Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## Copyright (C) 2006 Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2006 Nikos Kouremenos <kourem@gmail.com>
|
||||||
|
## Copyright (C) 2007 Lukas Petrovicky <lukas@petrovicky.net>
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -210,31 +211,26 @@ class Contacts:
|
||||||
# remove metacontacts info
|
# remove metacontacts info
|
||||||
self.remove_metacontact(account, jid)
|
self.remove_metacontact(account, jid)
|
||||||
|
|
||||||
def get_contact(self, account, jid, resource = None):
|
def get_contacts(self, account, jid):
|
||||||
'''Returns the list of contact instances for this jid (one per resource)
|
'''Returns the list of contact instances for this jid.'''
|
||||||
or [] if no resource is given
|
if jid in self._contacts[account]:
|
||||||
returns the contact instance for the given resource if it's given
|
return self._contacts[account][jid]
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
def get_contact(self, account, jid, resource):
|
||||||
|
'''Returns the contact instance for the given resource if it's given
|
||||||
or None if there is not'''
|
or None if there is not'''
|
||||||
if jid in self._contacts[account]:
|
if jid in self._contacts[account]:
|
||||||
contacts = self._contacts[account][jid]
|
for c in self._contacts[account][jid]:
|
||||||
if not resource:
|
|
||||||
return contacts
|
|
||||||
for c in contacts:
|
|
||||||
if c.resource == resource:
|
if c.resource == resource:
|
||||||
return c
|
return c
|
||||||
if resource:
|
return None
|
||||||
return None
|
|
||||||
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)
|
||||||
if barejid in self._contacts[account]:
|
return self.get_contact(account, barejid, resource)
|
||||||
contacts = self._contacts[account][barejid]
|
|
||||||
for c in contacts:
|
|
||||||
if c.resource==resource:
|
|
||||||
return c
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_highest_prio_contact_from_contacts(self, contacts):
|
def get_highest_prio_contact_from_contacts(self, contacts):
|
||||||
if not contacts:
|
if not contacts:
|
||||||
|
@ -246,7 +242,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_contact(account, jid)
|
contacts = self.get_contacts(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)
|
||||||
|
@ -263,7 +259,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_contact(account, jid)
|
contacts = self.get_contacts(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
|
||||||
|
|
|
@ -115,7 +115,7 @@ class EditGroupsDialog:
|
||||||
if not gajim.interface.roster.regroup and _account != account:
|
if not gajim.interface.roster.regroup and _account != account:
|
||||||
continue
|
continue
|
||||||
for _jid in all_jid[_account]:
|
for _jid in all_jid[_account]:
|
||||||
contacts = gajim.contacts.get_contact(_account, _jid)
|
contacts = gajim.contacts.get_contacts(_account, _jid)
|
||||||
for c in contacts:
|
for c in contacts:
|
||||||
if group in c.groups:
|
if group in c.groups:
|
||||||
c.groups.remove(group)
|
c.groups.remove(group)
|
||||||
|
@ -133,7 +133,7 @@ class EditGroupsDialog:
|
||||||
if not gajim.interface.roster.regroup and _account != account:
|
if not gajim.interface.roster.regroup and _account != account:
|
||||||
continue
|
continue
|
||||||
for _jid in all_jid[_account]:
|
for _jid in all_jid[_account]:
|
||||||
contacts = gajim.contacts.get_contact(_account, _jid)
|
contacts = gajim.contacts.get_contacts(_account, _jid)
|
||||||
for c in contacts:
|
for c in contacts:
|
||||||
if not group in c.groups:
|
if not group in c.groups:
|
||||||
c.groups.append(group)
|
c.groups.append(group)
|
||||||
|
|
13
src/gajim.py
13
src/gajim.py
|
@ -6,6 +6,7 @@
|
||||||
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
||||||
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
||||||
## Copyright (C) 2005 Travis Shirk <travis@pobox.com>
|
## Copyright (C) 2005 Travis Shirk <travis@pobox.com>
|
||||||
|
## Copyright (C) 2007 Lukas Petrovicky <lukas@petrovicky.net>
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published
|
## it under the terms of the GNU General Public License as published
|
||||||
|
@ -543,7 +544,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_contact(account, ji)
|
lcontact = gajim.contacts.get_contacts(account, ji)
|
||||||
contact1 = None
|
contact1 = None
|
||||||
resources = []
|
resources = []
|
||||||
for c in lcontact:
|
for c in lcontact:
|
||||||
|
@ -726,7 +727,7 @@ class Interface:
|
||||||
chat_control = self.msg_win_mgr.get_control(jid, account)
|
chat_control = self.msg_win_mgr.get_control(jid, account)
|
||||||
|
|
||||||
# Handle chat states
|
# Handle chat states
|
||||||
contact = gajim.contacts.get_contact(account, jid, resource)
|
contact = gajim.contacts.get_contacts(account, jid, resource)
|
||||||
if contact and isinstance(contact, list):
|
if contact and isinstance(contact, list):
|
||||||
contact = contact[0]
|
contact = contact[0]
|
||||||
if contact:
|
if contact:
|
||||||
|
@ -755,7 +756,7 @@ class Interface:
|
||||||
return
|
return
|
||||||
|
|
||||||
if gajim.config.get('ignore_unknown_contacts') and \
|
if gajim.config.get('ignore_unknown_contacts') and \
|
||||||
not gajim.contacts.get_contact(account, jid) and not pm:
|
not gajim.contacts.get_contacts(account, jid) and not pm:
|
||||||
return
|
return
|
||||||
if not contact:
|
if not contact:
|
||||||
# contact is not in the roster, create a fake one to display
|
# contact is not in the roster, create a fake one to display
|
||||||
|
@ -1052,7 +1053,7 @@ class Interface:
|
||||||
elif self.instances[account]['infos'].has_key(array[0] + '/' + array[1]):
|
elif self.instances[account]['infos'].has_key(array[0] + '/' + array[1]):
|
||||||
win = self.instances[account]['infos'][array[0] + '/' + array[1]]
|
win = self.instances[account]['infos'][array[0] + '/' + array[1]]
|
||||||
if win:
|
if win:
|
||||||
c = gajim.contacts.get_contact(account, array[0], array[1])
|
c = gajim.contacts.get_contacts(account, array[0], array[1])
|
||||||
# c is a list when no resource is given. it probably means that contact
|
# c is a list when no resource is given. it probably means that contact
|
||||||
# is offline, so only on Contact instance
|
# is offline, so only on Contact instance
|
||||||
if isinstance(c, list) and len(c):
|
if isinstance(c, list) and len(c):
|
||||||
|
@ -1274,7 +1275,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_contact(account, jid)
|
contacts = gajim.contacts.get_contacts(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:
|
||||||
|
@ -2189,7 +2190,7 @@ class Interface:
|
||||||
gajim.events.change_jid(account, fjid, jid)
|
gajim.events.change_jid(account, fjid, jid)
|
||||||
resource = None
|
resource = None
|
||||||
fjid = jid
|
fjid = jid
|
||||||
contact = gajim.contacts.get_contact(account, jid, resource)
|
contact = gajim.contacts.get_contacts(account, jid, resource)
|
||||||
if not contact or isinstance(contact, list):
|
if not contact or isinstance(contact, list):
|
||||||
contact = highest_contact
|
contact = highest_contact
|
||||||
self.roster.new_chat(contact, account, resource = resource)
|
self.roster.new_chat(contact, account, resource = resource)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
||||||
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
||||||
## Copyright (C) 2005-2006 Andrew Sayman <lorien420@myrealbox.com>
|
## Copyright (C) 2005-2006 Andrew Sayman <lorien420@myrealbox.com>
|
||||||
|
## Copyright (C) 2007 Lukas Petrovicky <lukas@petrovicky.net>
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published
|
## it under the terms of the GNU General Public License as published
|
||||||
|
@ -410,7 +411,7 @@ class SignalObject(dbus.service.Object):
|
||||||
if acct in accounts:
|
if acct in accounts:
|
||||||
for jid in gajim.contacts.get_jid_list(acct):
|
for jid in gajim.contacts.get_jid_list(acct):
|
||||||
item = self._contacts_as_dbus_structure(
|
item = self._contacts_as_dbus_structure(
|
||||||
gajim.contacts.get_contact(acct, jid))
|
gajim.contacts.get_contacts(acct, jid))
|
||||||
if item:
|
if item:
|
||||||
result.append(item)
|
result.append(item)
|
||||||
return result
|
return result
|
||||||
|
@ -503,7 +504,7 @@ class SignalObject(dbus.service.Object):
|
||||||
accounts = [account]
|
accounts = [account]
|
||||||
contact_exists = False
|
contact_exists = False
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
contacts = gajim.contacts.get_contact(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
if contacts:
|
if contacts:
|
||||||
gajim.connections[account].unsubscribe(jid)
|
gajim.connections[account].unsubscribe(jid)
|
||||||
for contact in contacts:
|
for contact in contacts:
|
||||||
|
@ -531,12 +532,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_contact(account, jid):
|
if gajim.contacts.get_contacts(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_contact(account, jid_)
|
c = gajim.contacts.get_contacts(account, jid_)
|
||||||
if c[0].name == jid:
|
if c[0].name == jid:
|
||||||
nick_in_roster = jid_
|
nick_in_roster = jid_
|
||||||
break
|
break
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
|
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2005-2007 Nikos Kouremenos <kourem@gmail.com>
|
||||||
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
||||||
|
## Copyright (C) 2007 Lukas Petrovicky <lukas@petrovicky.net>
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published
|
## it under the terms of the GNU General Public License as published
|
||||||
|
@ -260,7 +261,7 @@ class RosterWindow:
|
||||||
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
||||||
nb_events = gajim.events.get_nb_roster_events(account, contact.jid)
|
nb_events = gajim.events.get_nb_roster_events(account, contact.jid)
|
||||||
# count events from all resources
|
# count events from all resources
|
||||||
for contact_ in gajim.contacts.get_contact(account, jid):
|
for contact_ in gajim.contacts.get_contacts(account, jid):
|
||||||
if contact_.resource:
|
if contact_.resource:
|
||||||
nb_events += gajim.events.get_nb_roster_events(account,
|
nb_events += gajim.events.get_nb_roster_events(account,
|
||||||
contact_.get_full_jid())
|
contact_.get_full_jid())
|
||||||
|
@ -337,14 +338,14 @@ class RosterWindow:
|
||||||
if (contact.show in ('offline', 'error') or hide) and \
|
if (contact.show in ('offline', 'error') or hide) and \
|
||||||
not showOffline and (not _('Transports') in contact.groups or \
|
not showOffline and (not _('Transports') in contact.groups or \
|
||||||
gajim.connections[account].connected < 2) and \
|
gajim.connections[account].connected < 2) and \
|
||||||
len(gajim.contacts.get_contact(account, jid)) == 1 and nb_events == 0 and\
|
len(gajim.contacts.get_contacts(account, jid)) == 1 and nb_events == 0 and\
|
||||||
not _('Not in Roster') in contact.groups:
|
not _('Not in Roster') in contact.groups:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Remove brother contacts that are already in roster to add them
|
# Remove brother contacts that are already in roster to add them
|
||||||
# under this iter
|
# under this iter
|
||||||
for data in shown_family:
|
for data in shown_family:
|
||||||
contacts = gajim.contacts.get_contact(data['account'],
|
contacts = gajim.contacts.get_contacts(data['account'],
|
||||||
data['jid'])
|
data['jid'])
|
||||||
for c in contacts:
|
for c in contacts:
|
||||||
self.remove_contact(c, data['account'])
|
self.remove_contact(c, data['account'])
|
||||||
|
@ -390,7 +391,7 @@ class RosterWindow:
|
||||||
self.draw_avatar(jid, account)
|
self.draw_avatar(jid, account)
|
||||||
# put the children under this iter
|
# put the children under this iter
|
||||||
for data in shown_family:
|
for data in shown_family:
|
||||||
contacts = gajim.contacts.get_contact(data['account'],
|
contacts = gajim.contacts.get_contacts(data['account'],
|
||||||
data['jid'])
|
data['jid'])
|
||||||
self.add_contact_to_roster(data['jid'], data['account'])
|
self.add_contact_to_roster(data['jid'], data['account'])
|
||||||
|
|
||||||
|
@ -589,7 +590,7 @@ class RosterWindow:
|
||||||
iters = self.get_contact_iter(jid, account)
|
iters = self.get_contact_iter(jid, account)
|
||||||
if len(iters) == 0:
|
if len(iters) == 0:
|
||||||
return
|
return
|
||||||
contact_instances = gajim.contacts.get_contact(account, jid)
|
contact_instances = gajim.contacts.get_contacts(account, jid)
|
||||||
contact = gajim.contacts.get_highest_prio_contact_from_contacts(
|
contact = gajim.contacts.get_highest_prio_contact_from_contacts(
|
||||||
contact_instances)
|
contact_instances)
|
||||||
if not contact:
|
if not contact:
|
||||||
|
@ -1281,7 +1282,7 @@ class RosterWindow:
|
||||||
|
|
||||||
def chg_contact_status(self, contact, show, status, account):
|
def chg_contact_status(self, contact, show, status, account):
|
||||||
'''When a contact changes his or her status'''
|
'''When a contact changes his or her status'''
|
||||||
contact_instances = gajim.contacts.get_contact(account, contact.jid)
|
contact_instances = gajim.contacts.get_contacts(account, contact.jid)
|
||||||
contact.show = show
|
contact.show = show
|
||||||
contact.status = status
|
contact.status = status
|
||||||
if show in ('offline', 'error') and \
|
if show in ('offline', 'error') and \
|
||||||
|
@ -1399,7 +1400,7 @@ class RosterWindow:
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[iter][C_JID].decode('utf-8')
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
contacts = gajim.contacts.get_contact(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
connected_contacts = []
|
connected_contacts = []
|
||||||
for c in contacts:
|
for c in contacts:
|
||||||
if c.show not in ('offline', 'error'):
|
if c.show not in ('offline', 'error'):
|
||||||
|
@ -1415,7 +1416,7 @@ class RosterWindow:
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[iter][C_JID].decode('utf-8')
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
contact = gajim.contacts.get_contact(account, jid)
|
contact = gajim.contacts.get_contacts(account, jid)
|
||||||
self.tooltip.account = account
|
self.tooltip.account = account
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
self.show_tooltip, contact)
|
self.show_tooltip, contact)
|
||||||
|
@ -1706,7 +1707,7 @@ class RosterWindow:
|
||||||
if row_type in ('contact', 'agent'):
|
if row_type in ('contact', 'agent'):
|
||||||
if old_text == new_text:
|
if old_text == new_text:
|
||||||
return
|
return
|
||||||
for u in gajim.contacts.get_contact(account, jid):
|
for u in gajim.contacts.get_contacts(account, jid):
|
||||||
u.name = new_text
|
u.name = new_text
|
||||||
gajim.connections[account].update_contact(jid, new_text, u.groups)
|
gajim.connections[account].update_contact(jid, new_text, u.groups)
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
@ -1787,7 +1788,7 @@ class RosterWindow:
|
||||||
self.add_contact_to_roster(contact.jid, account)
|
self.add_contact_to_roster(contact.jid, account)
|
||||||
else:
|
else:
|
||||||
gajim.connections[account].unsubscribe(contact.jid)
|
gajim.connections[account].unsubscribe(contact.jid)
|
||||||
for c in gajim.contacts.get_contact(account, contact.jid):
|
for c in gajim.contacts.get_contacts(account, contact.jid):
|
||||||
self.remove_contact(c, account)
|
self.remove_contact(c, account)
|
||||||
gajim.contacts.remove_jid(account, c.jid)
|
gajim.contacts.remove_jid(account, c.jid)
|
||||||
self.readd_if_needed(contact, account)
|
self.readd_if_needed(contact, account)
|
||||||
|
@ -1815,11 +1816,11 @@ class RosterWindow:
|
||||||
if keyID[0] == _('None'):
|
if keyID[0] == _('None'):
|
||||||
if contact.jid in keys:
|
if contact.jid in keys:
|
||||||
del keys[contact.jid]
|
del keys[contact.jid]
|
||||||
for u in gajim.contacts.get_contact(account, contact.jid):
|
for u in gajim.contacts.get_contacts(account, contact.jid):
|
||||||
u.keyID = ''
|
u.keyID = ''
|
||||||
else:
|
else:
|
||||||
keys[contact.jid] = keyID[0]
|
keys[contact.jid] = keyID[0]
|
||||||
for u in gajim.contacts.get_contact(account, contact.jid):
|
for u in gajim.contacts.get_contacts(account, contact.jid):
|
||||||
u.keyID = keyID[0]
|
u.keyID = keyID[0]
|
||||||
if gajim.interface.msg_win_mgr.has_window(contact.jid, account):
|
if gajim.interface.msg_win_mgr.has_window(contact.jid, account):
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_control(contact.jid, account)
|
ctrl = gajim.interface.msg_win_mgr.get_control(contact.jid, account)
|
||||||
|
@ -1920,7 +1921,7 @@ class RosterWindow:
|
||||||
information_menuitem = xml.get_widget('information_menuitem')
|
information_menuitem = xml.get_widget('information_menuitem')
|
||||||
history_menuitem = xml.get_widget('history_menuitem')
|
history_menuitem = xml.get_widget('history_menuitem')
|
||||||
|
|
||||||
contacts = gajim.contacts.get_contact(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
if len(contacts) > 1: # several resources
|
if len(contacts) > 1: # several resources
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
start_chat_menuitem.set_submenu(sub_menu)
|
start_chat_menuitem.set_submenu(sub_menu)
|
||||||
|
@ -2081,7 +2082,7 @@ class RosterWindow:
|
||||||
information_menuitem = xml.get_widget('information_menuitem')
|
information_menuitem = xml.get_widget('information_menuitem')
|
||||||
history_menuitem = xml.get_widget('history_menuitem')
|
history_menuitem = xml.get_widget('history_menuitem')
|
||||||
|
|
||||||
contacts = gajim.contacts.get_contact(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
|
|
||||||
# Invite to
|
# Invite to
|
||||||
invite_to_submenu = gtk.Menu()
|
invite_to_submenu = gtk.Menu()
|
||||||
|
@ -3189,7 +3190,7 @@ class RosterWindow:
|
||||||
remove_auth = False
|
remove_auth = False
|
||||||
for (contact, account) in list_:
|
for (contact, account) in list_:
|
||||||
gajim.connections[account].unsubscribe(contact.jid, remove_auth)
|
gajim.connections[account].unsubscribe(contact.jid, remove_auth)
|
||||||
for c in gajim.contacts.get_contact(account, contact.jid):
|
for c in gajim.contacts.get_contacts(account, contact.jid):
|
||||||
self.remove_contact(c, account)
|
self.remove_contact(c, account)
|
||||||
gajim.contacts.remove_jid(account, contact.jid)
|
gajim.contacts.remove_jid(account, contact.jid)
|
||||||
# redraw group rows for contact numbers
|
# redraw group rows for contact numbers
|
||||||
|
@ -3625,7 +3626,7 @@ class RosterWindow:
|
||||||
if gajim.con_types.has_key(account):
|
if gajim.con_types.has_key(account):
|
||||||
gajim.con_types[account] = None
|
gajim.con_types[account] = None
|
||||||
for jid in gajim.contacts.get_jid_list(account):
|
for jid in gajim.contacts.get_jid_list(account):
|
||||||
lcontact = gajim.contacts.get_contact(account, jid)
|
lcontact = gajim.contacts.get_contacts(account, jid)
|
||||||
lcontact_copy = []
|
lcontact_copy = []
|
||||||
for contact in lcontact:
|
for contact in lcontact:
|
||||||
lcontact_copy.append(contact)
|
lcontact_copy.append(contact)
|
||||||
|
@ -3717,7 +3718,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_contact(account, jid)
|
lcontact = gajim.contacts.get_contacts(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)
|
||||||
|
@ -4121,7 +4122,7 @@ class RosterWindow:
|
||||||
first_ev = gajim.events.get_first_event(account, jid)
|
first_ev = gajim.events.get_first_event(account, jid)
|
||||||
if not first_ev:
|
if not first_ev:
|
||||||
# look in other resources
|
# look in other resources
|
||||||
for c in gajim.contacts.get_contact(account, jid):
|
for c in gajim.contacts.get_contacts(account, jid):
|
||||||
fjid = c.get_full_jid()
|
fjid = c.get_full_jid()
|
||||||
first_ev = gajim.events.get_first_event(account, fjid)
|
first_ev = gajim.events.get_first_event(account, fjid)
|
||||||
if first_ev:
|
if first_ev:
|
||||||
|
@ -4570,13 +4571,13 @@ class RosterWindow:
|
||||||
jid1 = model[iter1][C_JID].decode('utf-8')
|
jid1 = model[iter1][C_JID].decode('utf-8')
|
||||||
jid2 = model[iter2][C_JID].decode('utf-8')
|
jid2 = model[iter2][C_JID].decode('utf-8')
|
||||||
if type1 == 'contact':
|
if type1 == 'contact':
|
||||||
lcontact1 = gajim.contacts.get_contact(account1, jid1)
|
lcontact1 = gajim.contacts.get_contacts(account1, jid1)
|
||||||
contact1 = gajim.contacts.get_first_contact_from_jid(account1, jid1)
|
contact1 = gajim.contacts.get_first_contact_from_jid(account1, jid1)
|
||||||
if not contact1:
|
if not contact1:
|
||||||
return 0
|
return 0
|
||||||
name1 = contact1.get_shown_name()
|
name1 = contact1.get_shown_name()
|
||||||
if type2 == 'contact':
|
if type2 == 'contact':
|
||||||
lcontact2 = gajim.contacts.get_contact(account2, jid2)
|
lcontact2 = gajim.contacts.get_contacts(account2, jid2)
|
||||||
contact2 = gajim.contacts.get_first_contact_from_jid(account2, jid2)
|
contact2 = gajim.contacts.get_first_contact_from_jid(account2, jid2)
|
||||||
if not contact2:
|
if not contact2:
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
|
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
||||||
## Copyright (C) 2006 Stefan Bethge <stefan@lanpartei.de>
|
## Copyright (C) 2006 Stefan Bethge <stefan@lanpartei.de>
|
||||||
|
## Copyright (C) 2007 Lukas Petrovicky <lukas@petrovicky.net>
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published
|
## it under the terms of the GNU General Public License as published
|
||||||
|
@ -334,7 +335,7 @@ class VcardWindow:
|
||||||
def fill_status_label(self):
|
def fill_status_label(self):
|
||||||
if self.xml.get_widget('information_notebook').get_n_pages() < 5:
|
if self.xml.get_widget('information_notebook').get_n_pages() < 5:
|
||||||
return
|
return
|
||||||
contact_list = gajim.contacts.get_contact(self.account, self.contact.jid)
|
contact_list = gajim.contacts.get_contacts(self.account, self.contact.jid)
|
||||||
connected_contact_list = []
|
connected_contact_list = []
|
||||||
for c in contact_list:
|
for c in contact_list:
|
||||||
if c.show not in ('offline', 'error'):
|
if c.show not in ('offline', 'error'):
|
||||||
|
@ -429,7 +430,7 @@ class VcardWindow:
|
||||||
self.os_info = {0: {'resource': self.contact.resource, 'client': '',
|
self.os_info = {0: {'resource': self.contact.resource, 'client': '',
|
||||||
'os': ''}}
|
'os': ''}}
|
||||||
i = 1
|
i = 1
|
||||||
contact_list = gajim.contacts.get_contact(self.account, self.contact.jid)
|
contact_list = gajim.contacts.get_contacts(self.account, self.contact.jid)
|
||||||
if contact_list:
|
if contact_list:
|
||||||
for c in contact_list:
|
for c in contact_list:
|
||||||
if c.resource != self.contact.resource:
|
if c.resource != self.contact.resource:
|
||||||
|
@ -522,7 +523,7 @@ class ZeroconfVcardWindow:
|
||||||
def fill_status_label(self):
|
def fill_status_label(self):
|
||||||
if self.xml.get_widget('information_notebook').get_n_pages() < 2:
|
if self.xml.get_widget('information_notebook').get_n_pages() < 2:
|
||||||
return
|
return
|
||||||
contact_list = gajim.contacts.get_contact(self.account, self.contact.jid)
|
contact_list = gajim.contacts.get_contacts(self.account, self.contact.jid)
|
||||||
# stats holds show and status message
|
# stats holds show and status message
|
||||||
stats = ''
|
stats = ''
|
||||||
one = True # Are we adding the first line ?
|
one = True # Are we adding the first line ?
|
||||||
|
|
Loading…
Add table
Reference in a new issue