Long userId, String username, String firstname, String lastname) {
try {
log.debug("----------- setUsernameAndSession");
IConnection current = Red5.getConnectionLocal();
String streamid = current.getClient().getId();
Client currentClient = this.sessionManager
.getClientByStreamId(streamid, null);
currentClient.setUsername(username);
currentClient.setUser_id(userId);
SessionVariablesUtil.setUserId(current.getClient(), userId);
currentClient.setUserObject(userId, username, firstname, lastname);
// Update Session Data
log.debug("UDPATE SESSION " + SID + ", " + userId);
sessiondataDao.updateUserWithoutSession(SID, userId);
User user = userManager.getUserById(userId);
if (user != null) {
currentClient.setExternalUserId(user.getExternalUserId());
currentClient.setExternalUserType(user.getExternalUserType());
}
// only fill this value from User-Record
// cause invited users have non
// you cannot set the firstname,lastname from the UserRecord
User us = usersDao.get(userId);
if (us != null && us.getPictureuri() != null) {
// set Picture-URI
currentClient.setPicture_uri(us.getPictureuri());
}
this.sessionManager.updateClientByStreamId(streamid,
currentClient, false, null);
return currentClient;
} catch (Exception err) {