Adopts kick to new focus.

This commit is contained in:
paweldomas 2014-11-28 16:18:58 +01:00
parent 285096cc99
commit cd6264d0df
3 changed files with 19 additions and 13 deletions

21
app.js
View File

@ -603,16 +603,6 @@ $(document).bind('conferenceCreated.jingle', function (event, focus)
} }
}); });
$(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
// Leave the room if my call has been remotely terminated.
if (connection.emuc.joined && reason === 'kick') {
sessionTerminated = true;
connection.emuc.doLeave();
messageHandler.openMessageDialog("Session Terminated",
"Ouch! You have been kicked out of the meet!");
}
});
$(document).bind('setLocalDescription.jingle', function (event, sid) { $(document).bind('setLocalDescription.jingle', function (event, sid) {
// put our ssrcs into presence so other clients can identify our stream // put our ssrcs into presence so other clients can identify our stream
var sess = connection.jingle.sessions[sid]; var sess = connection.jingle.sessions[sid];
@ -852,6 +842,17 @@ $(document).bind('presence.status.muc', function (event, jid, info, pres) {
}); });
$(document).bind('kicked.muc', function (event, jid) {
console.info(jid + " has been kicked from MUC!");
if (connection.emuc.myroomjid === jid) {
sessionTerminated = true;
disposeConference(false);
connection.emuc.doLeave();
messageHandler.openMessageDialog("Session Terminated",
"Ouch! You have been kicked out of the meet!");
}
});
$(document).bind('passwordrequired.muc', function (event, jid) { $(document).bind('passwordrequired.muc', function (event, jid) {
console.log('on password required', jid); console.log('on password required', jid);

View File

@ -1,4 +1,4 @@
/* global $, $iq, config, connection, Strophe, toggleAudio */ /* global $, $iq, config, connection, messageHandler, Strophe, toggleAudio */
/** /**
* Moderate connection plugin. * Moderate connection plugin.
*/ */
@ -40,7 +40,8 @@ Strophe.addConnectionPlugin('moderate', {
return true; return true;
}, },
eject: function (jid) { eject: function (jid) {
connection.jingle.terminateRemoteByJid(jid, 'kick'); // We're not the focus, so can't terminate
//connection.jingle.terminateRemoteByJid(jid, 'kick');
connection.emuc.kick(jid); connection.emuc.kick(jid);
} }
}); });

6
muc.js
View File

@ -167,7 +167,11 @@ 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);
$(document).trigger('left.muc', [from]); if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
$(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.