Examples of PairChat


Examples of com.calclab.emite.im.chat.PairChat

  @Override
  public final void onPairChatChanged(final PairChatChangedEvent event) {
    if (event.isCreated()) {
      getChatStateHook(event.getChat());
    } else if (event.isClosed()) {
      final PairChat chat = event.getChat();
      logger.finer("Removing chat state from chat: " + chat.toString());
      final ChatStateHook hook = hooks.get(chat);
      if (hook != null && hook.getOtherState() != ChatStateHook.ChatState.gone) {
        // We are closing, then we send the gone state
        hook.setOwnState(ChatStateHook.ChatState.gone);
      }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

    input.addChangeHandler(new ChangeHandler() {
      @Override
      public void onChange(final ChangeEvent event) {
        final String msg = input.getText();
        log("Message sent: " + msg);
        final PairChat chat = chatManager.openChat(uri(user));
        chat.send(new Message(msg));
        input.setText("");
      }
    });

    final PairChat chat = chatManager.openChat(uri(user));
    chat.addMessageReceivedHandler(this);
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

  }

  @Test
  public void shouldBeReadyIfSessionLogedIn() {
    final ChatProperties properties = new ChatProperties(uri("someone@domain"), USER_URI, ChatStatus.ready);
    final PairChat aChat = new PairChat(eventBus,session, properties);
    assertEquals(ChatStatus.ready, aChat.getStatus());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

  }

  @Test
  public void shouldSendNoThreadWhenNotSpecified() {
    final ChatProperties properties = new ChatProperties(CHAT_URI, USER_URI, ChatStatus.locked);
    final PairChat noThreadChat = new PairChat(eventBus, session, properties);
    noThreadChat.setStatus(ChatStatus.ready);
    noThreadChat.send(new Message("the message"));
    session.verifySent("<message from='self@domain/res' to='other@domain/other' " + "type='chat'><body>the message</body></message>");
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

  @Before
  public void beforeTests() {
    eventBus = new SimpleEventBus();
    session = new XmppSessionTester();
    properties = new ChatProperties(CHAT, ME, ChatStatus.ready);
    chat = new PairChat(eventBus, session, properties);
    beforeSendHandler = new BeforeMessageSentTestHandler();
    chat.addBeforeMessageSentHandler(beforeSendHandler);
    sentHandler = new MessageSentTestHandler();
    chat.addMessageSentHandler(sentHandler);
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

    assertEquals(1, handler.getCalledTimes());
  }

  @Test
  public void oneToOneChatsAreAlwaysReadyWhenCreated() {
    final PairChat chat = manager.open(uri("other@domain/resource"));
    assertEquals(ChatStatus.ready, chat.getStatus());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

  }

  @Test
  public void shouldBeInitiatedByOtherIfMessageArrives() {
    session.receives("<message to='" + MYSELF + "' from='someone@domain'><body>the body</body></message>");
    final PairChat chat = manager.open(uri("someone@domain"));
    assertFalse(chat.isInitiatedByMe());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

    assertFalse(chat.isInitiatedByMe());
  }

  @Test
  public void shouldBlockChatWhenClosingIt() {
    final PairChat chat = manager.open(uri("other@domain/resource"));
    assertEquals(ChatStatus.ready, chat.getStatus());
    manager.close(chat);
    assertEquals(ChatStatus.locked, chat.getStatus());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

    assertEquals(ChatStatus.locked, chat.getStatus());
  }

  @Test
  public void shouldCloseChatWhenLoggedOut() {
    final PairChat chat = manager.open(uri("name@domain/resouce"));
    assertEquals(ChatStatus.ready, chat.getStatus());
    final ChatStatusChangedTestHandler handler = new ChatStatusChangedTestHandler();
    chat.addChatStatusChangedHandler(false, handler);
    session.logout();
    assertEquals(ChatStatus.locked, handler.getLastChatStatus());
  }
View Full Code Here

Examples of com.calclab.emite.im.chat.PairChat

    assertEquals(ChatStatus.locked, handler.getLastChatStatus());
  }

  @Test
  public void shouldEventIncommingMessages() {
    final PairChat chat = manager.open(uri("someone@domain"));
    final MessageReceivedTestHandler handler = new MessageReceivedTestHandler();
    chat.addMessageReceivedHandler(handler);
    session.receives("<message type='chat' id='purplee8b92642' to='user@domain' " + "from='someone@domain'><x xmlns='jabber:x:event'/><active"
        + "xmlns='http://jabber.org/protocol/chatstates'/></message>");
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.