fix encrypted/unencrypted notifications in PM

This commit is contained in:
Brendan Taylor 2008-07-14 23:46:22 +00:00
parent d541b42236
commit 15567aa113
3 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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')

View File

@ -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,