powered by Jive Software

How to get roster entry detail info

Hi, I have met a problem like this:

//Add the IQ provider
  ProviderManager.addIQProvider("vCard", "vcard-temp", VCardProvider())
//login 
.....
//load the vcard
  val vCardManager = VCardManager.getInstanceFor(connection)
  val vCard = vCardManager.loadVCard(JidCreate.entityBareFrom("test2@case01"))

and then server return iq as below:

D/SMACK: SENT (0): <iq to='test2@case01' id='8eN65-12' type='get'><vCard xmlns='vcard-temp'/></iq>
D/SMACK: RECV (0): <iq type="result" id="8eN65-12" from="test2@case01" to="test1@case01/Android"><vCard xmlns="vcard-temp"/></iq>

So I cannot get any other info (phone, email, name…) in the vcard, what should I do to get the detail info about the target user?

From what I can tell, the server most likely doesn’t have any VCard info for that user and is therefore responding with an empty VCard element. This is behavior as specified in XEP-0054: vcard-temp in example 4.

Make sure that the user “test2@case01” has published some VCard information to the server.

Hi Sir,

Yes, I can get the VCard information if they are created by Spark, the Spark will publish the VCard information to the server. But all users I created on the openfire management web page. So I cannot get the details for these users.

Because there is no info then :slight_smile:
You first have to publish VCard information before you can retrieve them. If you expect Openfire to publish VCard information for users created through the admin page, you should ask in the Openfire support forum if there is a way to accomplish that.

OK, I know the reason now. But another question roster entry can only get the nickname which I set it for the user.

If I want to get the realname, and it will be changed by the target user modified automatically, What should I do to implement it? Could you give me some suggestion, thanks a lot.

Maybe I can get the realname by search it again, but if I hava hundreds of friends, I need to search hundreds times, it is so terrible

I’m not sure if I understand you correctly, but afaik it is not possible to listen for VCard changes, as those are not announced by the server.

You could probably write an Openfire plugin which implements a custom RosterItemProvider which returns RosterItems whose name is not read from the Roster table, but from the user table.

If the user’s name changes, it’s reflected in the roster (after Roster cache expires after 30 min).

Disadvantage: Nobody can chose custom nicknames for their roster items, every user has the same names of their contacts in their roster.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.