4

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

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

I want to specify the profile image url of application as a avatar image of ejabberd user.

Where to insert the avatar URL in ejabberd database ? I checked vcard table but no column for avatar image url ?

Can we handle it using the ejabberd database or ejabberd is managing avatars internally ?

If we can't manage the avatars in ejabberd than how can we use it with strophe.js i.e. sepcify the avatar image and receive other roster items avatar image ?

Please help

Rohit Tailor
  • 131
  • 1
  • 11

2 Answers2

3

I believe you can use the command ejabberctl from the command line to load avatar URLs into a user's 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
slm
  • 15,396
  • 12
  • 109
  • 124
  • Thanks slm. Actually i am creating the chat in web app and do not want to build a module to call command line utility from external php or other script. – Rohit Tailor Feb 08 '13 at 09:07
0

Set VCard Image from URL:

I know the profile image of user and after making the connection to the ejabberd server using strophe i am setting profile image in vcard using the strophe stanza.

Below is example of setting the image url in the vcard:

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

connection.sendIQ(iq);

Hope it'll help someone :)

Rohit Tailor
  • 131
  • 1
  • 11
  • Does this really work? I was looking at the spec (http://xmpp.org/extensions/xep-0153.html) and it seemed clear that you weren't supposed to use EXTVAL in that context. To quote 4.5.2: "The element SHOULD NOT contain an that points to a URI for the image file." – drewww Mar 22 '13 at 20:56
  • Yes its working for us in web app. On mobile apps we are using another mechanism. – Rohit Tailor Apr 23 '13 at 09:07
  • @RohitTailor Thanks for the answer. Would like to know what is 'currentUserObj.profileImg' in your code, is it a file url of file upload or base64 string? – redV Jan 18 '14 at 15:36
  • currentUserObj.profileImg is the URL of image (Amazon S3 URL). Sorry for delay in response. – Rohit Tailor May 06 '14 at 11:46
  • Hello @RohitTailor Can you please let me know which mechanism you have used for mobile app? Because I have suffering for same problem in mobile app. – Chirag Solanki Jun 09 '18 at 05:45
  • Hi @ChiragSolankI I have used XMPPFramework https://github.com/robbiehanson/XMPPFramework for IOS app. – Rohit Tailor Jun 27 '18 at 10:48