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_windows = None
def add_appdata(data=None, context=None):
def add_appdata(data, context):
account = data
context.app_data = otr_windows.ContactOtrSMPWindow(unicode(context.username),
account)
context.app_data = otr_windows.ContactOtrSMPWindow(
unicode(context.username), account)
gajim.otr_add_appdata = add_appdata
def otr_dialog_destroy(widget, *args, **kwargs):
widget.destroy()
@ -458,7 +457,7 @@ class OtrlMessageAppOps:
def max_message_size(self, **kwargs):
return 0
def account_name(self, opdata=None, account='',protocol=''):
def account_name(self, opdata=None, account='', protocol=''):
return gajim.get_name_from_jid(opdata['account'],
unicode(account))

View File

@ -82,9 +82,14 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
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 \
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()?
otr_msg_tuple = \
gajim.otr_module.otrl_message_receiving(