Don't carbon copy OTR messages.

This commit is contained in:
JC Brand 2015-07-03 11:37:21 +02:00
parent 0fdf28625b
commit 0afa7ec188
3 changed files with 30 additions and 7 deletions

View File

@ -1382,7 +1382,13 @@
var bare_jid = this.model.get('jid');
var message = $msg({from: converse.connection.jid, to: bare_jid, type: 'chat', id: timestamp})
.c('body').t(text).up()
.c(ACTIVE, {'xmlns': Strophe.NS.CHATSTATES});
.c(ACTIVE, {'xmlns': Strophe.NS.CHATSTATES}).up();
if (this.model.get('otr_status') != UNENCRYPTED) {
// OTR messages aren't carbon copied
message.c('private', {'xmlns': 'urn:xmpp:carbons:2'});
}
converse.connection.send(message);
if (converse.forward_messages) {
// Forward the message, so that other connected resources are also aware of it.

View File

@ -20,20 +20,20 @@ Changelog
* #418 Logging out with `auto_reconnect=true` causes reconnection retries [jcbrand]
* #420 Updated German translation [1st8]
* #427 Converse.js does not subscribe back to a contact not in the roster. [emmanuel-florent]
* Bugfix. Manual login doesn't work when only websocket_url is set and not bosh_service_url. [jcbrand]
* Add offline pretty status to enable translation [thierrytiti]
* Bugfix. ClearSessions during unload event would throw an error when not logged in. [gbonvehi]
* Bugfix. Manual login doesn't work when only websocket_url is set and not bosh_service_url. [jcbrand]
* Bugfix. Wrong callback argument mapping in XmppStatus initialize: fullname is null [thierrytiti]
* CSS fix: room-info bug on hover after room description loaded [thierrytiti]
* CSS: Fonts Path: editabable $font-path via sass/variables.scss [thierrytiti]
* Chat boxes returned by the API now have an `is_chatroom` attribute [jcbrand]
* Decouple automatic away and XEP-0352 support. [jcbrand]
* Don't carbon copy OTR messages. [jcbrand]
* I18N: Autodetection of User Locale if no i18n setting is set. [thierrytiti]
* Refactored in order to remove the strophe.roster.js dependency. [jcbrand]
* Refactored the plugin architecture. Add `overrides` convention for
automatically overriding converse.js's methods and Backbone views and models. [jcbrand]
* Decouple automatic away and XEP-0352 support. [jcbrand]
* CSS: Fonts Path: editabable $font-path via sass/variables.scss [thierrytiti]
* Add offline pretty status to enable translation [thierrytiti]
* With keepalive, don't send out a presence stanza on each page load [jcbrand]
* Chat boxes returned by the API now have an `is_chatroom` attribute [jcbrand]
* Cleanup references to strophe.roster.js [thierrytiti]
0.9.3 (2015-05-01)
------------------

View File

@ -731,6 +731,23 @@
}, converse));
describe("An OTR Chat Message", function () {
it("will not be carbon copied when it's sent out", function () {
var msgtext = "?OTR,1,3,?OTR:AAIDAAAAAAEAAAABAAAAwCQ8HKsag0y0DGKsneo0kzKu1ua5L93M4UKTkCf1I2kbm2RgS5kIxDTxrTj3wVRB+H5Si86E1fKtuBgsDf/bKkGTM0h/49vh5lOD9HkE8cnSrFEn5GN,";
var sender_jid = mock.cur_names[3].replace(/ /g,'.').toLowerCase() + '@localhost';
converse_api.chats.open(sender_jid);
var chatbox = converse.chatboxes.get(sender_jid);
spyOn(converse.connection, 'send');
chatbox.set('otr_status', 1); // Set OTR status to UNVERIFIED, to mock an encrypted session
chatbox.trigger('sendMessageStanza', msgtext);
var $sent = $(converse.connection.send.argsForCall[0][0].tree());
expect($sent.find('body').siblings('private').length).toBe(1);
expect($sent.find('private').length).toBe(1);
expect($sent.find('private').attr('xmlns')).toBe('urn:xmpp:carbons:2');
});
});
describe("A Chat Status Notification", $.proxy(function () {
it("does not open automatically if a chat state notification is received", $.proxy(function () {