Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2005-12-30 12:58:34 +0300
committerYann Leboulanger <asterix@lagaule.org>2005-12-30 12:58:34 +0300
commitd571d9ce8bc04ff6228deb5186749557463baa65 (patch)
treea2e144e9137eee3789be99c903f397bb3e419333
parent349c69d5b364bb9ee3853a729618eb5d5f923da0 (diff)
use new contacts functions everywhere
-rw-r--r--src/chat.py2
-rw-r--r--src/common/gajim.py13
-rw-r--r--src/tabbed_chat_window.py17
3 files changed, 9 insertions, 23 deletions
diff --git a/src/chat.py b/src/chat.py
index 6e8d8df01..5038bc095 100644
--- a/src/chat.py
+++ b/src/chat.py
@@ -190,7 +190,7 @@ class Chat:
add = _('Group Chat')
elif len(self.xmls) == 1: # just one tab
if self.widget_name == 'tabbed_chat_window':
- c = gajim.get_first_contact_instance_from_jid(self.account, jid)
+ c = gajim.contacts.get_first_contact_from_jid(self.account, jid)
if c is None:
add = ''
else:
diff --git a/src/common/gajim.py b/src/common/gajim.py
index 2a8e5454c..653eb8307 100644
--- a/src/common/gajim.py
+++ b/src/common/gajim.py
@@ -158,19 +158,6 @@ def get_real_jid_from_fjid(account, fjid):
def get_room_from_fjid(jid):
return get_room_and_nick_from_fjid(jid)[0]
-def get_first_contact_instance_from_jid(account, jid):
- contact = None
- if jid in contacts[account]:
- contact = contacts[account][jid][0]
- else: # it's fake jid
- #FIXME: problem see comment in next line
- room, nick = \
- get_room_and_nick_from_fjid(jid) # if we ban/kick we now real jid
- if gc_contacts[account].has_key(room) and \
- nick in gc_contacts[account][room]:
- contact = gc_contacts[account][room][nick]
- return contact
-
def get_contact_name_from_jid(account, jid):
return contacts[account][jid][0].name
diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py
index e3b6ef999..08b824a5b 100644
--- a/src/tabbed_chat_window.py
+++ b/src/tabbed_chat_window.py
@@ -338,9 +338,8 @@ class TabbedChatWindow(chat.Chat):
def set_state_image(self, jid):
prio = 0
- if gajim.contacts[self.account].has_key(jid):
- contacts_list = gajim.contacts[self.account][jid]
- else:
+ contact_list = gajim.contacts.get_contact(self.account, jid)
+ if contact_list:
contacts_list = [self.contacts[jid]]
contact = contacts_list[0]
@@ -436,7 +435,7 @@ class TabbedChatWindow(chat.Chat):
def on_send_file_menuitem_activate(self, widget):
jid = self.get_active_jid()
- contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
+ contact = gajim.contacts.get_first_contact_from_jid(self.account, jid)
gajim.interface.instances['file_transfers'].show_file_send_request(
self.account, contact)
@@ -532,7 +531,7 @@ class TabbedChatWindow(chat.Chat):
in the last 5 seconds?
if yes we go active for mouse, composing for kbd
if no we go paused if we were previously composing '''
- contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
+ contact = gajim.contacts.get_first_contact_from_jid(self.account, jid)
if jid not in self.xmls or contact is None:
# the tab with jid is no longer open or contact left
# stop timer
@@ -564,7 +563,7 @@ class TabbedChatWindow(chat.Chat):
in the last 30 seconds?
if yes we go active
if no we go inactive '''
- contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
+ contact = gajim.contacts.get_first_contact_from_jid(self.account, jid)
if jid not in self.xmls or contact is None:
# the tab with jid is no longer open or contact left
return False # stop looping
@@ -691,7 +690,7 @@ class TabbedChatWindow(chat.Chat):
if jid is None:
jid = self.get_active_jid()
- contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
+ contact = gajim.contacts.get_first_contact_from_jid(self.account, jid)
if contact is None:
# contact was from pm in MUC, and left the room so contact is None
@@ -748,7 +747,7 @@ class TabbedChatWindow(chat.Chat):
return
jid = self.get_active_jid()
- contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
+ contact = gajim.contacts.get_first_contact_from_jid(self.account, jid)
if contact is None:
# contact was from pm in MUC, and left the room, or we left the room
room, nick = gajim.get_room_and_nick_from_fjid(jid)
@@ -877,7 +876,7 @@ class TabbedChatWindow(chat.Chat):
if (contact.show == 'offline' or contact.show == 'error'):
showOffline = gajim.config.get('showoffline')
if not showOffline and typ == 'chat' and \
- len(gajim.contacts[self.account][jid]) == 1:
+ len(gajim.contacts.get_contact(self.account, jid)) == 1:
gajim.interface.roster.really_remove_contact(contact, self.account)
elif typ == 'pm':
gcs[room_jid].remove_contact(room_jid, nick)