VCard listener?

Hello,

There is a way to listen for VCard changes from contacts on the user’s roster ?

Thanks for the help!

nobody?

up

//+++++++++++++++++ Avatar +++++++++++++++++++++++++++++++++++

    public static VCard getVCard(XMPPConnection connection, String myJID)
    {       
        VCard vCard = new VCard();
   
        try
        {                              
            if (myJID == null)
                vCard.load(connection);
            else vCard.load(connection, myJID);
       
            // If VCard is loaded, then save the avatar to the personal folder.
            byte[] bytes = vCard.getAvatar();
       
            try
            {               
                if(bytes!=null)
                {
                    InputStream in = new ByteArrayInputStream(bytes);
                    BufferedImage bi = javax.imageio.ImageIO.read(in);
                    File outputfile = new File("C://Avatar.jpg");
                    ImageIO.write(bi, "jpg", outputfile);
                }
            }
            catch (IOException e)
            {
                System.out.println(e);
            }
                   
        }
        catch (XMPPException ex)
        {
            ex.printStackTrace();
        }
   
        return vCard;
    }
    //    +++++++++++++++++ Avatar +++++++++++++++++++++++++++++++++++ //

Hello,

I know how to read the VCard. What I need is a way to monitore changes to contact’s VCard. Example : contact change his nickname, I want to update my Roster view to set the new contact’s nickname.

Thanks.

Hello Ohmer,

have you finally found any answer? I want to do the same…

No I didn’t find any way to do that in a “standard” way. My IM app is only used internally and all clients on the server is using the same app. So I can do non-standard things when there is no way to do it clean. I send a custom presence packet to tell to other contacts to retrieve the new vcard.

Ho, you seem to answer my second question… So, it’s not a problem about Smack. It’s not in the protocol definition. That’s a shame!

I shouldn’t use your solution since my app aim to be interoperable. Unless most clients will simply ignore unknown presence packets… I don’t know.

anyway, thank you!

I’m not sure if this is a problem with smack or the protocol but nobody seem to know because nobody answered my question