Commit 7303e96c authored by JC Brand's avatar JC Brand

Don't show `typing from different device` CSN messages

To avoid showing them erroneously would mean keeping track of used
message ids which seems like more work than justified by the feature.

Fixes #1026
parent 3d0435a7
...@@ -685,23 +685,18 @@ ...@@ -685,23 +685,18 @@
showChatStateNotification (message) { showChatStateNotification (message) {
/* Support for XEP-0085, Chat State Notifications */ /* Support for XEP-0085, Chat State Notifications */
if (message.get('sender') === 'me') {
return;
}
let text; let text;
const from = message.get('from'); const from = message.get('from');
const data = `data-csn=${from}`; const data = `data-csn=${from}`;
this.clearChatStateNotification(from); this.clearChatStateNotification(from);
if (message.get('chat_state') === _converse.COMPOSING) { if (message.get('chat_state') === _converse.COMPOSING) {
if (message.get('sender') === 'me') { text = message.get('fullname')+' '+__('is typing');
text = __('Typing from another device');
} else {
text = message.get('fullname')+' '+__('is typing');
}
} else if (message.get('chat_state') === _converse.PAUSED) { } else if (message.get('chat_state') === _converse.PAUSED) {
if (message.get('sender') === 'me') { text = message.get('fullname')+' '+__('has stopped typing');
text = __('Stopped typing on the other device');
} else {
text = message.get('fullname')+' '+__('has stopped typing');
}
} else if (message.get('chat_state') === _converse.GONE) { } else if (message.get('chat_state') === _converse.GONE) {
text = message.get('fullname')+' '+__('has gone away'); text = message.get('fullname')+' '+__('has gone away');
} else { } else {
......
...@@ -754,11 +754,15 @@ ...@@ -754,11 +754,15 @@
// <gone/> is not applicable within MUC context // <gone/> is not applicable within MUC context
return; return;
} }
const msgid = _converse.connection.getUniqueId();
_converse.connection.send( _converse.connection.send(
$msg({'to':this.model.get('jid'), 'type': 'groupchat'}) $msg({
.c(chat_state, {'xmlns': Strophe.NS.CHATSTATES}).up() 'to':this.model.get('jid'),
.c('no-store', {'xmlns': Strophe.NS.HINTS}).up() 'id': msgid,
.c('no-permanent-store', {'xmlns': Strophe.NS.HINTS}) 'type': 'groupchat'
}).c(chat_state, {'xmlns': Strophe.NS.CHATSTATES}).up()
.c('no-store', {'xmlns': Strophe.NS.HINTS}).up()
.c('no-permanent-store', {'xmlns': Strophe.NS.HINTS})
); );
}, },
...@@ -772,10 +776,10 @@ ...@@ -772,10 +776,10 @@
text = u.httpToGeoUri(emojione.shortnameToUnicode(text), _converse) text = u.httpToGeoUri(emojione.shortnameToUnicode(text), _converse)
const msgid = _converse.connection.getUniqueId(); const msgid = _converse.connection.getUniqueId();
const msg = $msg({ const msg = $msg({
to: this.model.get('jid'), 'to': this.model.get('jid'),
from: _converse.connection.jid, 'from': _converse.connection.jid,
type: 'groupchat', 'type': 'groupchat',
id: msgid 'id': msgid
}).c("body").t(text).up() }).c("body").t(text).up()
.c("x", {xmlns: "jabber:x:event"}).c(_converse.COMPOSING); .c("x", {xmlns: "jabber:x:event"}).c(_converse.COMPOSING);
_converse.connection.send(msg); _converse.connection.send(msg);
......
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