handle correctly pm messages.

This commit is contained in:
Yann Leboulanger 2006-09-07 13:19:43 +00:00
parent 30fb604642
commit c2ece68e43
2 changed files with 21 additions and 5 deletions

View File

@ -639,6 +639,12 @@ class ChatControlBase(MessageControl):
self.parent_win.redraw_tab(self) self.parent_win.redraw_tab(self)
self.parent_win.show_title() self.parent_win.show_title()
# redraw roster # redraw roster
if self.type_id == message_control.TYPE_PM:
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
groupchat_control = gajim.interface.msg_win_mgr.get_control(
room_jid, self.account)
groupchat_control.draw_contact(nick)
else:
gajim.interface.roster.draw_contact(jid, self.account) gajim.interface.roster.draw_contact(jid, self.account)
gajim.interface.roster.show_title() gajim.interface.roster.show_title()
self.msg_textview.grab_focus() self.msg_textview.grab_focus()
@ -1631,7 +1637,8 @@ class ChatControl(ChatControlBase):
# list of message ids which should be marked as read # list of message ids which should be marked as read
message_ids = [] message_ids = []
for event in events: for event in events:
if event.type_ != 'chat': print event.type_
if event.type_ != self.type_id:
continue continue
data = event.parameters data = event.parameters
kind = data[2] kind = data[2]
@ -1646,7 +1653,7 @@ class ChatControl(ChatControlBase):
if message_ids: if message_ids:
gajim.logger.set_read_messages(message_ids) gajim.logger.set_read_messages(message_ids)
gajim.events.remove_events(self.account, jid_with_resource, gajim.events.remove_events(self.account, jid_with_resource,
types = ['chat']) types = [self.type_id])
self.parent_win.show_title() self.parent_win.show_title()
self.parent_win.redraw_tab(self) self.parent_win.redraw_tab(self)
@ -1659,6 +1666,12 @@ class ChatControl(ChatControlBase):
control.update_ui() control.update_ui()
typ = 'pm' typ = 'pm'
if is_pm:
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
groupchat_control = gajim.interface.msg_win_mgr.get_control(
room_jid, self.account)
groupchat_control.draw_contact(nick)
else:
gajim.interface.roster.draw_contact(jid, self.account) gajim.interface.roster.draw_contact(jid, self.account)
# Redraw parent too # Redraw parent too
gajim.interface.roster.draw_parent_contact(jid, self.account) gajim.interface.roster.draw_parent_contact(jid, self.account)

View File

@ -2395,7 +2395,10 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
mw.new_tab(chat_control) mw.new_tab(chat_control)
print gajim.events._events
print fjid
if len(gajim.events.get_events(account, fjid)): if len(gajim.events.get_events(account, fjid)):
print 'ici'
# We call this here to avoid race conditions with widget validation # We call this here to avoid race conditions with widget validation
chat_control.read_queue() chat_control.read_queue()