Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.ChatManager


            presence.setStatus("Ready");
            // Send the packet (assume we have a Connection instance called "con").
            conn.sendPacket(presence);

            // wait for messages
            ChatManager chatmanager = conn.getChatManager();
            chatmanager.addChatListener(new ChatManagerListener() {
                @Override
                public void chatCreated(Chat chat, boolean createdLocally) {
                    if (!createdLocally) {
                        chat.addMessageListener(new MessageListener() {
                            @Override
View Full Code Here


      if(xmppConnection == null){
        handleException("Connection to XMPP Server is not established.");       
      }
   
    //initialize the chat manager using connection
    ChatManager chatManager = xmppConnection.getChatManager();
    Chat chat = chatManager.createChat(xmppOutTransportInfo.getDestinationAccount(), null);   
   
    try
    {
      OMElement msgElement = msgCtx.getEnvelope();
      if (msgCtx.isDoingREST()) {
View Full Code Here

        } catch (XMPPException e) {
            throw new RuntimeExchangeException("Cannot connect to: "
                    + XmppEndpoint.getConnectionMessage(connection), exchange, e);
        }

        ChatManager chatManager = connection.getChatManager();
        Chat chat = chatManager.getThreadChat(threadId);
        if (chat == null) {
            chat = chatManager.createChat(getParticipant(), threadId, new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    // not here to do conversation
                }
            });
        }
View Full Code Here

        try {
            // SmackConfiguration.setPacketReplyTimeout(1000);
            XMPPConnection con = new XMPPConnection(config);
            con.connect();
            con.login("amq-user", "amq-pwd");
            ChatManager chatManager = con.getChatManager();
            Chat chat = chatManager.createChat("test@localhost", new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    System.out.println("Got XMPP message from chat " + chat.getParticipant() + " message - " + message.getBody());
                }
            });
            for (int i = 0; i < 10; i++) {
View Full Code Here

        try {
            // SmackConfiguration.setPacketReplyTimeout(1000);
            XMPPConnection con = new XMPPConnection(config);
            con.connect();
            con.login("amq-user", "amq-pwd");
            ChatManager chatManager = con.getChatManager();
            Chat chat = chatManager.createChat("test@localhost", new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    LOG.info("Got XMPP message from chat " + chat.getParticipant() + " message - " + message.getBody());
                }
            });
            for (int i = 0; i < 10; i++) {
View Full Code Here

        } catch (XMPPException e) {
            throw new RuntimeExchangeException("Cannot connect to: "
                    + XmppEndpoint.getConnectionMessage(connection), exchange, e);
        }

        ChatManager chatManager = connection.getChatManager();
        LOG.debug("Looking for existing chat instance with thread ID " + endpoint.getChatId());
        Chat chat = chatManager.getThreadChat(endpoint.getChatId());
        if (chat == null) {
            LOG.debug("Creating new chat instance with thread ID " + endpoint.getChatId());
            chat = chatManager.createChat(getParticipant(), endpoint.getChatId(), new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    // not here to do conversation
                    LOG.debug("Received and discarding message from " + getParticipant() + " : " + message.getBody());
                }
            });
View Full Code Here

        } catch (XMPPException e) {
            throw new RuntimeExchangeException("Cannot connect to: "
                    + XmppEndpoint.getConnectionMessage(connection), exchange, e);
        }

        ChatManager chatManager = connection.getChatManager();
        Chat chat = chatManager.getThreadChat(getParticipant());
        if (chat == null) {
            chat = chatManager.createChat(getParticipant(), getParticipant(), new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    // not here to do conversation
                }
            });
        }
View Full Code Here

        } catch (XMPPException e) {
            throw new RuntimeExchangeException("Cannot connect to: "
                    + XmppEndpoint.getConnectionMessage(connection), exchange, e);
        }

        ChatManager chatManager = connection.getChatManager();
        Chat chat = getOrCreateChat(chatManager);
        Message message = null;
        try {
            message = new Message();
            message.setTo(getParticipant());
View Full Code Here

        } catch (XMPPException e) {
            throw new RuntimeExchangeException("Cannot connect to: "
                    + XmppEndpoint.getConnectionMessage(connection), exchange, e);
        }

        ChatManager chatManager = connection.getChatManager();

        LOG.trace("Looking for existing chat instance with thread ID {}", endpoint.getChatId());
        Chat chat = chatManager.getThreadChat(endpoint.getChatId());
        if (chat == null) {
            LOG.trace("Creating new chat instance with thread ID {}", endpoint.getChatId());
            chat = chatManager.createChat(getParticipant(), endpoint.getChatId(), new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    // not here to do conversation
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Received and discarding message from {} : {}", getParticipant(), message.getBody());
                    }
View Full Code Here

            participant = getParticipant();
        } else {
            thread = "Chat:" + participant + ":" + endpoint.getUser();
        }

        ChatManager chatManager = connection.getChatManager();
        Chat chat = getOrCreateChat(chatManager, participant, thread);
        Message message = null;
        try {
            message = new Message();
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.ChatManager

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.