From cd6264d0df83135c579adf3d6f17865b91df77be Mon Sep 17 00:00:00 2001 From: paweldomas Date: Fri, 28 Nov 2014 16:18:58 +0100 Subject: [PATCH] Adopts kick to new focus. --- app.js | 21 +++++++++++---------- moderatemuc.js | 5 +++-- muc.js | 6 +++++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app.js b/app.js index e876f306e..96fbda5be 100644 --- a/app.js +++ b/app.js @@ -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) { // put our ssrcs into presence so other clients can identify our stream 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) { console.log('on password required', jid); diff --git a/moderatemuc.js b/moderatemuc.js index 2b481a8e2..19f15907c 100644 --- a/moderatemuc.js +++ b/moderatemuc.js @@ -1,4 +1,4 @@ -/* global $, $iq, config, connection, Strophe, toggleAudio */ +/* global $, $iq, config, connection, messageHandler, Strophe, toggleAudio */ /** * Moderate connection plugin. */ @@ -40,7 +40,8 @@ Strophe.addConnectionPlugin('moderate', { return true; }, 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); } }); \ No newline at end of file diff --git a/muc.js b/muc.js index b7c02a7a6..48cf26cd7 100644 --- a/muc.js +++ b/muc.js @@ -167,7 +167,11 @@ Strophe.addConnectionPlugin('emuc', { if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) { delete this.members[from]; 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 // to remove everyone else from our view, so we trigger the event.