pass the ChatControl around with printed_chat events
This commit is contained in:
parent
964cb10163
commit
2b074aed41
|
@ -710,7 +710,7 @@ class ChatControlBase(MessageControl):
|
||||||
show_in_systray = notify.get_show_in_systray(event,
|
show_in_systray = notify.get_show_in_systray(event,
|
||||||
self.account, self.contact, type_)
|
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_roster = show_in_roster,
|
||||||
show_in_systray = show_in_systray)
|
show_in_systray = show_in_systray)
|
||||||
gajim.events.add_event(self.account, full_jid, event)
|
gajim.events.add_event(self.account, full_jid, event)
|
||||||
|
|
|
@ -41,6 +41,7 @@ class Event:
|
||||||
where kind in error, incoming
|
where kind in error, incoming
|
||||||
file-*: file_props
|
file-*: file_props
|
||||||
gc_msg: None
|
gc_msg: None
|
||||||
|
printed_chat: control
|
||||||
printed_*: None
|
printed_*: None
|
||||||
messages that are already printed in chat, but not read'''
|
messages that are already printed in chat, but not read'''
|
||||||
self.type_ = type_
|
self.type_ = type_
|
||||||
|
|
|
@ -58,7 +58,7 @@ class StanzaSession(object):
|
||||||
for event in gajim.events.get_events(self.conn.name, self.jid, types=types):
|
for event in gajim.events.get_events(self.conn.name, self.jid, types=types):
|
||||||
# the event wasn't in this session
|
# the event wasn't in this session
|
||||||
if (event.type_ == 'chat' and event.parameters[8] != self) or \
|
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
|
continue
|
||||||
|
|
||||||
# events.remove_events returns True when there were no events
|
# events.remove_events returns True when there were no events
|
||||||
|
|
11
src/gajim.py
11
src/gajim.py
|
@ -2260,20 +2260,17 @@ class Interface:
|
||||||
if not event:
|
if not event:
|
||||||
event = gajim.events.get_first_event(account, jid, type_)
|
event = gajim.events.get_first_event(account, jid, type_)
|
||||||
|
|
||||||
session = None
|
|
||||||
|
|
||||||
if type_ == 'printed_chat':
|
if type_ == 'printed_chat':
|
||||||
session = event.parameters[0]
|
ctrl = event.parameters[0]
|
||||||
elif type_ == 'chat':
|
elif type_ == 'chat':
|
||||||
session = event.parameters[8]
|
session = event.parameters[8]
|
||||||
|
|
||||||
if session and session.control:
|
|
||||||
ctrl = 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
|
# assume that the most recently updated control we have for this party
|
||||||
# is the one that this event was in
|
# is the one that this event was in
|
||||||
ctrl = self.msg_win_mgr.get_chat_controls(fjid, account)[0]
|
ctrl = self.msg_win_mgr.get_chat_controls(fjid, account)[0]
|
||||||
else:
|
elif not ctrl:
|
||||||
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
||||||
account, jid)
|
account, jid)
|
||||||
# jid can have a window if this resource was lower when he sent
|
# jid can have a window if this resource was lower when he sent
|
||||||
|
|
Loading…
Reference in New Issue