void loginImpl() throws FriendException {
   synchronized (this) {
     try {
       loggingIn.set(true);
       connectionMulticaster.broadcast(
           new FriendConnectionEvent(this, FriendConnectionEvent.Type.CONNECTING));
       org.jivesoftware.smack.XMPPConnection.addConnectionCreationListener(
           smackConnectionListener);
       org.jivesoftware.smack.XMPPConnection.DEBUG_ENABLED = configuration.isDebugEnabled();
       connect();
       LOG.infof("connected.");
       LOG.infof(
           "logging in {0} with resource: {1} ...",
           configuration.getUserInputLocalID(), configuration.getResource());
       connection.login(
           configuration.getUserInputLocalID(),
           configuration.getPassword(),
           configuration.getResource());
       LOG.infof("logged in.");
       loggedIn.set(true);
       loggingIn.set(false);
       connectionMulticaster.broadcast(
           new FriendConnectionEvent(this, FriendConnectionEvent.Type.CONNECTED));
     } catch (org.jivesoftware.smack.XMPPException e) {
       handleLoginError(e);
       throw new FriendException(e);
     } catch (RuntimeException e) {
       handleLoginError(e);
       throw e;
     }
   }
 }
 // Enable the XHTML support on every established connection
 // The ServiceDiscoveryManager class should have been already initialized
 static {
   XMPPConnection.addConnectionCreationListener(
       new ConnectionCreationListener() {
         public void connectionCreated(XMPPConnection connection) {
           XHTMLManager.setServiceEnabled(connection, true);
         }
       });
 }
 // Enable the LastActivity support on every established connection
 static {
   XMPPConnection.addConnectionCreationListener(
       new ConnectionCreationListener() {
         public void connectionCreated(XMPPConnection connection) {
           new LastActivityManager(connection);
         }
       });
 }
 // Create a new ServiceDiscoveryManager on every established connection
 static {
   XMPPConnection.addConnectionCreationListener(
       new ConnectionCreationListener() {
         public void connectionCreated(XMPPConnection connection) {
           new ServiceDiscoveryManager(connection);
         }
       });
 }
Esempio n. 5
0
 // Create a new ServiceDiscoveryManager on every established connection
 static {
   // Add service discovery for normal XMPP c2s connections
   XMPPConnection.addConnectionCreationListener(
       new ConnectionCreationListener() {
         public void connectionCreated(Connection connection) {
           new ServiceDiscoveryManager(connection);
         }
       });
 }