浏览代码

handle PRESENCE_STATUS event

dev1
isymchych 9 年前
父节点
当前提交
96adaf5e65
共有 6 个文件被更改,包括 24 次插入2 次删除
  1. 10
    0
      JitsiConference.js
  2. 4
    0
      JitsiConferenceEvents.js
  3. 8
    0
      JitsiParticipant.js
  4. 1
    0
      doc/API.md
  5. 0
    1
      modules/RTC/DataChannels.js
  6. 1
    1
      modules/xmpp/ChatRoom.js

+ 10
- 0
JitsiConference.js 查看文件

871
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
871
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
872
     });
872
     });
873
 
873
 
874
+    conference.room.addListener(XMPPEvents.PRESENCE_STATUS, function (jid, status) {
875
+        var id = Strophe.getResourceFromJid(jid);
876
+        var participant = conference.getParticipantById(id);
877
+        if (!participant || participant._status === status) {
878
+            return;
879
+        }
880
+        participant._status = status;
881
+        conference.eventEmitter.emit(JitsiConferenceEvents.USER_STATUS_CHANGED, id, status);
882
+    });
883
+
874
     conference.rtc.addListener(DSEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
884
     conference.rtc.addListener(DSEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
875
         conference.eventEmitter.emit(JitsiConferenceEvents.FIREFOX_EXTENSION_NEEDED, url);
885
         conference.eventEmitter.emit(JitsiConferenceEvents.FIREFOX_EXTENSION_NEEDED, url);
876
     });
886
     });

+ 4
- 0
JitsiConferenceEvents.js 查看文件

27
      * User role changed.
27
      * User role changed.
28
      */
28
      */
29
     USER_ROLE_CHANGED: "conference.roleChanged",
29
     USER_ROLE_CHANGED: "conference.roleChanged",
30
+    /**
31
+     * User status changed.
32
+     */
33
+    USER_STATUS_CHANGED: "conference.statusChanged",
30
     /**
34
     /**
31
      * New text message was received.
35
      * New text message was received.
32
      */
36
      */

+ 8
- 0
JitsiParticipant.js 查看文件

11
     this._supportsDTMF = false;
11
     this._supportsDTMF = false;
12
     this._tracks = [];
12
     this._tracks = [];
13
     this._role = 'none';
13
     this._role = 'none';
14
+    this._status = null;
14
 }
15
 }
15
 
16
 
16
 /**
17
 /**
48
     return this._displayName;
49
     return this._displayName;
49
 };
50
 };
50
 
51
 
52
+/**
53
+ * @returns {String} The status of the participant.
54
+ */
55
+JitsiParticipant.prototype.getStatus = function () {
56
+    return this._status;
57
+};
58
+
51
 /**
59
 /**
52
  * @returns {Boolean} Whether this participant is a moderator or not.
60
  * @returns {Boolean} Whether this participant is a moderator or not.
53
  */
61
  */

+ 1
- 0
doc/API.md 查看文件

89
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
89
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
90
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
90
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
91
         - USER_ROLE_CHANGED - notifies that role of some user changed. (parameters - id(string), role(string))
91
         - USER_ROLE_CHANGED - notifies that role of some user changed. (parameters - id(string), role(string))
92
+        - USER_STATUS_CHANGED - notifies that status of some user changed. (parameters - id(string), status(string))
92
         - CONFERENCE_FAILED - notifies that user failed to join the conference. (parameters - errorCode(JitsiMeetJS.errors.conference))
93
         - CONFERENCE_FAILED - notifies that user failed to join the conference. (parameters - errorCode(JitsiMeetJS.errors.conference))
93
         - KICKED - notifies that user has been kicked from the conference.
94
         - KICKED - notifies that user has been kicked from the conference.
94
         - START_MUTED_POLICY_CHANGED - notifies that all new participants will join with muted audio/video stream (parameters - JS object with 2 properties - audio(boolean), video(boolean))
95
         - START_MUTED_POLICY_CHANGED - notifies that all new participants will join with muted audio/video stream (parameters - JS object with 2 properties - audio(boolean), video(boolean))

+ 0
- 1
modules/RTC/DataChannels.js 查看文件

217
 }
217
 }
218
 
218
 
219
 module.exports = DataChannels;
219
 module.exports = DataChannels;
220
-

+ 1
- 1
modules/xmpp/ChatRoom.js 查看文件

338
 
338
 
339
     // Trigger status message update
339
     // Trigger status message update
340
     if (member.status) {
340
     if (member.status) {
341
-        this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member);
341
+        this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
342
     }
342
     }
343
 
343
 
344
     if(jibri)
344
     if(jibri)

正在加载...
取消
保存