handle PRESENCE_STATUS event

This commit is contained in:
isymchych 2016-01-13 18:33:54 +02:00
parent 2d7d350db6
commit 03ee9fffba
6 changed files with 24 additions and 2 deletions

View File

@ -871,6 +871,16 @@ function setupListeners(conference) {
conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
});
conference.room.addListener(XMPPEvents.PRESENCE_STATUS, function (jid, status) {
var id = Strophe.getResourceFromJid(jid);
var participant = conference.getParticipantById(id);
if (!participant || participant._status === status) {
return;
}
participant._status = status;
conference.eventEmitter.emit(JitsiConferenceEvents.USER_STATUS_CHANGED, id, status);
});
conference.rtc.addListener(DSEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
conference.eventEmitter.emit(JitsiConferenceEvents.FIREFOX_EXTENSION_NEEDED, url);
});

View File

@ -27,6 +27,10 @@ var JitsiConferenceEvents = {
* User role changed.
*/
USER_ROLE_CHANGED: "conference.roleChanged",
/**
* User status changed.
*/
USER_STATUS_CHANGED: "conference.statusChanged",
/**
* New text message was received.
*/

View File

@ -11,6 +11,7 @@ function JitsiParticipant(jid, conference, displayName){
this._supportsDTMF = false;
this._tracks = [];
this._role = 'none';
this._status = null;
}
/**
@ -48,6 +49,13 @@ JitsiParticipant.prototype.getDisplayName = function() {
return this._displayName;
};
/**
* @returns {String} The status of the participant.
*/
JitsiParticipant.prototype.getStatus = function () {
return this._status;
};
/**
* @returns {Boolean} Whether this participant is a moderator or not.
*/

View File

@ -88,6 +88,7 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
- CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
- DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
- USER_ROLE_CHANGED - notifies that role of some user changed. (parameters - id(string), role(string))
- USER_STATUS_CHANGED - notifies that status of some user changed. (parameters - id(string), status(string))
- CONFERENCE_FAILED - notifies that user failed to join the conference. (parameters - errorCode(JitsiMeetJS.errors.conference))
- KICKED - notifies that user has been kicked from the conference.
- 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))

View File

@ -217,4 +217,3 @@ DataChannels.prototype._some = function (callback, thisArg) {
}
module.exports = DataChannels;

View File

@ -324,7 +324,7 @@ ChatRoom.prototype.onPresence = function (pres) {
// Trigger status message update
if (member.status) {
this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member);
this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
}
if(jibri)