简体   繁体   中英

Smack API 4.1.2 getting Chat Manager

I'm trying to make an im client using OpenFire with help of smack's own documentation. . I established a connection but there is not a getChatManager() method. Here is my code;

 public static void main(String[] args) {
        try{
            XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
            configBuilder.setUsernameAndPassword("admin", "cagdas1993");
            configBuilder.setServiceName("service1");
            configBuilder.setHost("localhost");
            configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
            configBuilder.setPort(5222);


            AbstractXMPPConnection connection = new XMPPTCPConnection(configBuilder.build());
            connection.connect();
            connection.login();

            ChatManager chat=connection.getChatManager();//Can't find the method here!

        }catch(Exception e){
        e.printStackTrace();
        }
}

I know it must be very easy but couldn't find anything. And if you could give some other example for further it would be great.

Use

ChatManager chatManager = ChatManager.getInstanceFor(connection);

starting with Smack 4.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM