Commit 3fbf572a authored by JC Brand's avatar JC Brand

Bugfix. Plaintext msgs sent after OTR termination weren't saved

parent 8e8987a8
...@@ -391,7 +391,7 @@ ...@@ -391,7 +391,7 @@
var $body = $(message).children('body'); var $body = $(message).children('body');
var text = ($body.length > 0 ? converse.autoLink($body.text()) : undefined); var text = ($body.length > 0 ? converse.autoLink($body.text()) : undefined);
if (text) { if (text) {
if (this.otr) { if (_.contains([UNVERIFIED, VERIFIED], this.get('otr_status'))) {
this.otr.receiveMsg(text); this.otr.receiveMsg(text);
} else { } else {
if (text.match(/^\?OTR(.*\?)/)) { if (text.match(/^\?OTR(.*\?)/)) {
...@@ -400,11 +400,10 @@ ...@@ -400,11 +400,10 @@
this.trigger('buddyStartsOTR'); this.trigger('buddyStartsOTR');
} }
} else if (text.match(/^\?OTR\:/)) { } else if (text.match(/^\?OTR\:/)) {
this.trigger( // This is an encrypted message, but we don't
'showHelpMessages', // appear to have an encrypted session. Send to OTR
[__("You were sent an encrypted message, but you don't have encryption set up.")], // anyway, they'll complain.
'error' this.otr.receiveMsg(text);
);
} else { } else {
// Normal unencrypted message. // Normal unencrypted message.
this.createMessage(message); this.createMessage(message);
...@@ -472,7 +471,7 @@ ...@@ -472,7 +471,7 @@
'<li><a class="end-otr" href="#">'+__('End encrypted conversation')+'</a></li>'+ '<li><a class="end-otr" href="#">'+__('End encrypted conversation')+'</a></li>'+
'{[ } ]}' + '{[ } ]}' +
'{[ if (otr_status === "'+UNVERIFIED+'") { ]}' + '{[ if (otr_status === "'+UNVERIFIED+'") { ]}' +
'<li><a class="auth-otr" href="#">'+__('Verify buddy')+'</a></li>'+ '<li><a class="auth-otr" href="#">'+__('Authenticate buddy')+'</a></li>'+
'{[ } ]}' + '{[ } ]}' +
'<li><a href="http://www.cypherpunks.ca/otr/help/3.2.0/levels.php" target="_blank">'+__("What\'s this?")+'</a></li>'+ '<li><a href="http://www.cypherpunks.ca/otr/help/3.2.0/levels.php" target="_blank">'+__("What\'s this?")+'</a></li>'+
'</ul>'+ '</ul>'+
...@@ -676,12 +675,11 @@ ...@@ -676,12 +675,11 @@
} }
} }
} }
if (this.model.otr) { if (_.contains([UNVERIFIED, VERIFIED], this.model.get('otr_status'))) {
// Off-the-record encryption is active // Off-the-record encryption is active
this.model.otr.sendMsg(text); this.model.otr.sendMsg(text);
this.model.trigger('showSentOTRMessage', text); this.model.trigger('showSentOTRMessage', text);
} } else {
else {
// We only save unencrypted messages. // We only save unencrypted messages.
this.model.messages.create({ this.model.messages.create({
fullname: converse.xmppstatus.get('fullname')||converse.bare_jid, fullname: converse.xmppstatus.get('fullname')||converse.bare_jid,
......
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