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(); ... //XML created from the InputStream Document document = reader.read(is); Element vCardElement = document.getRootElement(); log.info("Username: " + username); vcardManager.setVCard(username, vCardElement); ...
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 also 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? It seems to me it is some caching issue, but the question is how can I get the same behaviout in the plugin as I get when avatars are set manually from Jitsi?