Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.MessageListener


      listeners.remove(username+controller.hashCode());
  }
 
  public Chat createChat(final String username, String chatPartnerJid, final Controller controller) {
    ChatManager chatmanager = getInstantMessagingClient(username).getConnection().getChatManager();
    Chat chat = chatmanager.createChat(chatPartnerJid, new MessageListener() {

      public void processMessage(Chat chat, Message message) {
        message.setProperty("receiveTime", new Long(new Date().getTime()));
        GenericEventListener listener = listeners.get(username+controller.hashCode());
        listener.event(new InstantMessagingEvent(message, "chatmessage"));
View Full Code Here


            String[] credentials = authToken.split(":");

            xmppConnection.login(credentials[0], credentials[1], getID());

            logger.info("Subscribing to: " + getID());
            channel = xmppConnection.getChatManager().createChat(getID(), new MessageListener() {

                public void processMessage(Chat chat, Message message) {
                    broadcastReceivedMessage(message.getBody());
                }
            });
View Full Code Here

            String[] credentials = authToken.split(":");

            xmppConnection.login(credentials[0], credentials[1], getID());

            logger.info("Subscribing to: " + getID());
            channel = xmppConnection.getChatManager().createChat(getID(), new MessageListener() {

                public void processMessage(Chat chat, Message message) {
                    broadcastReceivedMessage(message.getBody());
                }
            });
View Full Code Here

        try {
            Chat chat = endpoint.getConnection().getChatManager().getThreadChat(threadId);

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

        try {
            ChatManager chatManager = endpoint.getConnection().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

                presence.setFrom(connection.getUser());
                String toEntity = to + "@vysper.org";
                presence.setTo(toEntity);
                connection.sendPacket(presence);

                chat = connection.getChatManager().createChat(toEntity, new MessageListener() {
                    public void processMessage(Chat inchat, Message message) {
                        System.out.println("log received message: " + message.getBody());
                    }
                });
            }
View Full Code Here

            // 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

            public boolean accept(Packet packet) {
                return true;
            }
        });

        Chat chat = producerCon.getChatManager().createChat("consumer", new MessageListener() {
            public void processMessage(Chat chat, Message message) {
                System.out.println("Got XMPP message from chat " + chat.getParticipant() + " message - " + message.getBody());
            }
        });
View Full Code Here

        producerCon.connect();
        addLoggingListeners("PRODUCER", producerCon);
        producerCon.login("producer", "producer");

        //create the chat and send some messages
        Chat chat = producerCon.getChatManager().createChat("consumer", new MessageListener() {
            public void processMessage(Chat chat, Message message) {
                System.out.println("Got XMPP message from chat " + chat.getParticipant() + " message - " + message.getBody());
            }
        });
       
View Full Code Here

        Chat chat = chatManager.getThreadChat(endpoint.getChatId());
        if (chat == null) {
            if (LOG.isTraceEnabled()) {
                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

TOP

Related Classes of org.jivesoftware.smack.MessageListener

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.