예제 #1
0
 /**
  * Versendet eine Message.
  *
  * @param m Message zum versandt.
  */
 public void sendMessage(Message m) throws MessagingException {
   List<String> receiver = m.getReceiver();
   addMessageHistory(m);
   if (m instanceof RoomMessage) {
     textMmessageSender.sendMessageToRoom((RoomMessage) m);
   } else if (m instanceof SingleMessage) {
     m.setSender(simConfiguration.getUsername());
     String singleReceiver = receiver.get(0);
     User user = userService.getUser(singleReceiver);
     textMmessageSender.sendMessage(user, m);
   } else if (m instanceof BroadcastMessage) {
     m.setSender(simConfiguration.getUsername());
     textMmessageSender.sendMessageToAllUsers(m);
   }
 }
예제 #2
0
  /** Initialisiert die Bean. */
  @PostConstruct
  public void init() {
    userService.refresh(userService.getCurrentUser());

    textMmessageSender.setMessageCallback(new DelegatingMessageObserver());
  }