Package org.eclipse.ecf.presence.im

Examples of org.eclipse.ecf.presence.im.IChatMessage


  }

  public void handleMessageEvent(IIMMessageEvent event) {
    if (event instanceof IChatMessageEvent) {
      IChatMessageEvent imEvent = (IChatMessageEvent) event;
      IChatMessage message = imEvent.getChatMessage();
      List commands = bot.getCommands();
      for (int i = 0; i < commands.size(); i++) {
        IIMMessageHandlerEntry entry = (IIMMessageHandlerEntry) commands
            .get(i);
        entry.handleIMMessage(message);
View Full Code Here


      public void handleMessageEvent(IIMMessageEvent messageEvent) {
        if (messageEvent instanceof IChatRoomMessageEvent) {
          IChatRoomMessage m = ((IChatRoomMessageEvent) messageEvent).getChatRoomMessage();
          chatroomview.handleMessage(m.getFromID(), m.getMessage());
        } else if (messageEvent instanceof IChatMessageEvent) {
          final IChatMessage chatMessage = ((IChatMessageEvent) messageEvent).getChatMessage();
          chatroomview.handleChatMessage(chatMessage);
        }
      }
    });
  }
View Full Code Here

  public void testSendIM() throws Exception {
    chat0.getChatMessageSender().sendChatMessage(
        getClient(1).getConnectedID(), "abcdef");
    sleep(SLEEPTIME);
    assertHasEvent(receivedChatMessages, IChatMessage.class);
    final IChatMessage message = (IChatMessage) receivedChatMessages.get(0);
    assertTrue(message.getBody().equals("abcdef"));
    assertTrue(message.getType().equals(IChatMessage.Type.CHAT));
    assertNull(message.getSubject());
    final Map props = message.getProperties();
    assertNotNull(props);
    assertTrue(props.size() == 0);
  }
View Full Code Here

        getClient(1).getConnectedID(), sendthreadid,
        IChatMessage.Type.CHAT, "subject1", "uvwxyz", sendprops);
    sleep(SLEEPTIME);

    assertHasEvent(receivedChatMessages, IChatMessage.class);
    final IChatMessage message = (IChatMessage) receivedChatMessages.get(0);
    // For some reason, the smack library doesn't seem to get this right.
    // assertTrue(message.getThreadID().equals(sendthreadid));
    assertTrue(message.getSubject().equals("subject1"));
    assertTrue(message.getBody().equals("uvwxyz"));
    assertTrue(message.getType().equals(IChatMessage.Type.CHAT));
    final Map props = message.getProperties();
    assertNotNull(props);
    assertTrue(props.size() == 1);
    final String val = (String) props.get("prop1");
    assertNotNull(val);
    assertEquals(val, "this");
View Full Code Here

        getClient(1).getConnectedID(), null, IChatMessage.Type.CHAT,
        null, null, sendprops);
    sleep(SLEEPTIME);

    assertHasEvent(receivedChatMessages, IChatMessage.class);
    final IChatMessage message = (IChatMessage) receivedChatMessages.get(0);
    assertNull(message.getSubject());
    assertTrue(message.getBody().equals(""));
    assertTrue(message.getType().equals(IChatMessage.Type.CHAT));
    final Map props = message.getProperties();
    assertNotNull(props);
    assertTrue(props.size() == 1);
    final String val = (String) props.get("prop2");
    assertNotNull(val);
    assertEquals(val, "that");
View Full Code Here

      e.printStackTrace();
    }
  }

  private void displayMessage(IChatMessageEvent e) {
    final IChatMessage message = e.getChatMessage();
    Display.getDefault().asyncExec(new Runnable() {
      public void run() {
        MessagesView view = (MessagesView) workbench.getActiveWorkbenchWindow().getActivePage().findView(MessagesView.VIEW_ID);
        if (view != null) {
          final IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) view.getSite().getAdapter(IWorkbenchSiteProgressService.class);
          view.openTab(icms, itms, targetID, message.getFromID());
          view.showMessage(message);
          service.warnOfContentChange();
        } else {
          try {
            final IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
            view = (MessagesView) page.showView(MessagesView.VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
            if (!page.isPartVisible(view)) {
              final IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) view.getSite().getAdapter(IWorkbenchSiteProgressService.class);
              service.warnOfContentChange();
            }
            view.openTab(icms, itms, targetID, message.getFromID());
            view.showMessage(message);
          } catch (final PartInitException e) {
            e.printStackTrace();
          }
        }
View Full Code Here

    sender = presence.getChatManager().getChatMessageSender();
    // Setup message requestListener to handle incoming messages
    presence.getChatManager().addMessageListener(new IIMMessageListener() {
      public void handleMessageEvent(IIMMessageEvent messageEvent) {
        if (messageEvent instanceof IChatMessageEvent) {
          final IChatMessage m = ((IChatMessageEvent) messageEvent).getChatMessage();
          receiver.handleMessage(m);
        }
      }
    });
  }
View Full Code Here

      presence.getChatManager().addMessageListener(
          new IIMMessageListener() {
            public void handleMessageEvent(
                IIMMessageEvent messageEvent) {
              if (messageEvent instanceof IChatMessageEvent) {
                IChatMessage m = ((IChatMessageEvent) messageEvent)
                    .getChatMessage();
                if (receiver != null) {
                  receiver.handleMessage(m);
                }
              }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.presence.im.IChatMessage

Copyright © 2018 www.massapicom. 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.