powered by Jive Software

How to obtain vCard from a JID

I am writing a fallback email plugin that sends an email to the destination user if an email address is specified for them. I know it doesn’t really make sense, but that’s what the users at my company want. Currently I am doing this:

to_username = to_jid.getNode();
user_manager.getUser(to_username);
to_email_addr = to_user_obj.getEmail();

However, this will not work in a federated environment witn non-local JIDs. Is there an api call to turn a JID into a vCard?

Hi

I don’t know about the VCARD, but why do you want to use that one for obtaining the user mail? We are using the mail from the user properties. A code sample how to obtain the mail from there is in the user import/export plugin.

The VCARD is something a user can change easily to be non valid. If the mail in the user property is wrong, you can at least blame the Openfire admin (that’s me in my company :smiley: ). We have written a user registration, that validated the user mail during user creation and (!) we have recreated any user that has an invalid e-mail adress and forced them to a standard JID. E.g.The user with the mail john.doe@mycompany.com has the JID john.doe@jabber.internal.mycompany.com.This has proven to be a very helpful decision, as it allows me to revalidate the user base by mapping them to the global mail directory.

Walter

That works well in a non federated case, where all communication occurs

through a single server, but I’m operating in a federated case where the

vCard is most likely stored on a remote server. That’s why I’m asking if

there is a federated implementation of vcard, as I think the user object is

tied to the local server. Correct me if I’m wrong