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);
}
}
Aggregations