Package it.meucci
Class UserMessagesList
java.lang.Object
it.meucci.UserMessagesList
A wrapper around a synchronized map to handle and store messages and usernames.
Messages are not shown then, but their support are still implemented for further updates.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(Message message) Adds aMessage
to a conversationvoid
Adds a new username to the list of the connected onesvoid
removeUser
(String username) Removes a username and its messagesvoid
updateUser
(String oldUsername, String newUsername) Called when a username change its name; i.e. when a server sends a USERNAME_CHANGEDServerAnnouncement
.
-
Constructor Details
-
UserMessagesList
public UserMessagesList()Constructs a new synchronized map.
-
-
Method Details
-
getUsernames
- Returns:
- The list of currently connected usernames.
-
addMessage
Adds aMessage
to a conversation- Parameters:
message
- the message to be added
-
removeUser
Removes a username and its messages- Parameters:
username
- The just left user's username
-
addUser
Adds a new username to the list of the connected ones- Parameters:
username
- The just joined user's username
-
updateUser
Called when a username change its name; i.e. when a server sends a USERNAME_CHANGEDServerAnnouncement
.- Parameters:
oldUsername
- The old usernamenewUsername
- The new one
-