Package org.jivesoftware.smack

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


            logger.debug("Will send chat message to \"" + recipient + "\" with payload \"" + payload + "\"");
        }

        Chat chat = chatWith(recipient);
        Message message = buildMessage(Message.Type.chat, recipient, payload);
        chat.sendMessage(message);
    }
   
    private Chat chatWith(String recipient)
    {
        Chat chat = chats.get(recipient);
View Full Code Here


    private XMPPConnection xmppConnection;
    private BrokerContainer brokerContainer;

    public void testSendJabberQueueMessage() throws Exception {
        Chat chat = xmppConnection.createChat("jdoe@jabber.org");
        chat.sendMessage("Hey, how's it going?");
    }

    protected void setUp() throws Exception {
        brokerContainer = new BrokerContainerImpl();
        brokerContainer.addConnector("jabber://localhost:61606");
View Full Code Here

    MibewTracker mt = new MibewTracker(conn, new MibewTrackerListener(){
     
      @Override
      public void threadCreated(MibewThread thread) {
        try {
          chat.sendMessage(thread.getId() + ": " + thread.getAddress() + " " + thread.getClientName());
        } catch (XMPPException e) {
          e.printStackTrace();
        }
      }
     
View Full Code Here

            try {
                // google bounces back the default message types, you must use chat
                Message msg = new Message(toUser, Message.Type.chat);
                msg.setBody(text);
                chat.sendMessage(msg);
                System.out.println("Message Sended");
            } catch (XMPPException e) {
                System.out.println("Failed to send message");
                // handle this how?
            }
View Full Code Here

        key = UUID.randomUUID().toString();
        xmppClientSidePacketListener.listenForResponse(key, msgCtx);
        message.setProperty(XMPPConstants.SEQUENCE_ID, key);
      }     

      chat.sendMessage(message);
      log.debug("Sent message :"+message.toXML());

      //If this is on client side, wait for the response from server.
      //Is this the best way to do this?
      if(waitForResponse && !msgCtx.isServerSide()){
View Full Code Here

        Chat chat = chatManager.createChat(xmppOutTransportInfo.getDestinationAccount(), null);       
        try{        
            message.setProperty(XMPPConstants.SEQUENCE_ID,
                    xmppOutTransportInfo.getSequenceID());
           message.setBody(responseMsg);   
          chat.sendMessage(message);
          log.debug("Sent message :"+message.toXML());
        } catch (XMPPException e) {
          XMPPSender.handleException("Error occurred while sending the message : "+message.toXML(),e);
        }
        } 
View Full Code Here

            endpoint.getBinding().populateXmppMessage(message, exchange);

            if (LOG.isDebugEnabled()) {
                LOG.debug("Sending XMPP message to {} from {} : {}", new Object[]{endpoint.getParticipant(), endpoint.getUser(), message.getBody()});
            }
            chat.sendMessage(message);
        } catch (XMPPException xmppe) {
            throw new RuntimeExchangeException("Could not send XMPP message: to " + endpoint.getParticipant() + " from " + endpoint.getUser() + " : " + message
                    + " to: " + XmppEndpoint.getConnectionMessage(connection), exchange, xmppe);
        } catch (Exception e) {
            throw new RuntimeExchangeException("Could not send XMPP message to " + endpoint.getParticipant() + " from " + endpoint.getUser() + " : " + message
View Full Code Here

            endpoint.getBinding().populateXmppMessage(message, exchange);

            if (LOG.isDebugEnabled()) {
                LOG.debug("Sending XMPP message to " + endpoint.getParticipant() + " from " + endpoint.getUser() + " : " + message.getBody());
            }
            chat.sendMessage(message);
        } catch (XMPPException xmppe) {
            throw new RuntimeExchangeException("Cannot send XMPP message: to " + endpoint.getParticipant() + " from " + endpoint.getUser() + " : " + message
                    + " to: " + XmppEndpoint.getConnectionMessage(connection), exchange, xmppe);
        } catch (Exception e) {
            throw new RuntimeExchangeException("Cannot send XMPP message to " + endpoint.getParticipant() + " from " + endpoint.getUser() + " : " + message
View Full Code Here

  "<body><p style='font-size:large'>Hey John, this is my new <span style='color:green'>green</span><em>!!!!</em></p></body>");
  msg.addExtension(xhtmlExtension);

  // User1 sends the message that contains the XHTML to user2
  try {
      chat1.sendMessage(msg);
      Thread.sleep(200);
  }
  catch (Exception e) {
      fail("An error occured sending the message with XHTML");
  }
View Full Code Here

  "<body><p style='font-size:large'>Hey John, this is my new <span style='color:green'>green</span><em>!!!!</em></p></body>");
  msg.addExtension(xhtmlExtension);

  // User1 sends the message that contains the XHTML to user2
  try {
      chat1.sendMessage(msg);
  }
  catch (Exception e) {
      fail("An error occured sending the message with XHTML");
  }
  Packet packet = chat2.nextResult(2000);
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.