Bläddra i källkod

add info about user role to JitsiConference

dev1
isymchych 9 år sedan
förälder
incheckning
02a95fd662
6 ändrade filer med 116 tillägg och 42 borttagningar
  1. 31
    0
      JitsiConference.js
  2. 5
    1
      JitsiConferenceEvents.js
  3. 3
    3
      JitsiParticipant.js
  4. 6
    0
      doc/API.md
  5. 67
    32
      lib-jitsi-meet.js
  6. 4
    6
      modules/xmpp/ChatRoom.js

+ 31
- 0
JitsiConference.js Visa fil

195
     this.rtc.removeLocalStream(track);
195
     this.rtc.removeLocalStream(track);
196
 };
196
 };
197
 
197
 
198
+/**
199
+ * Get role of the local user.
200
+ * @returns {string} user role: 'moderator' or 'none'
201
+ */
202
+JitsiConference.prototype.getRole = function () {
203
+    return this.room.role;
204
+};
205
+
206
+/**
207
+ * Check if local user is moderator.
208
+ * @returns {boolean} true if local user is moderator, false otherwise.
209
+ */
210
+JitsiConference.prototype.isModerator = function () {
211
+    return this.room.isModerator();
212
+};
213
+
198
 /**
214
 /**
199
  * Elects the participant with the given id to be the selected participant or the speaker.
215
  * Elects the participant with the given id to be the selected participant or the speaker.
200
  * @param id the identifier of the participant
216
  * @param id the identifier of the participant
253
     this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
269
     this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
254
 };
270
 };
255
 
271
 
272
+JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
273
+    var id = Strophe.getResourceFromJid(jid);
274
+    var participant = this.getParticipantById(id);
275
+    if (!participant) {
276
+        return;
277
+    }
278
+    participant._role = role;
279
+    this.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, id, role);
280
+};
281
+
256
 JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
282
 JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
257
     var id = Strophe.getResourceFromJid(jid);
283
     var id = Strophe.getResourceFromJid(jid);
258
     var participant = this.getParticipantById(id);
284
     var participant = this.getParticipantById(id);
362
 
388
 
363
     conference.room.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, conference.onDisplayNameChanged.bind(conference));
389
     conference.room.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, conference.onDisplayNameChanged.bind(conference));
364
 
390
 
391
+    conference.room.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, function (role) {
392
+        conference.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, conference.myUserId(), role);
393
+    });
394
+    conference.room.addListener(XMPPEvents.MUC_ROLE_CHANGED, conference.onUserRoleChanged.bind(conference));
395
+
365
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
396
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
366
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
397
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
367
     });
398
     });

+ 5
- 1
JitsiConferenceEvents.js Visa fil

23
      * A user has left the conference.
23
      * A user has left the conference.
24
      */
24
      */
25
     USER_LEFT: "conference.userLeft",
25
     USER_LEFT: "conference.userLeft",
26
+    /**
27
+     * User role changed.
28
+     */
29
+    USER_ROLE_CHANGED: "conference.roleChanged",
26
     /**
30
     /**
27
      * New text message was received.
31
      * New text message was received.
28
      */
32
      */
79
     /**
83
     /**
80
      * Indicates that DTMF support changed.
84
      * Indicates that DTMF support changed.
81
      */
85
      */
82
-    DTMF_SUPPORT_CHANGED: "conference.dtmf_support_changed"
86
+    DTMF_SUPPORT_CHANGED: "conference.dtmfSupportChanged"
83
 };
87
 };
84
 
88
 
85
 module.exports = JitsiConferenceEvents;
89
 module.exports = JitsiConferenceEvents;

+ 3
- 3
JitsiParticipant.js Visa fil

7
     this._displayName = displayName;
7
     this._displayName = displayName;
8
     this._supportsDTMF = false;
8
     this._supportsDTMF = false;
9
     this._tracks = [];
9
     this._tracks = [];
10
-    this._isModerator = false;
10
+    this._role = 'none';
11
 }
11
 }
12
 
12
 
13
 /**
13
 /**
42
  * @returns {Boolean} Whether this participant is a moderator or not.
42
  * @returns {Boolean} Whether this participant is a moderator or not.
43
  */
43
  */
44
 JitsiParticipant.prototype.isModerator = function() {
44
 JitsiParticipant.prototype.isModerator = function() {
45
-    return this._isModerator;
45
+    return this._role === 'moderator';
46
 };
46
 };
