Commit 36491699 authored by JC Brand's avatar JC Brand

If another resource changes it's status, change this one as well.

This is necessary because each open tab in the browser is its own resource.

TODO: Ideally we should differentiate between resources in the browser (using
converse.js) and other resources (i.e from a desktop client).
parent e213d755
...@@ -1329,18 +1329,24 @@ ...@@ -1329,18 +1329,24 @@
status_message = $(presence).find('status'), status_message = $(presence).find('status'),
item, model; item, model;
if ((($(presence).find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) || (this.isSelf(bare_jid))) { if (this.isSelf(bare_jid)) {
// Ignore MUC or self-addressed stanzas if (xmppchat.connection.jid != jid) {
// Another resource has changed it's status, we'll update ours as well.
// FIXME: We should ideally differentiate between converse.js using
// resources and other resources (i.e Pidgin etc.)
xmppchat.xmppstatus.set({'status': presence_type});
}
return true; return true;
} else if (($(presence).find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) {
return true; // Ignore MUC
} }
if ((status_message.length > 0) && (status_message.text() && (presence_type !== 'unavailable'))) { if ((status_message.length > 0) && (status_message.text() && (presence_type !== 'unavailable'))) {
model = this.getItem(bare_jid); model = this.getItem(bare_jid);
model.set({'status': status_message.text()}); model.set({'status': status_message.text()});
} }
if ((presence_type === 'error') || if ((presence_type === 'error') || (presence_type === 'subscribed') || (presence_type === 'unsubscribe')) {
(presence_type === 'subscribed') ||
(presence_type === 'unsubscribe')) {
return true; return true;
} else if (presence_type === 'subscribe') { } else if (presence_type === 'subscribe') {
......
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