src/net/java/sip/communicator/impl/protocol/jabber/OperationSetServerStoredContactInfoJabberImpl.java
/**
     * Requests all details existing for the specified contact.
     * @param contact the specified contact
     * @return a java.util.Iterator over all details existing for the specified
     * contact.
     */
Requests all details existing for the specified contact.
@param contact the specified contact
@return a java.util.Iterator over all details existing for the specified
contact.
Requests all details existing for the specified contact . @param contact the specified contact @return a java . util . Iterator over all details existing for the specified contact .
public Iterator<GenericDetail> requestAllDetailsForContact(
        final Contact contact, DetailsResponseListener listener)
    {
        if (!(contact instanceof ContactJabberImpl))
        {
            return null;
        }
        List<GenericDetail> res =
            infoRetreiver.getCachedContactDetails(((ContactJabberImpl) contact)
                .getAddressAsJid().asEntityBareJidOrThrow());
        if(res != null)
        {
            return res.iterator();
        }
        synchronized(listenersForDetails)
        {
            List<DetailsResponseListener> ls =
                listenersForDetails.get(contact.getAddress());
            boolean isFirst = false;
            if(ls == null)
            {
                ls = new ArrayList<DetailsResponseListener>();
                isFirst = true;
                listenersForDetails.put(contact.getAddress(), ls);
            }
            if(!ls.contains(listener))
                ls.add(listener);
            if(!isFirst)
                return null;
        }
        new Thread(new Runnable()
        {
            public void run()
            {
                List<GenericDetail> result =
                    infoRetreiver.retrieveDetails(((ContactJabberImpl) contact)
                        .getAddressAsJid()
                        .asEntityBareJidOrThrow());
                List<DetailsResponseListener> listeners;
                synchronized(listenersForDetails)
                {
                    listeners =
                        listenersForDetails.remove(contact.getAddress());
                }
                if(listeners == null || result == null)
                    return;
                for(DetailsResponseListener l : listeners)
                {
                    try
                    {
                        l.detailsRetrieved(result.iterator());
                    }
                    catch(Throwable t)
                    {
                        logger.error(
                            "Error delivering for retrieved details", t);
                    }
                }
            }
        }, getClass().getName() + ".RetrieveDetails").start();
        return null;
    }
public Iterator < GenericDetail > requestAllDetailsForContact ( final Contact contact , DetailsResponseListener listener ) { if ( ! ( contact instanceof ContactJabberImpl ) ) { return null ; } List < GenericDetail > res = infoRetreiver . getCachedContactDetails ( ( ( ContactJabberImpl ) contact ) . getAddressAsJid ( ) . asEntityBareJidOrThrow ( ) ) ; if ( res != null ) { return res . iterator ( ) ; } synchronized ( listenersForDetails ) { List < DetailsResponseListener > ls = listenersForDetails . get ( contact . getAddress ( ) ) ; boolean isFirst = false ; if ( ls == null ) { ls = new ArrayList < DetailsResponseListener > ( ) ; isFirst = true ; listenersForDetails . put ( contact . getAddress ( ) , ls ) ; } if ( ! ls . contains ( listener ) ) ls . add ( listener ) ; if ( ! isFirst ) return null ; } new Thread ( new Runnable ( ) { public void run ( ) { List < GenericDetail > result = infoRetreiver . retrieveDetails ( ( ( ContactJabberImpl ) contact ) . getAddressAsJid ( ) . asEntityBareJidOrThrow ( ) ) ; List < DetailsResponseListener > listeners ; synchronized ( listenersForDetails ) { listeners = listenersForDetails . remove ( contact . getAddress ( ) ) ; } if ( listeners == null || result == null ) return ; for ( DetailsResponseListener l : listeners ) { try { l . detailsRetrieved ( result . iterator ( ) ) ; } catch ( Throwable t ) { logger . error ( "Error delivering for retrieved details" , t ) ; } } } } , getClass ( ) . getName ( ) + ".RetrieveDetails" ) . start ( ) ; return null ; }
Requests all details existing for the specified contact.
Requests all details existing for the specified contact .
// there is already scheduled retrieve, will deliver at listener. // return null as there is no cache and we will try to retrieve