47
 
47
 
48
 // Gets a link to an etherpad instance advertised by the participant?
48
 // Gets a link to an etherpad instance advertised by the participant?
81
  * @returns {String} The role of this participant.
81
  * @returns {String} The role of this participant.
82
  */
82
  */
83
 JitsiParticipant.prototype.getRole = function() {
83
 JitsiParticipant.prototype.getRole = function() {
84
-
84
+    return this._role;
85
 };
85
 };
86
 
86
 
87
 /*
87
 /*

+ 6
- 0
doc/API.md Visa fil

78
         - CONFERENCE_JOINED - notifies the local user that he joined the conference successfully. (no parameters)
78
         - CONFERENCE_JOINED - notifies the local user that he joined the conference successfully. (no parameters)
79
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
79
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
80
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
80
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
81
+        - USER_ROLE_CHANGED - notifies that role of some user changed. (parameters - id(string), role(string))
81
 
82
 
82
     2. connection
83
     2. connection
83
         - CONNECTION_FAILED - indicates that the server connection failed.
84
         - CONNECTION_FAILED - indicates that the server connection failed.
220
 
221
 
221
 19. isDTMFSupported() - Check if at least one user supports DTMF.
222
 19. isDTMFSupported() - Check if at least one user supports DTMF.
222
 
223
 
224
+20. getRole() - returns string with the local user role ("moderator" or "none")
225
+
226
+21. isModerator() - checks if local user has "moderator" role
227
+
228
+
223
 JitsiTrack
229
 JitsiTrack
224
 ======
230
 ======
225
 The object represents single track - video or audio. They can be remote tracks ( from the other participants in the call) or local tracks (from the devices of the local participant).
231
 The object represents single track - video or audio. They can be remote tracks ( from the other participants in the call) or local tracks (from the devices of the local participant).

+ 67
- 32
lib-jitsi-meet.js Visa fil

197
     this.rtc.removeLocalStream(track);
197
     this.rtc.removeLocalStream(track);
198
 };
198
 };
199
 
199
 
200
+/**
201
+ * Get role of the local user.
202
+ * @returns {string} user role: 'moderator' or 'none'
203
+ */
204
+JitsiConference.prototype.getRole = function () {
205
+    return this.room.role;
206
+};
207
+
208
+/**
209
+ * Check if local user is moderator.
210
+ * @returns {boolean} true if local user is moderator, false otherwise.
211
+ */
212
+JitsiConference.prototype.isModerator = function () {
213
+    return this.room.isModerator();
214
+};
215
+
200
 /**
216
 /**
201
  * Elects the participant with the given id to be the selected participant or the speaker.
217
  * Elects the participant with the given id to be the selected participant or the speaker.
202
  * @param id the identifier of the participant
218
  * @param id the identifier of the participant
255
     this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
271
     this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
256
 };
272
 };
257
 
273
 
274
+JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
275
+    var id = Strophe.getResourceFromJid(jid);
276
+    var participant = this.getParticipantById(id);
277
+    if (!participant) {
278
+        return;
279
+    }
280
+    participant._role = role;
281
+    this.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, id, role);
282
+};
283
+
258
 JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
284
 JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
259
     var id = Strophe.getResourceFromJid(jid);
285
     var id = Strophe.getResourceFromJid(jid);
260
     var participant = this.getParticipantById(id);
286
     var participant = this.getParticipantById(id);
364
 
390
 
365
     conference.room.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, conference.onDisplayNameChanged.bind(conference));
391
     conference.room.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, conference.onDisplayNameChanged.bind(conference));
366
 
392
 
393
+    conference.room.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, function (role) {
394
+        conference.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, conference.myUserId(), role);
395
+    });
396
+    conference.room.addListener(XMPPEvents.MUC_ROLE_CHANGED, conference.onUserRoleChanged.bind(conference));
397
+
367
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
398
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
368
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
399
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
369
     });
400
     });
496
      * A user has left the conference.
527
      * A user has left the conference.
497
      */
528
      */
498
     USER_LEFT: "conference.userLeft",
529
     USER_LEFT: "conference.userLeft",
530
+    /**
531
+     * User role changed.
532
+     */
533
+    USER_ROLE_CHANGED: "conference.roleChanged",
499
     /**
534
     /**
500
      * New text message was received.
535
      * New text message was received.
501
      */
536
      */
552
     /**
587
     /**
553
      * Indicates that DTMF support changed.
588
      * Indicates that DTMF support changed.
554
      */
