소스 검색

handle PRESENCE_STATUS event

master
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,6 +871,16 @@ function setupListeners(conference) {
871 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 884
     conference.rtc.addListener(DSEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
875 885
         conference.eventEmitter.emit(JitsiConferenceEvents.FIREFOX_EXTENSION_NEEDED, url);
876 886
     });

+ 4
- 0
JitsiConferenceEvents.js 파일 보기

@@ -27,6 +27,10 @@ var JitsiConferenceEvents = {
27 27
      * User role changed.
28 28
      */
29 29
     USER_ROLE_CHANGED: "conference.roleChanged",
30
+    /**
31
+     * User status changed.
32
+     */
33
+    USER_STATUS_CHANGED: "conference.statusChanged",
30 34
     /**
31 35
      * New text message was received.
32 36
      */

+ 8
- 0
JitsiParticipant.js 파일 보기

@@ -11,6 +11,7 @@ function JitsiParticipant(jid, conference, displayName){
11 11
     this._supportsDTMF = false;
12 12
     this._tracks = [];
13 13
     this._role = 'none';
14
+    this._status = null;
14 15
 }
15 16
 
16 17
 /**
@@ -48,6 +49,13 @@ JitsiParticipant.prototype.getDisplayName = function() {
48 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 60
  * @returns {Boolean} Whether this participant is a moderator or not.
53 61
  */

+ 1
- 0
doc/API.md 파일 보기

@@ -89,6 +89,7 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
89 89
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
90 90
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
91 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 93
         - CONFERENCE_FAILED - notifies that user failed to join the conference. (parameters - errorCode(JitsiMeetJS.errors.conference))
93 94
         - KICKED - notifies that user has been kicked from the conference.
94 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,4 +217,3 @@ DataChannels.prototype._some = function (callback, thisArg) {
217 217
 }
218 218
 
219 219
 module.exports = DataChannels;
220
-

+ 1
- 1
modules/xmpp/ChatRoom.js 파일 보기

@@ -338,7 +338,7 @@ ChatRoom.prototype.onPresence = function (pres) {
338 338
 
339 339
     // Trigger status message update
340 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 344
     if(jibri)

Loading…
취소
저장