feat(Event): 2.6.6: Gestion des déconnexions

This commit is contained in:
Emi Boucly 2025-01-07 21:15:38 +01:00
parent 1732a63a4a
commit 0b513c19bc
3 changed files with 14 additions and 5 deletions

View file

@ -254,6 +254,9 @@ public class ChatServer {
doListPost(event.getContent());
LOGGER.info("Sending Posts");
return true;
} else if (event.getType().equals(Event.QUIT)) {
LOGGER.info("Déconnexion");
return false;
} else {
LOGGER.warning("Unhandled event type: " + event.getType());
return false;
@ -367,6 +370,8 @@ public class ChatServer {
try {
sock.close();
removeClient(this);
user.setConnected(false);
sendEventToAllContacts(new Event(Event.CONT, user.toJsonObject()));
} catch (IOException e) {
throw new RuntimeException(e);
}