src/net/java/sip/communicator/impl/protocol/jabber/MobileIndicator.java
/**
     * Update mobile indicator for contact, searching in contact caps.
     * @param user the contact address with or without resource.
     */
Update mobile indicator for contact, searching in contact caps.
@param user the contact address with or without resource.
Update mobile indicator for contact searching in contact caps . @param user the contact address with or without resource .
private void updateMobileIndicatorUsingCaps(Jid user)
    {
        ContactJabberImpl contact =
            ssclCallback.findContactById(user.asBareJid());
        if(contact == null)
            return;
        int currentMostConnectedStatus = 0;
        List<ContactResource> mostAvailableResources =
            new ArrayList<>();
        for(Map.Entry<FullJid, ContactResourceJabberImpl> resEntry
                : contact.getResourcesMap().entrySet())
        {
            ContactResourceJabberImpl res = resEntry.getValue();
            if(!res.getPresenceStatus().isOnline())
                continue;
            boolean oldIndicator = res.isMobile();
            res.setMobile(isMobileResource(res.getFullJid()));
            if(oldIndicator != res.isMobile())
            {
                contact.fireContactResourceEvent(
                    new ContactResourceEvent(
                        contact, res, ContactResourceEvent.RESOURCE_MODIFIED));
            }
            int status = res.getPresenceStatus().getStatus();
            if(status > currentMostConnectedStatus)
            {
                if(currentMostConnectedStatus != status)
                    mostAvailableResources.clear();
                currentMostConnectedStatus = status;
                mostAvailableResources.add(res);
            }
        }
        updateContactMobileStatus(contact, mostAvailableResources);
    }
private void updateMobileIndicatorUsingCaps ( Jid user ) { ContactJabberImpl contact = ssclCallback . findContactById ( user . asBareJid ( ) ) ; if ( contact == null ) return ; int currentMostConnectedStatus = 0 ; List < ContactResource > mostAvailableResources = new ArrayList < > ( ) ; for ( Map . Entry < FullJid , ContactResourceJabberImpl > resEntry : contact . getResourcesMap ( ) . entrySet ( ) ) { ContactResourceJabberImpl res = resEntry . getValue ( ) ; if ( ! res . getPresenceStatus ( ) . isOnline ( ) ) continue ; boolean oldIndicator = res . isMobile ( ) ; res . setMobile ( isMobileResource ( res . getFullJid ( ) ) ) ; if ( oldIndicator != res . isMobile ( ) ) { contact . fireContactResourceEvent ( new ContactResourceEvent ( contact , res , ContactResourceEvent . RESOURCE_MODIFIED ) ) ; } int status = res . getPresenceStatus ( ) . getStatus ( ) ; if ( status > currentMostConnectedStatus ) { if ( currentMostConnectedStatus != status ) mostAvailableResources . clear ( ) ; currentMostConnectedStatus = status ; mostAvailableResources . add ( res ) ; } } updateContactMobileStatus ( contact , mostAvailableResources ) ; }
Update mobile indicator for contact, searching in contact caps.
Update mobile indicator for contact searching in contact caps .
// 1. Find most connected resources and if all are mobile // update the mobile indicator of connected resource, // as caps have been updated