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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(Message message) Adds aMessageto a conversationvoidAdds a new username to the list of the connected onesvoidremoveUser(String username) Removes a username and its messagesvoidupdateUser(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 aMessageto 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
-