示例#1
0
 public boolean sendMessageToUser(User toUser, String content) {
   PrivateChat chat = privateChats.get(toUser.getId());
   if (chat == null) {
     chat = new PrivateChat(this, toUser);
     privateChats.put(toUser.getId(), chat);
   }
   Message message = new Message(content, new Date());
   return chat.addMessage(message);
 }
示例#2
0
 public void addConversation(PrivateChat conversation) {
   User otherUser = conversation.getOtherParticipant(this);
   privateChats.put(otherUser.getId(), conversation);
 }