src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java
/**
     * Load VCard for the given user.
     * Using the specified timeout.
     *
     * @param vcard VCard
     * @param connection XMPP connection
     * @param user the user
     * @param timeout timeout in second
     * @throws XMPPException if something went wrong during VCard loading
     */
Load VCard for the given user.
Using the specified timeout.


Load VCard for the given user . Using the specified timeout .
public void load(VCard vcard,
                     XMPPConnection connection,
                     EntityBareJid user,
                     long timeout)
        throws XMPPException, NotConnectedException, InterruptedException,
               OperationFailedException
    {
        vcard.setTo(user);
        vcard.setType(IQ.Type.get);
        VCard result = null;
        try
        {
            StanzaCollector collector
                = connection.createStanzaCollectorAndSend(vcard);
            try
            {
                result = collector.nextResultOrThrow(timeout);
            }
            finally
            {
                collector.cancel();
            }
        }
        catch (ClassCastException e)
        {
            logger.error("No vcard for " + user);
        }
        catch (NoResponseException e)
        {
            throw new OperationFailedException(
                "Timeout getting VCard information",
                OperationFailedException.GENERAL_ERROR
            );
        }
        Field[] fields = VCard.class.getDeclaredFields();
        for (Field field : fields)
        {
            if (field.getDeclaringClass() == VCard.class &&
                    !Modifier.isFinal(field.getModifiers()))
            {
                try
                {
                    field.setAccessible(true);
                    field.set(vcard, field.get(result));
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException("Cannot set field:" + field, e);
                }
            }
        }
    }
public void load ( VCard vcard , XMPPConnection connection , EntityBareJid user , long timeout ) throws XMPPException , NotConnectedException , InterruptedException , OperationFailedException { vcard . setTo ( user ) ; vcard . setType ( IQ . Type . get ) ; VCard result = null ; try { StanzaCollector collector = connection . createStanzaCollectorAndSend ( vcard ) ; try { result = collector . nextResultOrThrow ( timeout ) ; } finally { collector . cancel ( ) ; } } catch ( ClassCastException e ) { logger . error ( "No vcard for " + user ) ; } catch ( NoResponseException e ) { throw new OperationFailedException ( "Timeout getting VCard information" , OperationFailedException . GENERAL_ERROR ) ; } Field [ ] fields = VCard . class . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( field . getDeclaringClass ( ) == VCard . class && ! Modifier . isFinal ( field . getModifiers ( ) ) ) { try { field . setAccessible ( true ) ; field . set ( vcard , field . get ( result ) ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( "Cannot set field:" + field , e ) ; } } } }
Load VCard for the given user.
Load VCard for the given user .
// copy loaded vcard fields in the supplied one.