Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XMPP Multi user chat setting avatar image for the group chat

I am developing an iOS application with chat features. I am using XMPP for that application. In XMPP Multi user chat, whether any feature is available to set avatar image or group image for the conference room like the one we do in whatsapp?

I have checked XEP-0045 extension but it wasn't helpful,

So I checked with Psi by creating conference rooms, I came to understand that the user has vcard so he can store his avatar image but the XMPP doesn't provide any vcards for the groups we create. Now I possibly understand why its not available.

Yet I can't convince how whatsapp is able to achieve. I have also thought an alternative using pub/sub to send the group image by url. But I'm searching whether any default options provided by XMPP that invisibles to my eyes.

Please conform me whether the feature is available or not in XMPP? OR suggest any different answers you have?

like image 745
Siva Kutti Avatar asked Oct 30 '22 09:10

Siva Kutti


2 Answers

The better solution would be to host an image in some other server , do the upload and get the public path for that image and share as a custom stanza for the group image.

Example

  1. Start uploading image
  2. Get public image path like https://...some url.../groupimage_timestamp.jpg
  3. Share this message as group chat message with following stanza
<message [email protected] to [email protected] type=groupchat id=groupimage-XXXX>
  <body>groupimage</body>
  <metadata>
   <type>groupimage>
   <filesize>..bytes</filesize>
   <imageurl>https://...someurl.../groupimage_timestamp.jpg</imageurl>
  </metadata>
  </message>
  1. Broadcast this message now as normal group message.
  2. Once any receipient get this message he will identify that the group image url everytime you updated is different as the timestamp factory for the file name at end is differnet (if you use image caching)
    1. it will automatically update this image after parsing this stanza.

This is how to my understanding the whatsapp guys also doing.

like image 80
Vicky Dhas Avatar answered Nov 10 '22 19:11

Vicky Dhas


As of 2018, use MUC vCards: set the PHOTO-bearing vCard directly on the chatroom MUC.

https://docs.ejabberd.im/tutorials/muc-vcard/

Refer to XEP-0054 and XEP-0153.

<iq id='set1' type='set' to='[email protected]'> <vCard xmlns='vcard-temp'> <PHOTO> <TYPE>image/png</TYPE> <BINVAL> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3Ccul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