Detects focus user in reliable way(through user real JID). Fixes kicked event when both 307 and 110 status codes are received in MUC presence.
This commit is contained in:
parent
871c661ba9
commit
8f94ac8b09
9
app.js
9
app.js
|
@ -710,10 +710,10 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
|
||||||
'connected',
|
'connected',
|
||||||
'connected');
|
'connected');
|
||||||
|
|
||||||
if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
|
if (info.isFocus)
|
||||||
{
|
{
|
||||||
focusJid = jid;
|
focusJid = jid;
|
||||||
console.info("Ignore focus " + jid);
|
console.info("Ignore focus: " + jid +", real JID: " + info.jid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,10 +828,9 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
|
||||||
|
|
||||||
if (displayName && displayName.length > 0)
|
if (displayName && displayName.length > 0)
|
||||||
$(document).trigger('displaynamechanged',
|
$(document).trigger('displaynamechanged',
|
||||||
[jid, displayName]);
|
[jid, info.displayName]);
|
||||||
if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
|
if (info.isFocus)
|
||||||
{
|
{
|
||||||
console.info("Ignore focus");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ var config = {
|
||||||
useNicks: false,
|
useNicks: false,
|
||||||
bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
|
bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
|
||||||
clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
|
clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
|
||||||
|
focusUserJid: 'focus@auth.pawel.jitsi.net', // The real JID of focus participant
|
||||||
//defaultSipNumber: '', // Default SIP number
|
//defaultSipNumber: '', // Default SIP number
|
||||||
desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
|
desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
|
||||||
chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension
|
chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension
|
||||||
|
|
16
muc.js
16
muc.js
|
@ -123,6 +123,13 @@ Strophe.addConnectionPlugin('emuc', {
|
||||||
member.affiliation = tmp.attr('affiliation');
|
member.affiliation = tmp.attr('affiliation');
|
||||||
member.role = tmp.attr('role');
|
member.role = tmp.attr('role');
|
||||||
|
|
||||||
|
// Focus recognition
|
||||||
|
member.jid = tmp.attr('jid');
|
||||||
|
member.isFocus = false;
|
||||||
|
if (member.jid && member.jid.indexOf(config.focusUserJid + "/") == 0) {
|
||||||
|
member.isFocus = true;
|
||||||
|
}
|
||||||
|
|
||||||
var nicktag = $(pres).find('>nick[xmlns="http://jabber.org/protocol/nick"]');
|
var nicktag = $(pres).find('>nick[xmlns="http://jabber.org/protocol/nick"]');
|
||||||
member.displayName = (nicktag.length > 0 ? nicktag.text() : null);
|
member.displayName = (nicktag.length > 0 ? nicktag.text() : null);
|
||||||
|
|
||||||
|
@ -167,11 +174,7 @@ Strophe.addConnectionPlugin('emuc', {
|
||||||
if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
|
if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
|
||||||
delete this.members[from];
|
delete this.members[from];
|
||||||
this.list_members.splice(this.list_members.indexOf(from), 1);
|
this.list_members.splice(this.list_members.indexOf(from), 1);
|
||||||
if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
|
$(document).trigger('left.muc', [from]);
|
||||||
$(document).trigger('kicked.muc', [from]);
|
|
||||||
} else {
|
|
||||||
$(document).trigger('left.muc', [from]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If the status code is 110 this means we're leaving and we would like
|
// If the status code is 110 this means we're leaving and we would like
|
||||||
// to remove everyone else from our view, so we trigger the event.
|
// to remove everyone else from our view, so we trigger the event.
|
||||||
|
@ -183,6 +186,9 @@ Strophe.addConnectionPlugin('emuc', {
|
||||||
$(document).trigger('left.muc', member);
|
$(document).trigger('left.muc', member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
|
||||||
|
$(document).trigger('kicked.muc', [from]);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onPresenceError: function (pres) {
|
onPresenceError: function (pres) {
|
||||||
|
|
Loading…
Reference in New Issue