Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.Chat.sendMessage()


  // User1 sends the message that contains the XHTML to user2
  try {
      bodiesSent = xhtmlExtension.getBodiesCount();
      bodiesReceived = 0;
      chat1.sendMessage(msg);
  }
  catch (Exception e) {
      fail("An error occured sending the message with XHTML");
  }
  Packet packet = chat2.nextResult(2000);
View Full Code Here


        msg.setBody("To enter a case please fill out this form and send it back to me");
        msg.addExtension(formToSend.getDataFormToSend());

        try {
            // Send the message with the form to fill out
            chat.sendMessage(msg);

            // Get the message with the form to fill out
            Message msg2 = (Message)collector2.nextResult(2000);
            assertNotNull("Messge not found", msg2);
            // Retrieve the form to fill out
View Full Code Here

            });

            // Start a private chat with another participant           
            Chat chat = muc2.createPrivateChat(room + "/testbot", null);
            PacketCollector collector = chat.createCollector();
            chat.sendMessage("Hello there");

            Message response = (Message) collector.nextResult(2000);
            assertNotNull("No response", response);
            assertEquals("Sender of response is incorrect", room + "/testbot", response.getFrom());
            assertEquals("Body of response is incorrect", "ACK", response.getBody());
View Full Code Here

        try {
            Thread.sleep(500);

            // User1 sends some messages to User2 which is not available at the moment
            Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
            chat.sendMessage("Test 1");
            chat.sendMessage("Test 2");

            Thread.sleep(500);

            // User2 checks the number of offline messages
View Full Code Here

            Thread.sleep(500);

            // User1 sends some messages to User2 which is not available at the moment
            Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
            chat.sendMessage("Test 1");
            chat.sendMessage("Test 2");

            Thread.sleep(500);

            // User2 checks the number of offline messages
            OfflineMessageManager offlineManager = new OfflineMessageManager(getConnection(1));
View Full Code Here

        try {
            Thread.sleep(500);

            // User1 sends some messages to User2 which is not available at the moment
            Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
            chat.sendMessage("Test 1");
            chat.sendMessage("Test 2");

            Thread.sleep(500);

            // User2 checks the number of offline messages
View Full Code Here

            Thread.sleep(500);

            // User1 sends some messages to User2 which is not available at the moment
            Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
            chat.sendMessage("Test 1");
            chat.sendMessage("Test 2");

            Thread.sleep(500);

            // User2 checks the number of offline messages
            OfflineMessageManager offlineManager = new OfflineMessageManager(getConnection(1));
View Full Code Here

          public void processMessage(Chat chat, Message message) {
            logger.debug("Received message on XMPP: {}", message.getBody());
          }
        });
        try {
          newChat.sendMessage(message);
          logger.debug("Sent message '{}' to '{}'.", message, to);
          success = true;
        } catch (XMPPException e) {
          logger.error("Error sending message '{}'", message, e);
        } catch (NotConnectedException e) {
View Full Code Here

      ChatManager chatmanager = ChatManager.getInstanceFor(conn);
      Chat newChat = chatmanager.createChat(to, null);

      try {
        while(message.length()>=2000) {
          newChat.sendMessage(message.substring(0, 2000));
          message = message.substring(2000);
        }
        newChat.sendMessage(message);
        logger.debug("Sent message '{}' to '{}'.", message, to);
        success = true;
View Full Code Here

      try {
        while(message.length()>=2000) {
          newChat.sendMessage(message.substring(0, 2000));
          message = message.substring(2000);
        }
        newChat.sendMessage(message);
        logger.debug("Sent message '{}' to '{}'.", message, to);
        success = true;
      } catch (XMPPException e) {
        logger.warn("Error Delivering block", e);
      } catch (NotConnectedException e) {
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.