Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.Chat


   
    try {
      XMPPConnection conn = XMPPConnect.getConnection();

      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;
      } catch (XMPPException e) {
        logger.warn("Error Delivering block", e);
      } catch (NotConnectedException e) {
View Full Code Here


              "receiver cannot be null for xmpp instant messaging");
        else if (receiver instanceof XMPPID) {
          final XMPPID rcvr = (XMPPID) receiver;
          aMsg.setType(Message.Type.chat);
          final String receiverName = rcvr.getFQName();
          final Chat localChat = connection.getChatManager()
              .createChat(receiverName, new MessageListener() {
                public void processMessage(Chat chat,
                    Message message) {
                }
              });
          localChat.sendMessage(aMsg);
        } else if (receiver instanceof XMPPRoomID) {
          final XMPPRoomID roomID = (XMPPRoomID) receiver;
          aMsg.setType(Message.Type.groupchat);
          final String to = roomID.getMucString();
          aMsg.setTo(to);
View Full Code Here

    private class OutgoingMessageInterceptor implements PacketInterceptor {

        public void interceptPacket(Packet packet) {
            Message message = (Message) packet;
            Chat chat = connection.getChatManager().getThreadChat(message.getThread());
            if (chat == null) {
                return;
            }
            if (updateChatState(chat, ChatState.active)) {
                message.addExtension(new ChatStateExtension(ChatState.active));
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.Chat

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.