Search in sources :

Example 1 with Java7SmackInitializer

use of org.jivesoftware.smack.java7.Java7SmackInitializer in project structr by structr.

the class XMPPContext method connect.

public static void connect(final XMPPInfo callback) throws FrameworkException {
    new Java7SmackInitializer().initialize();
    final XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder().setUsernameAndPassword(callback.getUsername(), callback.getPassword()).setSecurityMode(ConnectionConfiguration.SecurityMode.ifpossible).setServiceName(callback.getService()).setHost(callback.getHostName()).setPort(callback.getPort()).build();
    try {
        final AbstractXMPPConnection connection = new XMPPTCPConnection(config);
        connections.put(callback.getUuid(), new StructrXMPPConnection(callback, connection));
        connection.connect();
    } catch (IOException | SmackException | XMPPException ex) {
        logger.warn("", ex);
    }
}
Also used : Java7SmackInitializer(org.jivesoftware.smack.java7.Java7SmackInitializer) XMPPTCPConnection(org.jivesoftware.smack.tcp.XMPPTCPConnection) SmackException(org.jivesoftware.smack.SmackException) XMPPTCPConnectionConfiguration(org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration) IOException(java.io.IOException) XMPPException(org.jivesoftware.smack.XMPPException) AbstractXMPPConnection(org.jivesoftware.smack.AbstractXMPPConnection)

Aggregations

IOException (java.io.IOException)1 AbstractXMPPConnection (org.jivesoftware.smack.AbstractXMPPConnection)1 SmackException (org.jivesoftware.smack.SmackException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 Java7SmackInitializer (org.jivesoftware.smack.java7.Java7SmackInitializer)1 XMPPTCPConnection (org.jivesoftware.smack.tcp.XMPPTCPConnection)1 XMPPTCPConnectionConfiguration (org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration)1