589
      */
555
-    DTMF_SUPPORT_CHANGED: "conference.dtmf_support_changed"
590
+    DTMF_SUPPORT_CHANGED: "conference.dtmfSupportChanged"
556
 };
591
 };
557
 
592
 
558
 module.exports = JitsiConferenceEvents;
593
 module.exports = JitsiConferenceEvents;
783
     this._displayName = displayName;
818
     this._displayName = displayName;
784
     this._supportsDTMF = false;
819
     this._supportsDTMF = false;
785
     this._tracks = [];
820
     this._tracks = [];
786
-    this._isModerator = false;
821
+    this._role = 'none';
787
 }
822
 }
788
 
823
 
789
 /**
824
 /**
818
  * @returns {Boolean} Whether this participant is a moderator or not.
853
  * @returns {Boolean} Whether this participant is a moderator or not.
819
  */
854
  */
820
 JitsiParticipant.prototype.isModerator = function() {
855
 JitsiParticipant.prototype.isModerator = function() {
821
-    return this._isModerator;
856
+    return this._role === 'moderator';
822
 };
857
 };
823
 
858
 
824
 // Gets a link to an etherpad instance advertised by the participant?
859
 // Gets a link to an etherpad instance advertised by the participant?
857
  * @returns {String} The role of this participant.
892
  * @returns {String} The role of this participant.
858
  */
893
  */
859
 JitsiParticipant.prototype.getRole = function() {
894
 JitsiParticipant.prototype.getRole = function() {
860
-
895
+    return this._role;
861
 };
896
 };
862
 
897
 
863
 /*
898
 /*
5565
 
5600
 
5566
 },{}],26:[function(require,module,exports){
5601
 },{}],26:[function(require,module,exports){
5567
 (function (__filename){
5602
 (function (__filename){
5568
-
5603
+/* global Strophe, $, $pres, $iq, $msg */
5604
+/* jshint -W101,-W069 */
5569
 var logger = require("jitsi-meet-logger").getLogger(__filename);
5605
 var logger = require("jitsi-meet-logger").getLogger(__filename);
5570
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5606
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5571
 var Moderator = require("./moderator");
5607
 var Moderator = require("./moderator");
5576
         var self = this;
5612
         var self = this;
5577
         $(packet).children().each(function (index) {
5613
         $(packet).children().each(function (index) {
5578
             var tagName = $(this).prop("tagName");
5614
             var tagName = $(this).prop("tagName");
5579
-            var node = {}
5580
-            node["tagName"] = tagName;
5615
+            var node = {
5616
+                tagName: tagName
5617
+            };
5581
             node.attributes = {};
5618
             node.attributes = {};
5582
             $($(this)[0].attributes).each(function( index, attr ) {
5619
             $($(this)[0].attributes).each(function( index, attr ) {
5583
                 node.attributes[ attr.name ] = attr.value;
5620
                 node.attributes[ attr.name ] = attr.value;
5584
-            } );
5621
+            });
5585
             var text = Strophe.getText($(this)[0]);
5622
             var text = Strophe.getText($(this)[0]);
5586
-            if(text)
5623
+            if (text) {
5587
                 node.value = text;
5624
                 node.value = text;
5625
+            }
5588
             node.children = [];
5626
             node.children = [];
5589
             nodes.push(node);
5627
             nodes.push(node);
5590
             self.packet2JSON($(this), node.children);
5628
             self.packet2JSON($(this), node.children);
5591
-        })
5629
+        });
5592
     },
5630
     },
5593
     JSON2packet: function (nodes, packet) {
5631
     JSON2packet: function (nodes, packet) {
5594
-        for(var i = 0; i < nodes.length; i++)
5595
-        {
5632
+        for(var i = 0; i < nodes.length; i++) {
5596
             var node = nodes[i];
5633
             var node = nodes[i];
5597
             if(!node || node === null){
5634
             if(!node || node === null){
5598
                 continue;
5635
                 continue;
5634
     this.presMap = {};
5671
     this.presMap = {};
5635
     this.presHandlers = {};
5672
     this.presHandlers = {};
5636
     this.joined = false;
5673
     this.joined = false;
5637
-    this.role = null;
5674
+    this.role = 'none';
5638
     this.focusMucJid = null;
5675
     this.focusMucJid = null;
5639
     this.bridgeIsDown = false;
5676
     this.bridgeIsDown = false;
5640
     this.options = options || {};
5677
     this.options = options || {};
5671
             }
5708
             }
5672
         ]
5709
         ]
5673
     });
