tags:

views:

141

answers:

0

How to open new chat on XMPPFramework? Something like this example:

XMPPConnection.DEBUG_ENABLED = true;

    ConnectionConfiguration config = new ConnectionConfiguration("server.com", 5222);
    config.setCompressionEnabled(false);

    config.setSecurityMode(ConnectionConfiguration.SecurityMode.valueOf("disabled"));
    config.setSASLAuthenticationEnabled(false);
    mConnection = new XMPPConnection(config);

    try {

        mConnection.connect();

        mConnection.login("user", "password", "SomeResource");
    } catch (XMPPException e) {
        System.out.println("XMPP connection error:" + e.getMessage());
    }

    mChatManager = mConnection.getChatManager();
    mChat = mChatManager.createChat("[email protected]", new MessageListener() {

        public void processMessage(Chat chat, Message message) {
            try {
                System.err.println(message.getBody());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

    try {
        mChat.sendMessage(buildLoginMessage());
    } catch (XMPPException e) {
        System.out.println("Error Delivering block");
    }