Show user name in title bar of MAGE. Clear table chat after disconnect. Remove user from chat after disconnect. Some tweaking about the messages if a user disconnected/session expired.

This commit is contained in:
LevelX2 2013-04-29 17:18:43 +02:00
parent ae30e9a884
commit b6ddaabe44
12 changed files with 58 additions and 28 deletions

View file

@ -60,7 +60,7 @@ public class ChatManager {
}
public void leaveChat(UUID chatId, UUID userId) {
chatSessions.get(chatId).kill(userId);
chatSessions.get(chatId).kill(userId, User.DisconnectReason.CleaningUp);
}
public void destroyChatSession(UUID chatId) {
@ -87,15 +87,16 @@ public class ChatManager {
User user = UserManager.getInstance().getUser(userId);
if (user != null) {
for (ChatSession chat: chatSessions.values()) {
if (chat.hasUser(userId))
if (chat.hasUser(userId)) {
chat.broadcast(user.getName(), message, color);
}
}
}
}
public void removeUser(UUID userId) {
public void removeUser(UUID userId, User.DisconnectReason reason) {
for (ChatSession chat: chatSessions.values()) {
chat.kill(userId);
chat.kill(userId, reason);
}
}
}