5710
     });
5674
-}
5711
+};
5675
 
5712
 
5676
 ChatRoom.prototype.join = function (password, tokenPassword) {
5713
 ChatRoom.prototype.join = function (password, tokenPassword) {
5677
     if(password)
5714
     if(password)
5773
     member.jid = tmp.attr('jid');
5810
     member.jid = tmp.attr('jid');
5774
     member.isFocus = false;
5811
     member.isFocus = false;
5775
     if (member.jid
5812
     if (member.jid
5776
-        && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") == 0) {
5813
+        && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") === 0) {
5777
         member.isFocus = true;
5814
         member.isFocus = true;
5778
     }
5815
     }
5779
 
5816
 
5822
             if (this.role !== member.role) {
5859
             if (this.role !== member.role) {
5823
                 this.role = member.role;
5860
                 this.role = member.role;
5824
 
5861
 
5825
-                this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED,
5826
-                    member, this.isModerator());
5862
+                this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED, this.role);
5827
             }
5863
             }
5828
         if (!this.joined) {
5864
         if (!this.joined) {
5829
             this.joined = true;
5865
             this.joined = true;
5846
         // Watch role change:
5882
         // Watch role change:
5847
         if (this.members[from].role != member.role) {
5883
         if (this.members[from].role != member.role) {
5848
             this.members[from].role = member.role;
5884
             this.members[from].role = member.role;
5849
-            this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED,
5850
-                member.role, member.nick);
5885
+            this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED, from, member.role);
5851
         }
5886
         }
5852
 
5887
 
5853
         // store the new display name
5888
         // store the new display name
5912
 
5947
 
5913
         this.xmpp.disposeConference(false);
5948
         this.xmpp.disposeConference(false);
5914
         this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
5949
         this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
5915
-        delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(jid)];
5950
+        delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(from)];
5916
         return true;
5951
         return true;
5917
     }
5952
     }
5918
 
5953
 
5955
     var subject = $(msg).find('>subject');
5990
     var subject = $(msg).find('>subject');
5956
     if (subject.length) {
5991
     if (subject.length) {
5957
         var subjectText = subject.text();
5992
         var subjectText = subject.text();
5958
-        if (subjectText || subjectText == "") {
5993
+        if (subjectText || subjectText === "") {
5959
             this.eventEmitter.emit(XMPPEvents.SUBJECT_CHANGED, subjectText);
5994
             this.eventEmitter.emit(XMPPEvents.SUBJECT_CHANGED, subjectText);
5960
             logger.log("Subject is changed to " + subjectText);
5995
             logger.log("Subject is changed to " + subjectText);
5961
         }
5996
         }
5980
         this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
6015
         this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
5981
             from, nick, txt, this.myroomjid, stamp);
6016
             from, nick, txt, this.myroomjid, stamp);
5982
     }
6017
     }
5983
-}
6018
+};
5984
 
6019
 
