src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
/**
         * The method is called by a ProtocolProvider implementation whenever
         * a change in the registration state of the corresponding provider had
         * occurred.
         * @param evt ProviderStatusChangeEvent the event describing the status
         * change.
         */
The method is called by a ProtocolProvider implementation whenever
a change in the registration state of the corresponding provider had
occurred.
@param evt ProviderStatusChangeEvent the event describing the status
change.
The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred . @param evt ProviderStatusChangeEvent the event describing the status change .
public void registrationStateChanged(RegistrationStateChangeEvent evt)
        {
            if (logger.isDebugEnabled())
                logger.debug("The Jabber provider changed state from: "
                         + evt.getOldState()
                         + " to: " + evt.getNewState());
            if(evt.getNewState() == RegistrationState.REGISTERING)
            {
                parentProvider.getConnection().addAsyncStanzaListener(
                    new ServerStoredListInit(),
                    new StanzaTypeFilter(RosterPacket.class)
                );
                contactChangesListener = new ContactChangesListener();
                if(subscribtionPacketListener == null)
                {
                    subscribtionPacketListener =
                        new JabberSubscriptionListener();
                    parentProvider
                        .getConnection()
                            .addAsyncStanzaListener(
                                subscribtionPacketListener,
                                new StanzaTypeFilter(Presence.class));
                }
            }
            else if(evt.getNewState() == RegistrationState.REGISTERED)
            {
                JabberAccountIDImpl accountID
                    = (JabberAccountIDImpl)parentProvider.getAccountID();
                boolean isServerStoredInfoEnabled
                    = !accountID.getAccountPropertyBoolean(
                        ProtocolProviderServiceJabberImpl
                            .IS_SERVER_STORED_INFO_DISABLED_PROPERTY, false);
                if (isServerStoredInfoEnabled)
                {
                    createContactPhotoPresenceListener();
                    if(!accountID.isAnonymousAuthUsed())
                    {
                        createAccountPhotoPresenceInterceptor();
                    }
                }
            }
            else if(evt.getNewState() == RegistrationState.UNREGISTERING)
            {
                clearConnectionListeners();
            }
            else if(evt.getNewState() == RegistrationState.UNREGISTERED
                 || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED
                 || evt.getNewState() == RegistrationState.CONNECTION_FAILED)
            {
                PresenceStatus oldStatus = currentStatus;
                currentStatus = parentProvider.getJabberStatusEnum().getStatus(
                    JabberStatusEnum.OFFLINE);
                clearLocalContactResources();
                fireProviderStatusChangeEvent(oldStatus, currentStatus);
                ssContactList.cleanup();
                clearConnectionListeners();
            }
        }
public void registrationStateChanged ( RegistrationStateChangeEvent evt ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "The Jabber provider changed state from: " + evt . getOldState ( ) + " to: " + evt . getNewState ( ) ) ; if ( evt . getNewState ( ) == RegistrationState . REGISTERING ) { parentProvider . getConnection ( ) . addAsyncStanzaListener ( new ServerStoredListInit ( ) , new StanzaTypeFilter ( RosterPacket . class ) ) ; contactChangesListener = new ContactChangesListener ( ) ; if ( subscribtionPacketListener == null ) { subscribtionPacketListener = new JabberSubscriptionListener ( ) ; parentProvider . getConnection ( ) . addAsyncStanzaListener ( subscribtionPacketListener , new StanzaTypeFilter ( Presence . class ) ) ; } } else if ( evt . getNewState ( ) == RegistrationState . REGISTERED ) { JabberAccountIDImpl accountID = ( JabberAccountIDImpl ) parentProvider . getAccountID ( ) ; boolean isServerStoredInfoEnabled = ! accountID . getAccountPropertyBoolean ( ProtocolProviderServiceJabberImpl . IS_SERVER_STORED_INFO_DISABLED_PROPERTY , false ) ; if ( isServerStoredInfoEnabled ) { createContactPhotoPresenceListener ( ) ; if ( ! accountID . isAnonymousAuthUsed ( ) ) { createAccountPhotoPresenceInterceptor ( ) ; } } } else if ( evt . getNewState ( ) == RegistrationState . UNREGISTERING ) { clearConnectionListeners ( ) ; } else if ( evt . getNewState ( ) == RegistrationState . UNREGISTERED || evt . getNewState ( ) == RegistrationState . AUTHENTICATION_FAILED || evt . getNewState ( ) == RegistrationState . CONNECTION_FAILED ) { PresenceStatus oldStatus = currentStatus ; currentStatus = parentProvider . getJabberStatusEnum ( ) . getStatus ( JabberStatusEnum . OFFLINE ) ; clearLocalContactResources ( ) ; fireProviderStatusChangeEvent ( oldStatus , currentStatus ) ; ssContactList . cleanup ( ) ; clearConnectionListeners ( ) ; } }
The method is called by a ProtocolProvider implementation whenever
 a change in the registration state of the corresponding provider had
 occurred.
The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred .
// we will add listener for RosterPackets // as this will indicate when one is received // and we are ready to dispatch the contact list // note that our listener will be added just before the // one used in the Roster itself, but later we // will wait for it to be ready // (inside method XMPPConnection.getRoster()) // will be used to store presence events till roster is // initialized // Adds subscription listener as soon as connection is created // or we can miss some subscription requests // we cannot manipulate our vcards when using anonymous //since we are disconnected, we won't receive any further status //updates so we need to change by ourselves our own status as //well as set to offline all contacts in our contact list that //were online