Some refactoring

This commit is contained in:
Pedro Beschorner Marin 2015-07-03 12:29:44 +00:00
parent 5a6c3efd7d
commit ed12579fb0
5 changed files with 18 additions and 14 deletions

View File

@ -231,7 +231,7 @@ trait UsersApp {
}
users.removeUser(msg.userId)
regUsers -= getUserAuthToken(msg.userId)
removeRegUser(msg.userId)
logger.info("Ejecting user from meeting: mid=[" + meetingID + "]uid=[" + msg.userId + "]")
outGW.send(new UserEjectedFromMeeting(meetingID, recorded, msg.userId, msg.ejectedBy))
@ -241,14 +241,6 @@ trait UsersApp {
}
}
def getUserAuthToken(userId: String): String = {
val regUser = regUsers.values find (ru => userId contains ru.id)
regUser match {
case Some(ru) => ru.authToken
case None => ""
}
}
def handleUserShareWebcam(msg: UserShareWebcam) {
users.getUser(msg.userId) foreach {user =>
val streams = user.webcamStreams + msg.stream
@ -474,4 +466,15 @@ trait UsersApp {
}
}
def getRegisteredUser(userID: String): Option[RegisteredUser] = {
regUsers.values find (ru => userID contains ru.id)
}
def removeRegUser(userID: String) {
getRegisteredUser(userID) match {
case Some(ru) => regUsers -= ru.authToken
case None =>
}
}
}

View File

@ -181,8 +181,6 @@ package org.bigbluebutton.main.model.users
trace(LOG + "userLoggedIn - Setting my userid to [" + e.userid + "]");
UserManager.getInstance().getConference().setMyUserid(e.userid);
_conferenceParameters.userid = e.userid;
// since might be a reconnection, clean up users list
UserManager.getInstance().getConference().removeAllParticipants();
sender.queryForParticipants();
sender.queryForRecordingStatus();

View File

@ -82,7 +82,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</EventHandlers>
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}" >
<MethodInvoker generator="{ChatMessageService}" method="getPublicChatMessages"/>
<EventAnnouncer generator="{TranscriptEvent}" type="{TranscriptEvent.LOAD_TRANSCRIPT}"/>
</EventHandlers>
<Injectors target="{ChatMessageService}">

View File

@ -185,7 +185,7 @@ package org.bigbluebutton.modules.users.services
e.userid = userid;
dispatcher.dispatchEvent(e);
// If the user was the presenter he's reconnecting
// If the user was the presenter he's reconnecting and must become viewer
if (UserManager.getInstance().getConference().amIPresenter) {
sendSwitchedPresenterEvent(false, UsersUtil.getPresenterUserID());
UserManager.getInstance().getConference().amIPresenter = false;
@ -423,6 +423,9 @@ package org.bigbluebutton.modules.users.services
trace(LOG + "*** handleGetUsersReply " + msg.msg + " **** \n");
var map:Object = JSON.parse(msg.msg);
var users:Object = map.users as Array;
// since might be a reconnection, clean up users list
UserManager.getInstance().getConference().removeAllParticipants();
if (map.count > 0) {
trace(LOG + "number of users = [" + users.length + "]");

View File

@ -126,7 +126,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{VideoEventMapDelegate}" method="handleCamSettingsClosedEvent" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}">
<EventHandlers type="{BBBEvent.RECONNECT_DISCONNECTED_EVENT}">
<MethodInvoker generator="{VideoEventMapDelegate}" method="closeAllWindows"/>
</EventHandlers>
<!-- ~~~~~~~~~~~~~~~~~~ INJECTORS ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->