Commit a1374a3a authored by Nikolay Yakimov's avatar Nikolay Yakimov

[gotr] Fix sending OTR adv. tag in handle_outgoing_msg_stanza

Note: Messages with OTR advertisement shouldn't be considered encrypted.
parent ab4eeae9
......@@ -625,18 +625,20 @@ class OtrPlugin(GajimPlugin):
getContext(event.msg_iq.getTo()).\
sendMessage(potr.context.FRAGMENT_SEND_ALL_BUT_LAST, xhtml,
appdata={'thread': thread_id})
if xhtml != encrypted_msg.strip(): #.strip() because sendMessage() adds whitespaces
encrypted = True
event.msg_iq.delChild('html')
event.msg_iq.setBody(encrypted_msg)
if xhtml != encrypted_msg:
if xhtml != encrypted_msg.strip(): #.strip() because sendMessage() adds whitespaces
encrypted = True
event.msg_iq.delChild('html')
event.msg_iq.setBody(encrypted_msg) # whitespace tag only makes sense in plaintext message...
elif body:
body = escape(body).encode('utf8')
encrypted_msg = self.us[event.conn.name].\
getContext(event.msg_iq.getTo()).\
sendMessage(potr.context.FRAGMENT_SEND_ALL_BUT_LAST, body,
appdata={'thread': thread_id})
if body != encrypted_msg.strip():
encrypted = True
if body != encrypted_msg:
if body != encrypted_msg.strip():
encrypted = True
event.msg_iq.setBody(encrypted_msg)
except potr.context.NotEncryptedError, e:
if e.args[0] == potr.context.EXC_FINISHED:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment