diff --git a/app.js b/app.js index f37d9d734..dd1f02846 100644 --- a/app.js +++ b/app.js @@ -15,6 +15,7 @@ $(document).ready(function () { UI.start(); statistics.start(); + connectionquality.init(); // Set default desktop sharing method desktopsharing.init(); diff --git a/index.html b/index.html index abd4be9c9..c68a57b0f 100644 --- a/index.html +++ b/index.html @@ -23,16 +23,17 @@ + - - - - + + + + - - + + diff --git a/libs/modules/API.bundle.js b/libs/modules/API.bundle.js index b53c899be..7b064196d 100644 --- a/libs/modules/API.bundle.js +++ b/libs/modules/API.bundle.js @@ -47,6 +47,8 @@ var events = participantLeft: false }; +var displayName = {}; + /** * Processes commands from external applicaiton. * @param message the object with the command @@ -145,6 +147,16 @@ function setupListeners() { xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) { API.triggerEvent("participantLeft", {jid: jid}); }); + xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) { + name = displayName[jid]; + if(!name || name != newDisplayName) { + API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName}); + displayName[jid] = newDisplayName; + } + }); + xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) { + API.triggerEvent("outgoingMessage", {"message": body}); + }); } var API = { diff --git a/libs/modules/RTC.bundle.js b/libs/modules/RTC.bundle.js index cd79e1937..8d1510fb7 100644 --- a/libs/modules/RTC.bundle.js +++ b/libs/modules/RTC.bundle.js @@ -508,13 +508,13 @@ var RTC = { videoStream.videoType = changedStreams[i].type; } } - }) + }); + xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) { + DataChannels.bindDataChannelListener(event.peerconnection); + }); this.rtcUtils = new RTCUtils(this); this.rtcUtils.obtainAudioAndVideoPermissions(); }, - onConferenceCreated: function(event) { - DataChannels.bindDataChannelListener(event.peerconnection); - }, muteRemoteVideoStream: function (jid, value) { var stream; diff --git a/libs/modules/UI.bundle.js b/libs/modules/UI.bundle.js index 0bbcf251e..3b24eea56 100644 --- a/libs/modules/UI.bundle.js +++ b/libs/modules/UI.bundle.js @@ -150,6 +150,12 @@ function registerListeners() { xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured); xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError); xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad); + connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED, + VideoLayout.updateLocalConnectionStats); + connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED, + VideoLayout.updateConnectionStats); + connectionquality.addListener(CQEvents.STOP, + VideoLayout.onStatsStop); } function bindEvents() @@ -208,13 +214,6 @@ UI.start = function () { $("#welcome_page").hide(); - $('body').popover({ selector: '[data-toggle=popover]', - trigger: 'click hover', - content: function() { - return this.getAttribute("content") + - keyboardshortcut.getShortcut(this.getAttribute("shortcut")); - } - }); VideoLayout.resizeLargeVideoContainer(); $("#videospace").mousemove(function () { return ToolbarToggler.showToolbar(); @@ -484,19 +483,6 @@ UI.inputDisplayNameHandler = function (value) { VideoLayout.inputDisplayNameHandler(value); }; -UI.updateLocalConnectionStats = function(percent, stats) -{ - VideoLayout.updateLocalConnectionStats(percent, stats); -}; - -UI.updateConnectionStats = function(jid, percent, stats) -{ - VideoLayout.updateConnectionStats(jid, percent, stats); -}; - -UI.onStatsStop = function () { - VideoLayout.onStatsStop(); -}; UI.getLargeVideoState = function() { @@ -6539,25 +6525,18 @@ var VideoLayout = (function (my) { */ my.onDisplayNameChanged = function (jid, displayName, status) { - var name = null; if (jid === 'localVideoContainer' || jid === xmpp.myJid()) { - name = NicknameHandler.getNickname(); setDisplayName('localVideoContainer', displayName); } else { VideoLayout.ensurePeerContainerExists(jid); - name = $('#participant_' + Strophe.getResourceFromJid(jid) + "_name").text(); setDisplayName( 'participant_' + Strophe.getResourceFromJid(jid), displayName, status); } - if(jid === 'localVideoContainer') - jid = xmpp.myJid(); - if(!name || name != displayName) - API.triggerEvent("displayNameChange",{jid: jid, displayname: displayName}); }; /** diff --git a/libs/modules/connectionquality.bundle.js b/libs/modules/connectionquality.bundle.js index cee4a3279..bc975af6d 100644 --- a/libs/modules/connectionquality.bundle.js +++ b/libs/modules/connectionquality.bundle.js @@ -1,4 +1,7 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.connectionquality=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.listenerCount = function(emitter, type) { + var ret; + if (!emitter._events || !emitter._events[type]) + ret = 0; + else if (isFunction(emitter._events[type])) + ret = 1; + else + ret = emitter._events[type].length; + return ret; +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + },{}]},{},[1])(1) }); \ No newline at end of file diff --git a/libs/modules/keyboardshortcut.bundle.js b/libs/modules/keyboardshortcut.bundle.js index db236128f..8c69e7361 100644 --- a/libs/modules/keyboardshortcut.bundle.js +++ b/libs/modules/keyboardshortcut.bundle.js @@ -63,6 +63,14 @@ var KeyboardShortcut = { } } }; + var self = this; + $('body').popover({ selector: '[data-toggle=popover]', + trigger: 'click hover', + content: function() { + return this.getAttribute("content") + + self.getShortcut(this.getAttribute("shortcut")); + } + }); }, /** * diff --git a/libs/modules/statistics.bundle.js b/libs/modules/statistics.bundle.js index c14dab510..86b3bc4fb 100644 --- a/libs/modules/statistics.bundle.js +++ b/libs/modules/statistics.bundle.js @@ -943,16 +943,13 @@ var statistics = stopRemote(); }, - onConferenceCreated: function (event) { - startRemoteStats(event.peerconnection); - }, - start: function () { - this.addConnectionStatsListener(connectionquality.updateLocalStats); - this.addRemoteStatsStopListener(connectionquality.stopSendingStats); RTC.addStreamListener(onStreamCreated, StreamEventTypes.EVENT_TYPE_LOCAL_CREATED); xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference); + xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) { + startRemoteStats(event.peerconnection); + }); } }; diff --git a/libs/modules/xmpp.bundle.js b/libs/modules/xmpp.bundle.js index d59a42196..c401f6ac2 100644 --- a/libs/modules/xmpp.bundle.js +++ b/libs/modules/xmpp.bundle.js @@ -3375,7 +3375,7 @@ module.exports = function(XMPP, eventEmitter) { Strophe.forEachChild(stats[0], "stat", function (el) { statsObj[el.getAttribute("name")] = el.getAttribute("value"); }); - connectionquality.updateRemoteStats(from, statsObj); + eventEmitter.emit(XMPPEvents.REMOTE_STATS, from, statsObj); } // Parse status. @@ -3524,7 +3524,7 @@ module.exports = function(XMPP, eventEmitter) { msg.c('nick', {xmlns: 'http://jabber.org/protocol/nick'}).t(nickname).up().up(); } this.connection.send(msg); - API.triggerEvent("outgoingMessage", {"message": body}); + eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body); }, setSubject: function (subject) { var msg = $msg({to: this.roomjid, type: 'groupchat'}); @@ -3824,8 +3824,6 @@ module.exports = function(XMPP, eventEmitter) { if (displayName && displayName.length > 0) { -// $(document).trigger('displaynamechanged', -// [jid, displayName]); eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName); } @@ -3847,7 +3845,7 @@ module.exports = function(XMPP, eventEmitter) { var JingleSession = require("./JingleSession"); -module.exports = function(XMPP) +module.exports = function(XMPP, eventEmitter) { function CallIncomingJingle(sid, connection) { var sess = connection.jingle.sessions[sid]; @@ -3855,8 +3853,7 @@ module.exports = function(XMPP) // TODO: do we check activecall == null? connection.jingle.activecall = sess; - statistics.onConferenceCreated(sess); - RTC.onConferenceCreated(sess); + eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess); // TODO: check affiliation and/or role console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]); @@ -4497,7 +4494,7 @@ function doJoin() { function initStrophePlugins() { require("./strophe.emuc")(XMPP, eventEmitter); - require("./strophe.jingle")(); + require("./strophe.jingle")(XMPP, eventEmitter); require("./strophe.moderate")(XMPP); require("./strophe.util")(); require("./strophe.rayo")(); @@ -4509,7 +4506,7 @@ function registerListeners() { StreamEventTypes.EVENT_TYPE_LOCAL_CREATED); UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) { XMPP.addToPresence("displayName", nickname); - }) + }); } function setupEvents() { diff --git a/modules/API/API.js b/modules/API/API.js index e7d864205..d669312af 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -46,6 +46,8 @@ var events = participantLeft: false }; +var displayName = {}; + /** * Processes commands from external applicaiton. * @param message the object with the command @@ -144,6 +146,16 @@ function setupListeners() { xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) { API.triggerEvent("participantLeft", {jid: jid}); }); + xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) { + name = displayName[jid]; + if(!name || name != newDisplayName) { + API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName}); + displayName[jid] = newDisplayName; + } + }); + xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) { + API.triggerEvent("outgoingMessage", {"message": body}); + }); } var API = { diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index afc5f6f2d..9d0d5c7e0 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -119,13 +119,13 @@ var RTC = { videoStream.videoType = changedStreams[i].type; } } - }) + }); + xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) { + DataChannels.bindDataChannelListener(event.peerconnection); + }); this.rtcUtils = new RTCUtils(this); this.rtcUtils.obtainAudioAndVideoPermissions(); }, - onConferenceCreated: function(event) { - DataChannels.bindDataChannelListener(event.peerconnection); - }, muteRemoteVideoStream: function (jid, value) { var stream; diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 53177e39d..461211cee 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -149,6 +149,12 @@ function registerListeners() { xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured); xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError); xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad); + connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED, + VideoLayout.updateLocalConnectionStats); + connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED, + VideoLayout.updateConnectionStats); + connectionquality.addListener(CQEvents.STOP, + VideoLayout.onStatsStop); } function bindEvents() @@ -207,13 +213,6 @@ UI.start = function () { $("#welcome_page").hide(); - $('body').popover({ selector: '[data-toggle=popover]', - trigger: 'click hover', - content: function() { - return this.getAttribute("content") + - keyboardshortcut.getShortcut(this.getAttribute("shortcut")); - } - }); VideoLayout.resizeLargeVideoContainer(); $("#videospace").mousemove(function () { return ToolbarToggler.showToolbar(); @@ -483,19 +482,6 @@ UI.inputDisplayNameHandler = function (value) { VideoLayout.inputDisplayNameHandler(value); }; -UI.updateLocalConnectionStats = function(percent, stats) -{ - VideoLayout.updateLocalConnectionStats(percent, stats); -}; - -UI.updateConnectionStats = function(jid, percent, stats) -{ - VideoLayout.updateConnectionStats(jid, percent, stats); -}; - -UI.onStatsStop = function () { - VideoLayout.onStatsStop(); -}; UI.getLargeVideoState = function() { diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index a24c485d9..a506ef5f7 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -1756,25 +1756,18 @@ var VideoLayout = (function (my) { */ my.onDisplayNameChanged = function (jid, displayName, status) { - var name = null; if (jid === 'localVideoContainer' || jid === xmpp.myJid()) { - name = NicknameHandler.getNickname(); setDisplayName('localVideoContainer', displayName); } else { VideoLayout.ensurePeerContainerExists(jid); - name = $('#participant_' + Strophe.getResourceFromJid(jid) + "_name").text(); setDisplayName( 'participant_' + Strophe.getResourceFromJid(jid), displayName, status); } - if(jid === 'localVideoContainer') - jid = xmpp.myJid(); - if(!name || name != displayName) - API.triggerEvent("displayNameChange",{jid: jid, displayname: displayName}); }; /** diff --git a/modules/connectionquality/connectionquality.js b/modules/connectionquality/connectionquality.js index 7652caec6..e382d7c24 100644 --- a/modules/connectionquality/connectionquality.js +++ b/modules/connectionquality/connectionquality.js @@ -1,3 +1,6 @@ +var EventEmitter = require("events"); +var eventEmitter = new EventEmitter(); + /** * local stats * @type {{}} @@ -68,13 +71,20 @@ function parseMUCStats(stats) { var ConnectionQuality = { + init: function () { + xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats); + statistics.addConnectionStatsListener(this.updateLocalStats); + statistics.addRemoteStatsStopListener(this.stopSendingStats); + + }, + /** * Updates the local statistics * @param data new statistics */ updateLocalStats: function (data) { stats = data; - UI.updateLocalConnectionStats(100 - stats.packetLoss.total, stats); + eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats); if (sendIntervalId == null) { startSendingStats(); } @@ -87,13 +97,13 @@ var ConnectionQuality = { */ updateRemoteStats: function (jid, data) { if (data == null || data.packetLoss_total == null) { - UI.updateConnectionStats(jid, null, null); + eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null); return; } remoteStats[jid] = parseMUCStats(data); - UI.updateConnectionStats(jid, 100 - data.packetLoss_total, remoteStats[jid]); - + eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, + jid, 100 - data.packetLoss_total, remoteStats[jid]); }, /** @@ -103,7 +113,7 @@ var ConnectionQuality = { clearInterval(sendIntervalId); sendIntervalId = null; //notify UI about stopping statistics gathering - UI.onStatsStop(); + eventEmitter.emit(CQEvents.STOP); }, /** @@ -111,6 +121,10 @@ var ConnectionQuality = { */ getStats: function () { return stats; + }, + + addListener: function (type, listener) { + eventEmitter.on(type, listener); } }; diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js index 2cfe6699a..3217b99a7 100644 --- a/modules/keyboardshortcut/keyboardshortcut.js +++ b/modules/keyboardshortcut/keyboardshortcut.js @@ -62,6 +62,14 @@ var KeyboardShortcut = { } } }; + var self = this; + $('body').popover({ selector: '[data-toggle=popover]', + trigger: 'click hover', + content: function() { + return this.getAttribute("content") + + self.getShortcut(this.getAttribute("shortcut")); + } + }); }, /** * diff --git a/modules/statistics/statistics.js b/modules/statistics/statistics.js index f0449cb7a..1665afb7d 100644 --- a/modules/statistics/statistics.js +++ b/modules/statistics/statistics.js @@ -121,16 +121,13 @@ var statistics = stopRemote(); }, - onConferenceCreated: function (event) { - startRemoteStats(event.peerconnection); - }, - start: function () { - this.addConnectionStatsListener(connectionquality.updateLocalStats); - this.addRemoteStatsStopListener(connectionquality.stopSendingStats); RTC.addStreamListener(onStreamCreated, StreamEventTypes.EVENT_TYPE_LOCAL_CREATED); xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference); + xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) { + startRemoteStats(event.peerconnection); + }); } }; diff --git a/modules/xmpp/strophe.emuc.js b/modules/xmpp/strophe.emuc.js index 1d6815b75..d6d48afa3 100644 --- a/modules/xmpp/strophe.emuc.js +++ b/modules/xmpp/strophe.emuc.js @@ -149,7 +149,7 @@ module.exports = function(XMPP, eventEmitter) { Strophe.forEachChild(stats[0], "stat", function (el) { statsObj[el.getAttribute("name")] = el.getAttribute("value"); }); - connectionquality.updateRemoteStats(from, statsObj); + eventEmitter.emit(XMPPEvents.REMOTE_STATS, from, statsObj); } // Parse status. @@ -298,7 +298,7 @@ module.exports = function(XMPP, eventEmitter) { msg.c('nick', {xmlns: 'http://jabber.org/protocol/nick'}).t(nickname).up().up(); } this.connection.send(msg); - API.triggerEvent("outgoingMessage", {"message": body}); + eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body); }, setSubject: function (subject) { var msg = $msg({to: this.roomjid, type: 'groupchat'}); @@ -598,8 +598,6 @@ module.exports = function(XMPP, eventEmitter) { if (displayName && displayName.length > 0) { -// $(document).trigger('displaynamechanged', -// [jid, displayName]); eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName); } diff --git a/modules/xmpp/strophe.jingle.js b/modules/xmpp/strophe.jingle.js index fd6b6cdb2..44be1fc61 100644 --- a/modules/xmpp/strophe.jingle.js +++ b/modules/xmpp/strophe.jingle.js @@ -2,7 +2,7 @@ var JingleSession = require("./JingleSession"); -module.exports = function(XMPP) +module.exports = function(XMPP, eventEmitter) { function CallIncomingJingle(sid, connection) { var sess = connection.jingle.sessions[sid]; @@ -10,8 +10,7 @@ module.exports = function(XMPP) // TODO: do we check activecall == null? connection.jingle.activecall = sess; - statistics.onConferenceCreated(sess); - RTC.onConferenceCreated(sess); + eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess); // TODO: check affiliation and/or role console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]); diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js index 5a7f2a5ea..153a4dd72 100644 --- a/modules/xmpp/xmpp.js +++ b/modules/xmpp/xmpp.js @@ -93,7 +93,7 @@ function doJoin() { function initStrophePlugins() { require("./strophe.emuc")(XMPP, eventEmitter); - require("./strophe.jingle")(); + require("./strophe.jingle")(XMPP, eventEmitter); require("./strophe.moderate")(XMPP); require("./strophe.util")(); require("./strophe.rayo")(); @@ -105,7 +105,7 @@ function registerListeners() { StreamEventTypes.EVENT_TYPE_LOCAL_CREATED); UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) { XMPP.addToPresence("displayName", nickname); - }) + }); } function setupEvents() { diff --git a/service/connectionquality/CQEvents.js b/service/connectionquality/CQEvents.js new file mode 100644 index 000000000..4a093e5ce --- /dev/null +++ b/service/connectionquality/CQEvents.js @@ -0,0 +1,5 @@ +var CQEvents = { + LOCALSTATS_UPDATED: "cq.localstats_updated", + REMOTESTATS_UPDATED: "cq.remotestats_updated", + STOP: "cq.stop" +}; \ No newline at end of file diff --git a/service/xmpp/XMPPEvents.js b/service/xmpp/XMPPEvents.js index cc096aeed..2cb49c294 100644 --- a/service/xmpp/XMPPEvents.js +++ b/service/xmpp/XMPPEvents.js @@ -17,6 +17,7 @@ var XMPPEvents = { PRESENCE_STATUS: "xmpp.presence_status", SUBJECT_CHANGED: "xmpp.subject_changed", MESSAGE_RECEIVED: "xmpp.message_received", + SENDING_CHAT_MESSAGE: "xmpp.sending_chat_message", PASSWORD_REQUIRED: "xmpp.password_required", CHAT_ERROR_RECEIVED: "xmpp.chat_error_received", ETHERPAD: "xmpp.etherpad"