Tracking trunk changes:
Merged revisions 5008-5011 via svnmerge from svn://svn.gajim.org/gajim/trunk ........ r5008 | asterix | 2006-01-05 12:55:22 -0700 (Thu, 05 Jan 2006) | 2 lines new_chat must be called with a Contact instance instead of GC_Contact ........ r5009 | asterix | 2006-01-05 12:56:35 -0700 (Thu, 05 Jan 2006) | 2 lines use new contacts functions in common/gajim.py ........ r5010 | asterix | 2006-01-05 12:59:06 -0700 (Thu, 05 Jan 2006) | 2 lines get_first_contact_from_jid doesn't return a GC_Contact instance ........ r5011 | asterix | 2006-01-05 12:59:35 -0700 (Thu, 05 Jan 2006) | 2 lines check correctly if a contact leaves the groupchat ........
This commit is contained in:
parent
733549f3b0
commit
c4f4da5aef
|
@ -310,13 +310,17 @@ class ChatControlBase(MessageControl):
|
|||
message_buffer.set_text('') # clear message buffer (and tv of course)
|
||||
# FIXME GC ONLY
|
||||
# if contact is None:
|
||||
# # contact was from pm in MUC, and left the room, or we left the room
|
||||
# # contact was from pm in MUC
|
||||
# room, nick = gajim.get_room_and_nick_from_fjid(jid)
|
||||
# dialogs.ErrorDialog(_('Sending private message failed'),
|
||||
# #in second %s code replaces with nickname
|
||||
# _('You are no longer in room "%s" or "%s" has left.') % \
|
||||
# (room, nick)).get_response()
|
||||
#
|
||||
# gc_contact = gajim.contacts.get_gc_contact(self.account, room, nick)
|
||||
# if not gc_contact:
|
||||
# # contact left the room, or we left the room
|
||||
# dialogs.ErrorDialog(_('Sending private message failed'),
|
||||
# #in second %s code replaces with nickname
|
||||
# _('You are no longer in room "%s" or "%s" has left.') % \
|
||||
# (room, nick)).get_response()
|
||||
# return
|
||||
|
||||
|
||||
def save_sent_message(self, message):
|
||||
#save the message, so user can scroll though the list with key up/down
|
||||
|
|
|
@ -187,11 +187,6 @@ class Contacts:
|
|||
def get_first_contact_from_jid(self, account, jid):
|
||||
if jid in self._contacts[account]:
|
||||
return self._contacts[account][jid][0]
|
||||
else: # it's fake jid
|
||||
room, nick = common.gajim.get_room_and_nick_from_fjid(jid)
|
||||
if self._gc_contacts[account].has_key(room) and \
|
||||
nick in self._gc_contacts[account][room]:
|
||||
return self._gc_contacts[account][room][nick]
|
||||
return None
|
||||
|
||||
def get_parent_contact(self, account, contact):
|
||||
|
|
|
@ -148,18 +148,19 @@ def get_real_jid_from_fjid(account, fjid):
|
|||
gcs = interface.instances[account]['gc']
|
||||
if gcs.has_key(room_jid):
|
||||
# It's a pm, so if we have real jid it's in contact.jid
|
||||
if not gc_contacts[account][room_jid].has_key(nick):
|
||||
gc_contact = contacts.get_gc_contact(account, room_jid, nick)
|
||||
if not gc_contact:
|
||||
return
|
||||
contact = gc_contacts[account][room_jid][nick]
|
||||
# contact.jid is None when it's not a real jid (we don't know real jid)
|
||||
real_jid = contact.jid
|
||||
# gc_contact.jid is None when it's not a real jid (we don't know real jid)
|
||||
real_jid = gc_contact.jid
|
||||
return real_jid
|
||||
|
||||
def get_room_from_fjid(jid):
|
||||
return get_room_and_nick_from_fjid(jid)[0]
|
||||
|
||||
def get_contact_name_from_jid(account, jid):
|
||||
return contacts[account][jid][0].name
|
||||
c = contacts.get_first_contact_from_jid(account, jid)
|
||||
return c.name
|
||||
|
||||
def get_jid_without_resource(jid):
|
||||
return jid.split('/')[0]
|
||||
|
|
|
@ -231,7 +231,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.parent_win.show_title()
|
||||
else:
|
||||
gc_c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
||||
gajim.interface.roster.new_chat(gc_c, self.account)
|
||||
c = gajim.contacts.contact_from_gc_contact(gc_c)
|
||||
gajim.interface.roster.new_chat(c, self.account)
|
||||
# Scroll to line
|
||||
self.list_treeview.expand_row(path[0:1], False)
|
||||
self.list_treeview.scroll_to_cell(path)
|
||||
|
|
|
@ -1519,7 +1519,8 @@ current room topic.') % command, room_jid)
|
|||
self.show_title()
|
||||
else:
|
||||
gc_c = gajim.contacts.get_gc_contact(self.account, room_jid, nick)
|
||||
gajim.interface.roster.new_chat(gc_c, self.account)
|
||||
c = gajim.contacts.contact_from_gc_contact(gc_c)
|
||||
gajim.interface.roster.new_chat(c, self.account)
|
||||
# Scroll to line
|
||||
self.list_treeview[room_jid].expand_row(path[0:1], False)
|
||||
self.list_treeview[room_jid].scroll_to_cell(path)
|
||||
|
@ -1631,7 +1632,8 @@ current room topic.') % command, room_jid)
|
|||
if not gajim.interface.instances[self.account]['chats'].has_key(fjid):
|
||||
gc_c = gajim.contacts.get_gc_contact(self.account, room_jid,
|
||||
nick)
|
||||
gajim.interface.roster.new_chat(gc_c, self.account)
|
||||
c = gajim.contacts.contact_from_gc_contact(gc_c)
|
||||
gajim.interface.roster.new_chat(c, self.account)
|
||||
gajim.interface.instances[self.account]['chats'][fjid].set_active_tab(fjid)
|
||||
gajim.interface.instances[self.account]['chats'][fjid].window.present()
|
||||
return True
|
||||
|
@ -1675,8 +1677,8 @@ current room topic.') % command, room_jid)
|
|||
# FIXME
|
||||
if not gajim.interface.instances[self.account]['chats'].has_key(jid):
|
||||
gc_c = gajim.contacts.get_gc_contact(self.account, room_jid, nick)
|
||||
gajim.interface.roster.new_chat(gc_c, self.account)
|
||||
jid = gc_c.jid
|
||||
c = gajim.contacts.contact_from_gc_contact(gc_c)
|
||||
gajim.interface.roster.new_chat(c, self.account)
|
||||
gajim.interface.instances[self.account]['chats'][jid].set_active_tab(jid)
|
||||
gajim.interface.instances[self.account]['chats'][jid].window.present()
|
||||
|
||||
|
|
|
@ -745,13 +745,16 @@ class TabbedChatWindow(chat.Chat):
|
|||
jid = self.get_active_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
|
||||
# contact was from pm in MUC
|
||||
room, nick = gajim.get_room_and_nick_from_fjid(jid)
|
||||
dialogs.ErrorDialog(_('Sending private message failed'),
|
||||
#in second %s code replaces with nickname
|
||||
_('You are no longer in room "%s" or "%s" has left.') % \
|
||||
(room, nick)).get_response()
|
||||
return
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, room, nick)
|
||||
if not gc_contact:
|
||||
# contact left the room, or we left the room
|
||||
dialogs.ErrorDialog(_('Sending private message failed'),
|
||||
#in second %s code replaces with nickname
|
||||
_('You are no longer in room "%s" or "%s" has left.') % \
|
||||
(room, nick)).get_response()
|
||||
return
|
||||
|
||||
conv_textview = self.conversation_textviews[jid]
|
||||
message_textview = self.message_textviews[jid]
|
||||
|
|
Loading…
Reference in New Issue