Use avatar image in xmpp and ejabberd

I am creating a text chat application and using Ejabberd server and strophe.js.

I am using mssql as an external database for ejabberd. I transferred all users of the application to the users and freinds table in the usurer table ejabberd.

I want to specify the URL of the profile image as the avatar image of the ejabberd user.

Where to paste avatar url into ejabberd database? I checked the vcard table but didnโ€™t run into the avatar image url?

Is it possible to handle it using the ejabberd database, or is ejabberd managing avatars inside?

If we canโ€™t manage avatars in ejabberd, how can we use it with strophe.js ie sepcify avatar image and get other image avatars images?

Please, help

+4
source share
2 answers

Install VCard Image from URL:

I know the profile picture of the user, and after connecting to the ejabberd server using strophe, I set the profile picture to vcard using the stanza stanza.

The following is an example of setting the image URL in vcard:

iq = $iq({ type: 'set', to: currentUserObj.jabberid+ "@" + CDomain }).c('vCard', { xmlns:'vcard-temp' }).c('PHOTO').c('EXTVAL', currentUserObj.profileImg); connection.sendIQ(iq); 

Hope this helps someone :)

0
source

I believe you can use the ejabberctl command from the command line to load avatar urls into a custom vcard.

 ejabberdctl set_vcard foo chat.myjabber.com PHOTO http://link_to_image.jpg ejabberdctl set_vcard2 foo chat.myjabber.com PHOTO EXTVAL http://link_to_image.jpg 
+3
source

Source: https://habr.com/ru/post/1447146/


All Articles