Package org.jivesoftware.smack

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


            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


            event.setMessage(message);
            com.valhalla.pluginmanager.PluginChain.fireEvent(event);

            try {
                if (BuddyList.getInstance().checkConnection()) {
                    chat.sendMessage(message);
                } else {
                    BuddyList.getInstance().connectionError();
                }
            } catch (XMPPException e) {
                com.valhalla.Logger.debug("Could not send message: "
View Full Code Here

        groupchat.sendMessage(buf.toString());
      } else {
        Iterator iter = chats.iterator();
        while (iter.hasNext()) {
          Chat chat = (Chat) iter.next();
          chat.sendMessage(buf.toString());
        }
      }

    } catch (Exception e) {
      errorHandler.error("Could not send message in IMAppender [" + name
View Full Code Here

            endpoint.getBinding().populateXmppMessage(message, exchange);
            if (LOG.isDebugEnabled()) {
                LOG.debug(">>>> message: " + message.getBody());
            }

            chat.sendMessage(message);
        } catch (XMPPException e) {
            throw new RuntimeXmppException(e);
        }
    }
View Full Code Here

            endpoint.getBinding().populateXmppMessage(message, exchange);
            if (LOG.isDebugEnabled()) {
                LOG.debug(">>>> message: " + message.getBody());
            }

            chat.sendMessage(message);
        } catch (XMPPException e) {
            throw new RuntimeXmppException(e);
        }
    }
View Full Code Here

            XMPPConnection con = new XMPPConnection("localhost", 61222);
            con.login("amq-user", "amq-pwd");
            Chat chat = con.createChat("test@localhost");
            for (int i = 0; i < 10; i++) {
                System.out.println("Sending message: " + i);
                chat.sendMessage("Hello from Message: " + i);
            }
            System.out.println("Sent all messages!");
        } catch (XMPPException e) {
            if (block) {
                System.out.println("Caught: " + e);
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

                    System.out.println("Got XMPP message from chat " + chat.getParticipant() + " message - " + message.getBody());
                }
            });
            for (int i = 0; i < 10; i++) {
                System.out.println("Sending message: " + i);
                chat.sendMessage("Hello from Message: " + i);
            }
            System.out.println("Sent all messages!");
            con.disconnect();
        } catch (XMPPException e) {
            if (block) {
View Full Code Here

        for (int i = 0; i < 10; i++) {
            System.out.println("Sending message: " + i);
            Message message = new Message("consumer");
            message.setType(Message.Type.chat);
            message.setBody("Hello from producer, message # " + i);
            chat.sendMessage(message);
        }
        System.out.println("Sent all messages!");

        Thread.sleep(sleepTime);
        System.out.println("Consumer received - " + listener.getMessageCount());
View Full Code Here

        for (int i = 0; i < 10; i++) {
            System.out.println("Sending message: " + i);
            Message message = new Message("consumer");
            message.setType(Message.Type.chat);
            message.setBody("Hello from producer, message # " + i);
            chat.sendMessage(message);
        }
      
        //make sure the consumer has time to receive all the messages...
        Thread.sleep(sleepTime);
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.