* Close our session when the remote end does.
* Don't set encrypted = True if it was only a tagged plaintext msg.
This commit is contained in:
parent
2586c999fe
commit
0deebd859d
1 changed files with 22 additions and 6 deletions
|
@ -90,6 +90,12 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
||||||
(msgtxt.find('?OTR') != -1 or msgtxt.find(
|
(msgtxt.find('?OTR') != -1 or msgtxt.find(
|
||||||
'\x20\x09\x20\x20\x09\x09\x09\x09' \
|
'\x20\x09\x20\x20\x09\x09\x09\x09' \
|
||||||
'\x20\x09\x20\x09\x20\x09\x20\x20') != -1):
|
'\x20\x09\x20\x09\x20\x09\x20\x20') != -1):
|
||||||
|
# If it doesn't include ?OTR, it wasn't an
|
||||||
|
# encrypted message, but a tagged plaintext
|
||||||
|
# message.
|
||||||
|
if msgtxt.find('?OTR') != -1:
|
||||||
|
encrypted = True
|
||||||
|
|
||||||
# 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(
|
||||||
|
@ -108,14 +114,26 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
||||||
if gajim.otr_module.otrl_tlv_find(
|
if gajim.otr_module.otrl_tlv_find(
|
||||||
otr_msg_tuple[2],
|
otr_msg_tuple[2],
|
||||||
gajim.otr_module.OTRL_TLV_DISCONNECTED) != None:
|
gajim.otr_module.OTRL_TLV_DISCONNECTED) != None:
|
||||||
gajim.otr_ui_ops.gajim_log(_("%s " \
|
gajim.otr_ui_ops.gajim_log(_('%s ' \
|
||||||
"has ended his/her private " \
|
'has ended his/her private ' \
|
||||||
"conversation with you; " \
|
'conversation with you.') % \
|
||||||
"should do the same.") % \
|
|
||||||
full_jid_with_resource,
|
full_jid_with_resource,
|
||||||
self.conn.name,
|
self.conn.name,
|
||||||
full_jid_with_resource.encode())
|
full_jid_with_resource.encode())
|
||||||
|
|
||||||
|
# The other end closed the connection,
|
||||||
|
# so we do the same.
|
||||||
|
gajim.otr_module. \
|
||||||
|
otrl_message_disconnect(
|
||||||
|
self.conn.otr_userstates,
|
||||||
|
(gajim.otr_ui_ops,
|
||||||
|
{'account': self.conn.name,
|
||||||
|
'urgent': True}),
|
||||||
|
gajim.get_jid_from_account(
|
||||||
|
self.conn.name).encode(),
|
||||||
|
gajim.OTR_PROTO,
|
||||||
|
full_jid_with_resource.encode())
|
||||||
|
|
||||||
if self.control:
|
if self.control:
|
||||||
self.control.update_ui()
|
self.control.update_ui()
|
||||||
|
|
||||||
|
@ -131,8 +149,6 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
||||||
tlvs = otr_msg_tuple[2]
|
tlvs = otr_msg_tuple[2]
|
||||||
ctx.app_data.handle_tlv(tlvs)
|
ctx.app_data.handle_tlv(tlvs)
|
||||||
|
|
||||||
encrypted = True
|
|
||||||
|
|
||||||
if msgtxt == '':
|
if msgtxt == '':
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue