Commit 968f8bb2 authored by JC Brand's avatar JC Brand

Add new configuration setting "forward_messages".

What was before default behavior is now optional and disabled by default.
parent 14d90bc9
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
this.debug = false; this.debug = false;
this.default_box_height = 324; // The default height, in pixels, for the control box, chat boxes and chatrooms. this.default_box_height = 324; // The default height, in pixels, for the control box, chat boxes and chatrooms.
this.expose_rid_and_sid = false; this.expose_rid_and_sid = false;
this.forward_messages = false;
this.hide_muc_server = false; this.hide_muc_server = false;
this.i18n = locales.en; this.i18n = locales.en;
this.prebind = false; this.prebind = false;
...@@ -184,6 +185,7 @@ ...@@ -184,6 +185,7 @@
'debug', 'debug',
'default_box_height', 'default_box_height',
'expose_rid_and_sid', 'expose_rid_and_sid',
'forward_messages',
'fullname', 'fullname',
'hide_muc_server', 'hide_muc_server',
'i18n', 'i18n',
...@@ -1039,15 +1041,15 @@ ...@@ -1039,15 +1041,15 @@
var message = $msg({from: converse.connection.jid, to: bare_jid, type: 'chat', id: timestamp}) var message = $msg({from: converse.connection.jid, to: bare_jid, type: 'chat', id: timestamp})
.c('body').t(text).up() .c('body').t(text).up()
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}); .c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'});
// Forward the message, so that other connected resources are also aware of it.
// TODO: Forward the message only to other connected resources (inside the browser)
var forwarded = $msg({to:converse.bare_jid, type:'chat', id:timestamp})
.c('forwarded', {xmlns:'urn:xmpp:forward:0'})
.c('delay', {xmns:'urn:xmpp:delay',stamp:timestamp}).up()
.cnode(message.tree());
converse.connection.send(message); converse.connection.send(message);
converse.connection.send(forwarded); if (converse.forward_messages) {
// Forward the message, so that other connected resources are also aware of it.
var forwarded = $msg({to:converse.bare_jid, type:'chat', id:timestamp})
.c('forwarded', {xmlns:'urn:xmpp:forward:0'})
.c('delay', {xmns:'urn:xmpp:delay',stamp:timestamp}).up()
.cnode(message.tree());
converse.connection.send(forwarded);
}
}, },
sendMessage: function (text) { sendMessage: function (text) {
...@@ -2991,6 +2993,7 @@ ...@@ -2991,6 +2993,7 @@
removeRosterItemView: function (item) { removeRosterItemView: function (item) {
if (this.get(item.id)) { if (this.get(item.id)) {
this.get(item.id).remove(); this.get(item.id).remove();
this.render();
} }
return this; return this;
}, },
......
...@@ -6,13 +6,15 @@ Changelog ...@@ -6,13 +6,15 @@ Changelog
* Chat boxes and rooms can now be resized vertically. [jcbrand] * Chat boxes and rooms can now be resized vertically. [jcbrand]
* Chat boxes and rooms can be minimized. [jcbrand] * Chat boxes and rooms can be minimized. [jcbrand]
* Upgraded many dependencies to their latest versions. [jcrand] * Upgraded many dependencies to their latest versions. [jcbrand]
* Add new configuration setting `forward_messages <https://conversejs.org/docs/html/index.html#forward_messages>`_
Message forwarding was before default behavior but is now optional (and disabled by default). [jcbrand]
0.7.4 (2014-03-05) 0.7.4 (2014-03-05)
------------------ ------------------
.. note:: This release contains an important security fix. .. note:: This release contains an important security fix.
Thanks to Renaud Dubourguais from `Synacktiv http://synacktiv.com`_ for reporting the vulnerability. Thanks to Renaud Dubourguais from `Synacktiv <http://synacktiv.com>`_ for reporting the vulnerability.
* #125 Bugfix: crypto dependencies loaded in wrong order [jcbrand] * #125 Bugfix: crypto dependencies loaded in wrong order [jcbrand]
* Bugfix: action messages (i.e. /me) didn't work in OTR mode. [jcbrand] * Bugfix: action messages (i.e. /me) didn't work in OTR mode. [jcbrand]
...@@ -132,7 +134,7 @@ versions of the 0.6 branch. ...@@ -132,7 +134,7 @@ versions of the 0.6 branch.
* Bugfix. The remove icon wasn't appearing in the contacts roster. [jcbrand] * Bugfix. The remove icon wasn't appearing in the contacts roster. [jcbrand]
* Bugfix. With auto_subscribe=True, the "Pending Contacts" header didn't disappear * Bugfix. With auto_subscribe=True, the "Pending Contacts" header didn't disappear
after a new user was accepted. [jcbrand] after a new user was accepted. [jcbrand]
0.6.1 (2013-08-28) 0.6.1 (2013-08-28)
------------------ ------------------
......
...@@ -971,6 +971,8 @@ If set to true, debugging output will be logged to the browser console. ...@@ -971,6 +971,8 @@ If set to true, debugging output will be logged to the browser console.
expose_rid_and_sid expose_rid_and_sid
------------------ ------------------
Default = ``false``
Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
globally via the API. This allows other scripts served on the same page to use globally via the API. This allows other scripts served on the same page to use
these values. these values.
...@@ -978,6 +980,19 @@ these values. ...@@ -978,6 +980,19 @@ these values.
*Beware*: a malicious script could use these tokens to assume your identity *Beware*: a malicious script could use these tokens to assume your identity
and inject fake chat messages. and inject fake chat messages.
forward_messages
----------------
Default = ``false``
If set to ``true``, sent messages will also be forwarded to other connected
XMPP resources (e.g. chat clients) of the same user.
This is useful for example if converse.js is running in multiple tabs of the
browser and you want sent messages to appear in all of them.
See also `XEP 0297: Stanza Forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
fullname fullname
-------- --------
......
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