Пример #1
0
  @Override
  public void talk(String message) {
    ServiceRequest request = RequestHolder.getServiceRequest();
    Session session = request.getSession();
    EventRepository eventRepository = request.getConnector().getEventRepository();

    eventRepository.publish(
        new MessageEvent((String) session.getAttribute("nick"), "", message),
        request.getClientId());
  }
Пример #2
0
  @Override
  public void talkPrivate(String targetNickname, String message) {
    ServiceRequest request = RequestHolder.getServiceRequest();
    Session session = request.getSession();
    EventRepository eventRepository = request.getConnector().getEventRepository();

    UUID targetClientId = Chats.USERS.get(targetNickname);
    if (targetClientId == null) {
      throw new InvalidUserException("Invalid user: "******"nick"), targetNickname, message),
        request.getClientId(),
        request.getClientId(),
        targetClientId);
  }