Refreshing VCards

I developed a VCard plugin with the main purpose of creating/updating and retrieving users’ avatars via HTTP POST and GET requests. Unfortunately, the plugin does not work as expected - VCard changes are propogated into the database (ofVcard table), but neither the user whose userpic was updated nor his buddies see the refreshed image. Here is some piece of code with a lot of ommited details:

...
XMPPServer server = XMPPServer.getInstance();
VCardManager vcardManager = server.getVCardManager(); public void createOrUpdateVcard(String username, String vcard)
                              throws Exception {
                    SAXReader reader = new SAXReader();
                    reader.setValidation(false);
                    // convert String into InputStream
                    InputStream is = new ByteArrayInputStream(vcard.getBytes());
                    // read it with BufferedReader
                    BufferedReader br = new BufferedReader(new InputStreamReader(is));                     try {
                              // Reading malformed XML will lead to DocumentException
                              Document document = reader.read(is);
                              Element vCardElement = document.getRootElement();
                              log.info("Username: " + username);
                              vcardManager.setVCard(username, vCardElement);
                    } catch (DocumentException e) {
                              throw new MalformedXmlException(e);
                    } } ...

When I change avatars directly from the client (we are using Jitsi), the changes are not only immediately stored in the database, but all the buddies get the refreshed image. I see that VCardManager dispatches events internally:

VCardEventDispatcher.dispatchVCardUpdated(username, newvCard);

but they seem not to have any effect.

I cannot figure out what is the difference between the way the setVcard method is called from the handleIQ(IQ packet) in IQvCardHandler and in my own code. What am I missing?

Did I maybe ask the question in the wrong forum thread?

anyone?

“Thanks” to the “vibrant” community for your “intensive” help and “precious” insights. I found the solution myself. Here is the answer: http://stackoverflow.com/questions/11097041/refreshing-vcards-in-openfire

The sarcasm is noted.

For the record, this community is managed by a few part-timers who do not have all the answers to every question asked. If you can find the time to look at the source code or elsewhere to find the answer yourself and contribute it back, then then you are doing your part to support the community and that is appreciated.

Just cut out the unpleasant remarks please.

1 Like

Ok. Do not understand me wrong - I just hit the wall with that problem and there was not a single reply (not even a slightest advice in which direction to look) in this thread for 3 weeks until I switched on my sacracs. And here is the first answer in this thread - yours. I am glad, that I finally found the solution - it’s detailed description is on StackOverflow. If you want, I can post it here as well. Apart from the disturbing silence in the forum I must say that I really like your project - OpenFire works nicely. Thank you for your effort!