Examples of VCard


Examples of rocks.xmpp.extensions.vcard.temp.model.VCard

                avatar = new byte[0];
                hash = "";
                VCardManager vCardManager = xmppSession.getExtensionManager(VCardManager.class);

                // Load the vCard for that user
                VCard vCard;
                if (contact.equals(xmppSession.getConnectedResource().asBareJid())) {
                    vCard = vCardManager.getVCard();
                } else {
                    vCard = vCardManager.getVCard(contact);
                }
                if (vCard != null) {
                    // And check if it has a photo.
                    VCard.Image image = vCard.getPhoto();
                    if (image != null && image.getValue() != null) {
                        hash = XmppUtils.hash(image.getValue());
                        if (hash != null) {
                            avatar = image.getValue();
                        }
View Full Code Here

Examples of rocks.xmpp.extensions.vcard.temp.model.VCard

     * @param hash   The hash.
     * @throws rocks.xmpp.core.XmppException If an XMPP exception occurs.
     */
    private void publishToVCard(byte[] avatar, String type, String hash) throws XmppException {

        VCard vCard = vCardManager.getVCard();

        if (avatar != null) {
            // Within a given session, a client MUST NOT attempt to upload a given avatar image more than once.
            // The client MAY upload the avatar image to the vCard on login and after that MUST NOT upload the vCard again
            // unless the user actively changes the avatar image.
            if (vCard.getPhoto() == null || !Arrays.equals(vCard.getPhoto().getValue(), avatar)) {
                userHashes.put(xmppSession.getConnectedResource().asBareJid(), hash);
                // If either there is avatar yet, or the old avatar is different from the new one: update
                vCard.setPhoto(new VCard.Image(type, avatar));
                vCardManager.setVCard(vCard);
            }
        } else {
            userHashes.put(xmppSession.getConnectedResource().asBareJid(), "");
            // If there's currently a photo, we want to reset it.
            if (vCard.getPhoto() != null && vCard.getPhoto().getValue() != null) {
                vCard.setPhoto(null);
                vCardManager.setVCard(vCard);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.