Fix automatic start of OTR session.

This commit is contained in:
js 2008-05-19 13:52:45 +00:00
parent 12014b40b6
commit 2586c999fe
2 changed files with 10 additions and 6 deletions

View file

@ -265,14 +265,13 @@ except ImportError:
gajim.otr_module = None gajim.otr_module = None
gajim.otr_windows = None gajim.otr_windows = None
def add_appdata(data=None, context=None): def add_appdata(data, context):
account = data account = data
context.app_data = otr_windows.ContactOtrSMPWindow(unicode(context.username), context.app_data = otr_windows.ContactOtrSMPWindow(
account) unicode(context.username), account)
gajim.otr_add_appdata = add_appdata gajim.otr_add_appdata = add_appdata
def otr_dialog_destroy(widget, *args, **kwargs): def otr_dialog_destroy(widget, *args, **kwargs):
widget.destroy() widget.destroy()

View file

@ -82,9 +82,14 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
log_type = 'chat_msg_recv' log_type = 'chat_msg_recv'
# I don't trust libotr, that's why I only pass the
# message to it if it either contains the magic
# ?OTR string or a plaintext tagged message.
if gajim.otr_module and \ if gajim.otr_module and \
isinstance(msgtxt, unicode) and \ isinstance(msgtxt, unicode) and \
msgtxt.find('?OTR') != -1: (msgtxt.find('?OTR') != -1 or msgtxt.find(
'\x20\x09\x20\x20\x09\x09\x09\x09' \
'\x20\x09\x20\x09\x20\x09\x20\x20') != -1):
# TODO: Do we really need .encode()? # TODO: Do we really need .encode()?
otr_msg_tuple = \ otr_msg_tuple = \
gajim.otr_module.otrl_message_receiving( gajim.otr_module.otrl_message_receiving(