+ ": The received userList packet's"
+ " payload is null.");
return;
}
ISarosSession sarosSession = sessionManager.getSarosSession();
assert sarosSession != null;
User fromUser = sarosSession.getUser(fromJID);
if (fromUser == null || !fromUser.isHost()) {
log.error("Received userList from buddy who "
+ "is not part of our session or is not host: "
+ Utils.prefix(fromJID));
return;
}
// Adding new users
User newUser;
for (UserListEntry userEntry : userListInfo.userList) {
// Check if we already know this user
User user = sarosSession.getUser(userEntry.jid);
if (user == null) {
// This user is not part of our project
newUser = new User(sarosSession, userEntry.jid,
userEntry.colorID);
newUser.setPermission(userEntry.permission);
if (userEntry.invitationComplete)
newUser.invitationCompleted();
// Add him and send him a message, and tell him our
// colour
sarosSession.addUser(newUser);
} else {
// User already exists
// Check if the existing user has the colour that we
// expect
if (user.getColorID() != userEntry.colorID) {
log.warn("Received color id doesn't"
+ " match known color id");
}
// Update his permission
user.setPermission(userEntry.permission);
// Update invitation status
if (userEntry.invitationComplete
&& !user.isInvitationComplete()) {
sarosSession.userInvitationCompleted(user);
}
}
}
transmitter.sendUserListConfirmation(fromJID);
}