[jdev] Retrieving the name of message sending and message receiving user

Goffi goffi at goffi.org
Thu Jun 8 05:43:03 UTC 2017


Le jeudi 18 mai 2017, 11:44:17 CEST Abhishek Ranjan a écrit :
> Hello,
> 
> I am new to xmpp and I wanted to extract the names of the user who is
> sending the message and the name of the user to whom he is sending the
> message from the message stanza.
> 
> I have been using
> 
> A=Packet#message.from.
> 
> which gives me the complete jid tuple(I am using erlang programming
> language).
> 
> Can anyone tell me how can I get just the names of the people who are
> sending and receiving messages from the message stanza alone.
> 
> Regards,
> 
> Abhishek


Hi,

Only the addressee and recipient jids are available in the stanza itself, if 
you want a human readable name, you'll need a bit more.

You can either use the roster name, which is the user supplied name (not the 
contact), if filled, or an extension like VCard (vCard4, XEP-0292, should be 
preferred, but vcard-tmp, XEP-0054, is surely more widespread) to get contact 
provided name/nickname.

Goffi


More information about the JDev mailing list