5985
 ChatRoom.prototype.onPresenceError = function (pres, from) {
6020
 ChatRoom.prototype.onPresenceError = function (pres, from) {
5986
     if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
6021
     if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
6059
 
6094
 
6060
 ChatRoom.prototype.addPresenceListener = function (name, handler) {
6095
 ChatRoom.prototype.addPresenceListener = function (name, handler) {
6061
     this.presHandlers[name] = handler;
6096
     this.presHandlers[name] = handler;
6062
-}
6097
+};
6063
 
6098
 
6064
 ChatRoom.prototype.removePresenceListener = function (name) {
6099
 ChatRoom.prototype.removePresenceListener = function (name) {
6065
     delete this.presHandlers[name];
6100
     delete this.presHandlers[name];
6066
-}
6101
+};
6067
 
6102
 
6068
-ChatRoom.prototype.isModerator = function (jid) {
6103
+ChatRoom.prototype.isModerator = function () {
6069
     return this.role === 'moderator';
6104
     return this.role === 'moderator';
6070
 };
6105
 };
6071
 
6106
 
6085
 ChatRoom.prototype.removeStream = function (stream) {
6120
 ChatRoom.prototype.removeStream = function (stream) {
6086
     if(!this.session)
6121
     if(!this.session)
6087
         return;
6122
         return;
6088
-    this.session.peerconnection.removeStream(stream)
6089
-}
6123
+    this.session.peerconnection.removeStream(stream);
6124
+};
6090
 
6125
 
6091
 ChatRoom.prototype.switchStreams = function (stream, oldStream, callback, isAudio) {
6126
 ChatRoom.prototype.switchStreams = function (stream, oldStream, callback, isAudio) {
6092
     if(this.session) {
6127
     if(this.session) {
6108
         logger.warn("No conference handler or conference not started yet");
6143
         logger.warn("No conference handler or conference not started yet");
6109
         callback();
6144
         callback();
6110
     }
6145
     }
6111
-}
6146
+};
6112
 
6147
 
6113
 ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
6148
 ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
6114
     var self = this;
6149
     var self = this;
6115
     var localCallback = function (mute) {
6150
     var localCallback = function (mute) {
6116
         self.sendVideoInfoPresence(mute);
6151
         self.sendVideoInfoPresence(mute);
6117
         if(callback)
6152
         if(callback)
6118
-            callback(mute)
6153
+            callback(mute);
6119
     };
6154
     };
6120
 
6155
 
6121
     if(this.session)
6156
     if(this.session)
6148
         {attributes:
6183
         {attributes:
6149
         {"audions": "http://jitsi.org/jitmeet/audio"},
6184
         {"audions": "http://jitsi.org/jitmeet/audio"},
6150
             value: mute.toString()});
6185
             value: mute.toString()});
6151
-}
6186
+};
6152
 
6187
 
6153
 ChatRoom.prototype.sendAudioInfoPresence = function(mute, callback) {
6188
 ChatRoom.prototype.sendAudioInfoPresence = function(mute, callback) {
6154
     this.addAudioInfoToPresence(mute);
6189
     this.addAudioInfoToPresence(mute);
6165
         {attributes:
6200
         {attributes:
6166
         {"videons": "http://jitsi.org/jitmeet/video"},
6201
         {"videons": "http://jitsi.org/jitmeet/video"},
6167
             value: mute.toString()});
6202
             value: mute.toString()});
6168
-}
6203
+};
6169
 
6204
 
6170
 
6205
 
6171
 ChatRoom.prototype.sendVideoInfoPresence = function (mute) {
6206
 ChatRoom.prototype.sendVideoInfoPresence = function (mute) {
6198
     }
6233
     }
6199
 
6234
 
6200
     this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
6235
     this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
6201
-}
6236
+};
6202
 
6237
 
6203
 ChatRoom.prototype.getJidBySSRC = function (ssrc) {
6238
 ChatRoom.prototype.getJidBySSRC = function (ssrc) {
6204
     if (!this.session)
6239
     if (!this.session)

+ 4
- 6
modules/xmpp/ChatRoom.js Visa fil

69
     this.presMap = {};
69
     this.presMap = {};
70
     this.presHandlers = {};
70
     this.presHandlers = {};
71
     this.joined = false;
71
     this.joined = false;
72
-    this.role = null;
72
+    this.role = 'none';
73
     this.focusMucJid = null;
73
     this.focusMucJid = null;
74
     this.bridgeIsDown = false;
74
     this.bridgeIsDown = false;
75
     this.options = options || {};
75
     this.options = options || {};
257
             if (this.role !== member.role) {
257
             if (this.role !== member.role) {
258
                 this.role = member.role;
258
                 this.role = member.role;
259
 
259
 
260
-                this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED,
261
-                    member, this.isModerator());
260
+                this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED, this.role);
262
             }
261
             }
263
         if (!this.joined) {
262
         if (!this.joined) {
264
             this.joined = true;
263
             this.joined = true;
281
         // Watch role change:
280
         // Watch role change:
282
         if (this.members[from].role != member.role) {
281
         if (this.members[from].role != member.role) {
283
             this.members[from].role = member.role;
282
             this.members[from].role = member.role;
284
-            this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED,
285
-                member.role, member.nick);
283
+            this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED, from, member.role);
286
         }
284
         }
287
 
285
 
288
         // store the new display name
286
         // store the new display name
500
     delete this.presHandlers[name];
498
     delete this.presHandlers[name];
501
 };
499
 };
502
 
500
 
503
-ChatRoom.prototype.isModerator = function (jid) {
501
+ChatRoom.prototype.isModerator = function () {
504
     return this.role === 'moderator';
502
     return this.role === 'moderator';
505
 };
503
 };
506
 
504
 

Laddar…
Avbryt
Spara