Added status update for when a client goes offline

This commit is contained in:
delvh
2020-02-02 13:34:28 +01:00
parent 5b482c6815
commit 79d11f4fba
3 changed files with 49 additions and 17 deletions

View File

@ -37,6 +37,7 @@ public class LoginCredentialProcessor implements ObjectProcessor<LoginCredential
@Override
public void process(LoginCredentials input, long socketId, ObjectWriteProxy writeProxy) throws IOException {
UserStatusChangeProcessor.setWriteProxy(writeProxy);
System.out.println(String.format("Received login credentials %s from socket ID %d", input, socketId));
envoy.server.data.User user = getUser(input);
@ -45,7 +46,7 @@ public class LoginCredentialProcessor implements ObjectProcessor<LoginCredential
if (user == null) return;
// notifies contacts of this users online-going and updates his status in the
// database
UserStatusChangeProcessor.updateUserStatus(new UserStatusChangeEvent(user.toCommonUser()), writeProxy);
UserStatusChangeProcessor.updateUserStatus(new UserStatusChangeEvent(user.toCommonUser()));
ConnectionManager.getInstance().registerUser(user.getId(), socketId);