diff --git a/src/common/events.py b/src/common/events.py index 9c2d78282..b2df06b88 100644 --- a/src/common/events.py +++ b/src/common/events.py @@ -36,7 +36,7 @@ class Event: file-request-error, file-send-error, file-stopped, gc_msg, pm, printed_chat, printed_gc_msg, printed_marked_gc_msg, printed_pm parameters is (per type_): - chat, normal: [message, subject, kind, time, encrypted, resource, + chat, normal, pm: [message, subject, kind, time, encrypted, resource, msg_id] where kind in error, incoming file-*: file_props diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 5f2d6c6e6..8bf00adc8 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -645,18 +645,14 @@ class GroupchatControl(ChatControlBase): else: self.print_conversation(msg, nick, tim, xhtml) - def on_private_message(self, nick, msg, tim, xhtml, session, msg_id = None): + def on_private_message(self, nick, msg, tim, xhtml, session, + msg_id = None, encrypted = False): # Do we have a queue? fjid = self.room_jid + '/' + nick no_queue = len(gajim.events.get_events(self.account, fjid)) == 0 - # We print if window is opened - if session.control: - session.control.print_conversation(msg, tim = tim, xhtml = xhtml) - return - event = gajim.events.create_event('pm', (msg, '', 'incoming', tim, - False, '', msg_id, xhtml, session)) + encrypted, '', msg_id, xhtml, session)) gajim.events.add_event(self.account, fjid, event) autopopup = gajim.config.get('autopopup') diff --git a/src/session.py b/src/session.py index 481350c99..1de42bd97 100644 --- a/src/session.py +++ b/src/session.py @@ -188,8 +188,14 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): if pm: nickname = resource - groupchat_control.on_private_message(nickname, msgtxt, tim, - xhtml, self, msg_id) + if self.control: + # print if a control is open + self.control.print_conversation(msgtxt, + tim = tim, xhtml = xhtml, encrypted = encrypted) + else: + # otherwise pass it off to the control to be queued + groupchat_control.on_private_message(nickname, msgtxt, tim, + xhtml, self, msg_id=msg_id, encrypted=encrypted) else: self.roster_message(jid, msgtxt, tim, encrypted, msg_type, subject, resource, msg_id, user_nick, advanced_notif_num,