src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
/**
         * Process packets.
         * @param packet packet received to be processed
         */
Process packets.
@param packet packet received to be processed
Process packets . @param packet packet received to be processed
@Override
        public void processStanza(Stanza packet)
        {
            Presence presence = (Presence) packet;
            if (presence == null)
                return;
            Presence.Type presenceType = presence.getType();
            final Jid fromID = presence.getFrom();
            if (presenceType == Presence.Type.subscribe)
            {
                String displayName = null;
                Nick ext = (Nick) presence.getExtension(Nick.NAMESPACE);
                if(ext != null)
                    displayName = ext.getName();
                synchronized(this)
                {
                    if(handler == null)
                    {
                        earlySubscriptions.put(fromID, displayName);
                        return;
                    }
                }
                handleSubscribeReceived(fromID, displayName);
            }
            else if (presenceType == Presence.Type.unsubscribed)
            {
                if (logger.isTraceEnabled())
                    logger.trace(fromID + " does not allow your subscription");
                if(handler == null)
                {
                    logger.warn(
                        "No to handle unsubscribed AuthorizationHandler for "
                            + fromID);
                    return;
                }
                ContactJabberImpl contact
                    = ssContactList.findContactById(fromID);
                if(contact != null)
                {
                    AuthorizationResponse response
                        = new AuthorizationResponse(
                                AuthorizationResponse.REJECT,
                                "");
                    handler.processAuthorizationResponse(response, contact);
                    try{
                        ssContactList.removeContact(contact);
                    }
                    catch(OperationFailedException e)
                    {
                        logger.error(
                                "Cannot remove contact that unsubscribed.");
                    }
                }
            }
            else if (presenceType == Presence.Type.subscribed)
            {
                if(handler == null)
                {
                    logger.warn(
                        "No AuthorizationHandler to handle subscribed for "
                            + fromID);
                    return;
                }
                ContactJabberImpl contact
                    = ssContactList.findContactById(fromID);
                AuthorizationResponse response
                    = new AuthorizationResponse(
                            AuthorizationResponse.ACCEPT,
                            "");
                handler.processAuthorizationResponse(response, contact);
            }
            else if (presenceType == Presence.Type.available
                    && contactChangesListener != null
                    && contactChangesListener.isStoringPresenceEvents())
            {
                contactChangesListener.addPresenceEvent(presence);
            }
        }
@ Override public void processStanza ( Stanza packet ) { Presence presence = ( Presence ) packet ; if ( presence == null ) return ; Presence . Type presenceType = presence . getType ( ) ; final Jid fromID = presence . getFrom ( ) ; if ( presenceType == Presence . Type . subscribe ) { String displayName = null ; Nick ext = ( Nick ) presence . getExtension ( Nick . NAMESPACE ) ; if ( ext != null ) displayName = ext . getName ( ) ; synchronized ( this ) { if ( handler == null ) { earlySubscriptions . put ( fromID , displayName ) ; return ; } } handleSubscribeReceived ( fromID , displayName ) ; } else if ( presenceType == Presence . Type . unsubscribed ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( fromID + " does not allow your subscription" ) ; if ( handler == null ) { logger . warn ( "No to handle unsubscribed AuthorizationHandler for " + fromID ) ; return ; } ContactJabberImpl contact = ssContactList . findContactById ( fromID ) ; if ( contact != null ) { AuthorizationResponse response = new AuthorizationResponse ( AuthorizationResponse . REJECT , "" ) ; handler . processAuthorizationResponse ( response , contact ) ; try { ssContactList . removeContact ( contact ) ; } catch ( OperationFailedException e ) { logger . error ( "Cannot remove contact that unsubscribed." ) ; } } } else if ( presenceType == Presence . Type . subscribed ) { if ( handler == null ) { logger . warn ( "No AuthorizationHandler to handle subscribed for " + fromID ) ; return ; } ContactJabberImpl contact = ssContactList . findContactById ( fromID ) ; AuthorizationResponse response = new AuthorizationResponse ( AuthorizationResponse . ACCEPT , "" ) ; handler . processAuthorizationResponse ( response , contact ) ; } else if ( presenceType == Presence . Type . available && contactChangesListener != null && contactChangesListener . isStoringPresenceEvents ( ) ) { contactChangesListener . addPresenceEvent ( presence ) ; } }
Process packets.
Process packets .
// nothing to handle