Author: bct Date: 2008-06-14 18:49:48 +0200 (Sat, 14 Jun 2008) New Revision: 9802
Modified: trunk/src/chat_control.py trunk/src/common/events.py trunk/src/common/stanza_session.py trunk/src/gajim.py Log: pass the ChatControl around with printed_chat events
Modified: trunk/src/chat_control.py =================================================================== --- trunk/src/chat_control.py 2008-06-14 08:43:20 UTC (rev 9801) +++ trunk/src/chat_control.py 2008-06-14 16:49:48 UTC (rev 9802) @@ -710,7 +710,7 @@ show_in_systray = notify.get_show_in_systray(event, self.account, self.contact, type_)
- event = gajim.events.create_event(type_, (self.session,), + event = gajim.events.create_event(type_, (self,), show_in_roster = show_in_roster, show_in_systray = show_in_systray) gajim.events.add_event(self.account, full_jid, event)
Modified: trunk/src/common/events.py =================================================================== --- trunk/src/common/events.py 2008-06-14 08:43:20 UTC (rev 9801) +++ trunk/src/common/events.py 2008-06-14 16:49:48 UTC (rev 9802) @@ -41,6 +41,7 @@ where kind in error, incoming file-*: file_props gc_msg: None + printed_chat: control printed_*: None messages that are already printed in chat, but not read''' self.type_ = type_
Modified: trunk/src/common/stanza_session.py =================================================================== --- trunk/src/common/stanza_session.py 2008-06-14 08:43:20 UTC (rev 9801) +++ trunk/src/common/stanza_session.py 2008-06-14 16:49:48 UTC (rev 9802) @@ -58,7 +58,7 @@ for event in gajim.events.get_events(self.conn.name, self.jid, types=types): # the event wasn't in this session if (event.type_ == 'chat' and event.parameters[8] != self) or \ - (event.type_ == 'printed_chat' and event.parameters[0] != self): + (event.type_ == 'printed_chat' and event.parameters[0].session != self): continue
# events.remove_events returns True when there were no events
Modified: trunk/src/gajim.py =================================================================== --- trunk/src/gajim.py 2008-06-14 08:43:20 UTC (rev 9801) +++ trunk/src/gajim.py 2008-06-14 16:49:48 UTC (rev 9802) @@ -2260,20 +2260,17 @@ if not event: event = gajim.events.get_first_event(account, jid, type_)
- session = None - if type_ == 'printed_chat': - session = event.parameters[0] + ctrl = event.parameters[0] elif type_ == 'chat': session = event.parameters[8] - - if session and session.control: ctrl = session.control - elif type_ == '' and self.msg_win_mgr.has_window(fjid, account): + + if type_ == '' and self.msg_win_mgr.has_window(fjid, account): # assume that the most recently updated control we have for this party # is the one that this event was in ctrl = self.msg_win_mgr.get_chat_controls(fjid, account)[0] - else: + elif not ctrl: highest_contact = gajim.contacts.get_contact_with_highest_priority( account, jid) # jid can have a window if this resource was lower when he sent