From 886fb2ac4320af3f793235f1fca5ae490d35cc42 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 8 Apr 2015 12:30:10 +0200 Subject: [PATCH] Fix typos and rename event names for purposes of clarity. --- modules/API/API.js | 4 ++-- modules/RTC/RTC.js | 2 +- modules/UI/UI.js | 14 +++++++------- modules/xmpp/moderator.js | 2 +- modules/xmpp/strophe.emuc.js | 10 +++++----- service/xmpp/XMPPEvents.js | 15 +++++++++------ 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/modules/API/API.js b/modules/API/API.js index 9be9648b5..44256ff7b 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -135,7 +135,7 @@ function processMessage(event) } function setupListeners() { - APP.xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) { + APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_JOINED, function (from) { API.triggerEvent("participantJoined", {jid: from}); }); APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) { @@ -143,7 +143,7 @@ function setupListeners() { API.triggerEvent("incomingMessage", {"from": from, "nick": nick, "message": txt}); }); - APP.xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) { + APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_LEFT, function (jid) { API.triggerEvent("participantLeft", {jid: jid}); }); APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) { diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index ad819d54a..6a9d95a59 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -117,7 +117,7 @@ var RTC = { function (stream, isUsingScreenStream, callback) { self.changeLocalVideo(stream, isUsingScreenStream, callback); }, DesktopSharingEventTypes.NEW_STREAM_CREATED); - APP.xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) { + APP.xmpp.addListener(XMPPEvents.STREAMS_CHANGED, function (jid, changedStreams) { for(var i = 0; i < changedStreams.length; i++) { var type = changedStreams[i].type; if (type != "audio") { diff --git a/modules/UI/UI.js b/modules/UI/UI.js index d30f6042d..2d50351ab 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -185,7 +185,7 @@ function registerListeners() { APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) { Avatar.setUserAvatar(from, id); }); - APP.xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) { + APP.xmpp.addListener(XMPPEvents.STREAMS_CHANGED, function (jid, changedStreams) { for(stream in changedStreams) { // might need to update the direction if participant just went from sendrecv to recvonly @@ -207,13 +207,13 @@ function registerListeners() { }); APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged); APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined); - APP.xmpp.addListener(XMPPEvents.LOCALROLE_CHANGED, onLocalRoleChange); - APP.xmpp.addListener(XMPPEvents.MUC_ENTER, onMucEntered); + APP.xmpp.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, onLocalRoleChanged); + APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_JOINED, onMucMemberJoined); APP.xmpp.addListener(XMPPEvents.MUC_ROLE_CHANGED, onMucRoleChanged); APP.xmpp.addListener(XMPPEvents.PRESENCE_STATUS, onMucPresenceStatus); APP.xmpp.addListener(XMPPEvents.SUBJECT_CHANGED, chatSetSubject); APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation); - APP.xmpp.addListener(XMPPEvents.MUC_LEFT, onMucLeft); + APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_LEFT, onMucMemberLeft); APP.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordRequired); APP.xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError); APP.xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad); @@ -417,7 +417,7 @@ function initEtherpad(name) { Etherpad.init(name); }; -function onMucLeft(jid) { +function onMucMemberLeft(jid) { console.log('left.muc', jid); var displayName = $('#participant_' + Strophe.getResourceFromJid(jid) + '>.displayname').html(); @@ -444,7 +444,7 @@ function onMucLeft(jid) { }; -function onLocalRoleChange(jid, info, pres, isModerator) +function onLocalRoleChanged(jid, info, pres, isModerator) { console.info("My role changed, new role: " + info.role); @@ -502,7 +502,7 @@ function onPasswordRequired(callback) { ':input:first' ); } -function onMucEntered(jid, id, displayName) { +function onMucMemberJoined(jid, id, displayName) { messageHandler.notify(displayName,'notify.somebody', 'connected', 'notify.connected'); diff --git a/modules/xmpp/moderator.js b/modules/xmpp/moderator.js index 32d44c6c9..9f2b6edbd 100644 --- a/modules/xmpp/moderator.js +++ b/modules/xmpp/moderator.js @@ -85,7 +85,7 @@ var Moderator = { } }, - onMucLeft: function (jid) { + onMucMemberLeft: function (jid) { console.info("Someone left is it focus ? " + jid); var resource = Strophe.getResourceFromJid(jid); if (resource === 'focus' && !this.xmppService.sessionTerminated) { diff --git a/modules/xmpp/strophe.emuc.js b/modules/xmpp/strophe.emuc.js index 398eb6e1c..dbf5766f6 100644 --- a/modules/xmpp/strophe.emuc.js +++ b/modules/xmpp/strophe.emuc.js @@ -201,7 +201,7 @@ module.exports = function(XMPP, eventEmitter) { if (this.role !== member.role) { this.role = member.role; - eventEmitter.emit(XMPPEvents.LOCALROLE_CHANGED, + eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED, from, member, pres, Moderator.isModerator()); } if (!this.joined) { @@ -224,7 +224,7 @@ module.exports = function(XMPP, eventEmitter) { if (email.length > 0) { id = email.text(); } - eventEmitter.emit(XMPPEvents.MUC_ENTER, from, id, member.displayName); + eventEmitter.emit(XMPPEvents.MUC_MEMBER_JOINED, from, id, member.displayName); } } else { // Presence update for existing participant @@ -584,7 +584,7 @@ module.exports = function(XMPP, eventEmitter) { }, onParticipantLeft: function (jid) { - eventEmitter.emit(XMPPEvents.MUC_LEFT, jid); + eventEmitter.emit(XMPPEvents.MUC_MEMBER_LEFT, jid); this.connection.jingle.terminateByJid(jid); @@ -593,7 +593,7 @@ module.exports = function(XMPP, eventEmitter) { [jid, this.getPrezi(jid)]); } - Moderator.onMucLeft(jid); + Moderator.onMucMemberLeft(jid); }, parsePresence: function (from, memeber, pres) { if($(pres).find(">bridgeIsDown").length > 0 && !bridgeIsDown) { @@ -628,7 +628,7 @@ module.exports = function(XMPP, eventEmitter) { }); - eventEmitter.emit(XMPPEvents.CHANGED_STREAMS, from, changedStreams); + eventEmitter.emit(XMPPEvents.STREAMS_CHANGED, from, changedStreams); var displayName = !config.displayJids ? memeber.displayName : Strophe.getResourceFromJid(from); diff --git a/service/xmpp/XMPPEvents.js b/service/xmpp/XMPPEvents.js index 1ebdd6b40..0597182f4 100644 --- a/service/xmpp/XMPPEvents.js +++ b/service/xmpp/XMPPEvents.js @@ -1,21 +1,24 @@ var XMPPEvents = { - CONFERENCE_CERATED: "xmpp.conferenceCreated.jingle", + CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle", CALL_TERMINATED: "xmpp.callterminated.jingle", CALL_INCOMING: "xmpp.callincoming.jingle", - DISPOSE_CONFERENCE: "xmpp.dispoce_confernce", + DISPOSE_CONFERENCE: "xmpp.dispose_conference", GRACEFUL_SHUTDOWN: "xmpp.graceful_shutdown", KICKED: "xmpp.kicked", BRIDGE_DOWN: "xmpp.bridge_down", USER_ID_CHANGED: "xmpp.user_id_changed", - CHANGED_STREAMS: "xmpp.changed_streams", + STREAMS_CHANGED: "xmpp.streams_changed", + // We joined the MUC MUC_JOINED: "xmpp.muc_joined", - MUC_ENTER: "xmpp.muc_enter", + // A member joined the MUC + MUC_MEMBER_JOINED: "xmpp.muc_member_joined", + // A member left the MUC + MUC_MEMBER_LEFT: "xmpp.muc_member_left", MUC_ROLE_CHANGED: "xmpp.muc_role_changed", - MUC_LEFT: "xmpp.muc_left", MUC_DESTROYED: "xmpp.muc_destroyed", DISPLAY_NAME_CHANGED: "xmpp.display_name_changed", REMOTE_STATS: "xmpp.remote_stats", - LOCALROLE_CHANGED: "xmpp.localrole_changed", + LOCAL_ROLE_CHANGED: "xmpp.localrole_changed", PRESENCE_STATUS: "xmpp.presence_status", RESERVATION_ERROR: "xmpp.room_reservation_error", SUBJECT_CHANGED: "xmpp.subject_changed",