Skip to content

Commit 7303e96

Browse files
committed
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
1 parent 3d0435a commit 7303e96

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/converse-chatview.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -685,23 +685,18 @@
685685

686686
showChatStateNotification (message) {
687687
/* Support for XEP-0085, Chat State Notifications */
688+
if (message.get('sender') === 'me') {
689+
return;
690+
}
688691
let text;
689692
const from = message.get('from');
690693
const data = `data-csn=${from}`;
691694
this.clearChatStateNotification(from);
692695

693696
if (message.get('chat_state') === _converse.COMPOSING) {
694-
if (message.get('sender') === 'me') {
695-
text = __('Typing from another device');
696-
} else {
697-
text = message.get('fullname')+' '+__('is typing');
698-
}
697+
text = message.get('fullname')+' '+__('is typing');
699698
} else if (message.get('chat_state') === _converse.PAUSED) {
700-
if (message.get('sender') === 'me') {
701-
text = __('Stopped typing on the other device');
702-
} else {
703-
text = message.get('fullname')+' '+__('has stopped typing');
704-
}
699+
text = message.get('fullname')+' '+__('has stopped typing');
705700
} else if (message.get('chat_state') === _converse.GONE) {
706701
text = message.get('fullname')+' '+__('has gone away');
707702
} else {

src/converse-muc-views.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,15 @@
754754
// <gone/> is not applicable within MUC context
755755
return;
756756
}
757+
const msgid = _converse.connection.getUniqueId();
757758
_converse.connection.send(
758-
$msg({'to':this.model.get('jid'), 'type': 'groupchat'})
759-
.c(chat_state, {'xmlns': Strophe.NS.CHATSTATES}).up()
760-
.c('no-store', {'xmlns': Strophe.NS.HINTS}).up()
761-
.c('no-permanent-store', {'xmlns': Strophe.NS.HINTS})
759+
$msg({
760+
'to':this.model.get('jid'),
761+
'id': msgid,
762+
'type': 'groupchat'
763+
}).c(chat_state, {'xmlns': Strophe.NS.CHATSTATES}).up()
764+
.c('no-store', {'xmlns': Strophe.NS.HINTS}).up()
765+
.c('no-permanent-store', {'xmlns': Strophe.NS.HINTS})
762766
);
763767
},
764768

@@ -772,10 +776,10 @@
772776
text = u.httpToGeoUri(emojione.shortnameToUnicode(text), _converse)
773777
const msgid = _converse.connection.getUniqueId();
774778
const msg = $msg({
775-
to: this.model.get('jid'),
776-
from: _converse.connection.jid,
777-
type: 'groupchat',
778-
id: msgid
779+
'to': this.model.get('jid'),
780+
'from': _converse.connection.jid,
781+
'type': 'groupchat',
782+
'id': msgid
779783
}).c("body").t(text).up()
780784
.c("x", {xmlns: "jabber:x:event"}).c(_converse.COMPOSING);
781785
_converse.connection.send(msg);

0 commit comments

Comments
 (0)