src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
/**
     * Parses a contact presence packet with the element name "x" and the
     * namespace "vcard-temp:x:update", in order to decide if the SHA-1 avatar
     * contained in the photo tag represents a new avatar for this contact.
     *
     * @param packet The packet received to parse.
     */
Parses a contact presence packet with the element name "x" and the
namespace "vcard-temp:x:update", in order to decide if the SHA-1 avatar
contained in the photo tag represents a new avatar for this contact.

@param packet The packet received to parse.
Parses a contact presence packet with the element name " x " and the namespace " vcard - temp : x : update " in order to decide if the SHA - 1 avatar contained in the photo tag represents a new avatar for this contact . @param packet The packet received to parse .
public void parseContactPhotoPresence(Stanza packet)
    {
        EntityBareJid userID = packet.getFrom().asEntityBareJidOrThrow();
        ContactJabberImpl sourceContact
            = ssContactList.findContactById(userID);
        if(sourceContact == null)
        {
            return;
        }
        byte[] currentAvatar = sourceContact.getImage(false);
        StandardExtensionElement defaultPacketExtension =
            packet.getExtension(
                    VCardTempXUpdatePresenceExtension.ELEMENT_NAME,
                    VCardTempXUpdatePresenceExtension.NAMESPACE);
        if(defaultPacketExtension == null)
        {
            return;
        }
        try
        {
            StandardExtensionElement photoElement
                = defaultPacketExtension.getFirstElement("photo");
            if (photoElement == null)
            {
                return;
            }
            String packetPhotoSHA1 = photoElement.getText();
            if(packetPhotoSHA1 != null
                    && !packetPhotoSHA1.equals(
                        VCardTempXUpdatePresenceExtension.getImageSha1(
                            currentAvatar))
              )
            {
                byte[] newAvatar = null;
                if(packetPhotoSHA1.length() != 0)
                {
                    VCardManager manager = VCardManager.getInstanceFor(
                        parentProvider.getConnection());
                    VCard vCard = manager.loadVCard(userID);
                    newAvatar = vCard.getAvatar();
                }
                else
                {
                    newAvatar = new byte[0];
                }
                sourceContact.setImage(newAvatar);
                this.fireContactPropertyChangeEvent(
                    ContactPropertyChangeEvent.PROPERTY_IMAGE,
                    sourceContact,
                    currentAvatar,
                    newAvatar);
            }
        }
        catch(XMPPException
            | InterruptedException
            | NotConnectedException
            | NoResponseException ex)
        {
            logger.info("Cannot retrieve vCard from: " + packet.getFrom());
            if(logger.isTraceEnabled())
                logger.trace("vCard retrieval exception was: ", ex);
        }
    }
public void parseContactPhotoPresence ( Stanza packet ) { EntityBareJid userID = packet . getFrom ( ) . asEntityBareJidOrThrow ( ) ; ContactJabberImpl sourceContact = ssContactList . findContactById ( userID ) ; if ( sourceContact == null ) { return ; } byte [ ] currentAvatar = sourceContact . getImage ( false ) ; StandardExtensionElement defaultPacketExtension = packet . getExtension ( VCardTempXUpdatePresenceExtension . ELEMENT_NAME , VCardTempXUpdatePresenceExtension . NAMESPACE ) ; if ( defaultPacketExtension == null ) { return ; } try { StandardExtensionElement photoElement = defaultPacketExtension . getFirstElement ( "photo" ) ; if ( photoElement == null ) { return ; } String packetPhotoSHA1 = photoElement . getText ( ) ; if ( packetPhotoSHA1 != null && ! packetPhotoSHA1 . equals ( VCardTempXUpdatePresenceExtension . getImageSha1 ( currentAvatar ) ) ) { byte [ ] newAvatar = null ; if ( packetPhotoSHA1 . length ( ) != 0 ) { VCardManager manager = VCardManager . getInstanceFor ( parentProvider . getConnection ( ) ) ; VCard vCard = manager . loadVCard ( userID ) ; newAvatar = vCard . getAvatar ( ) ; } else { newAvatar = new byte [ 0 ] ; } sourceContact . setImage ( newAvatar ) ; this . fireContactPropertyChangeEvent ( ContactPropertyChangeEvent . PROPERTY_IMAGE , sourceContact , currentAvatar , newAvatar ) ; } } catch ( XMPPException | InterruptedException | NotConnectedException | NoResponseException ex ) { logger . info ( "Cannot retrieve vCard from: " + packet . getFrom ( ) ) ; if ( logger . isTraceEnabled ( ) ) logger . trace ( "vCard retrieval exception was: " , ex ) ; } }
Parses a contact presence packet with the element name "x" and the
 namespace "vcard-temp:x:update", in order to decide if the SHA-1 avatar
 contained in the photo tag represents a new avatar for this contact.
Parses a contact presence packet with the element name " x " and the namespace " vcard - temp : x : update " in order to decide if the SHA - 1 avatar contained in the photo tag represents a new avatar for this contact .
// Retrieves the contact ID and its avatar that Jitsi currently // managed concerning the peer that has send this presence packet. // If this contact is not yet in our contact list, then there is no need // to manage this photo update. // Get the packet extension which contains the photo tag. // If this presence packet has a photo tag with a SHA-1 hash // which differs from the current avatar SHA-1 hash, then Jitsi // retrieves the new avatar image and updates this contact image // in the contact list. // If there is an avatar image, retrieves it. // Retrieves the new contact avatar image. // Else removes the current avatar image, since the contact // has removed it from the server. // Sets the new avatar image to the Jitsi contact. // Fires a property change event to update the contact list.