群聊的XMPP多用户聊天设置头像图像 [英] XMPP Multi user chat setting avatar image for the group chat

查看:225
本文介绍了群聊的XMPP多用户聊天设置头像图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发具有聊天功能的iOS应用程序.我正在为该应用程序使用XMPP.在XMPP多用户聊天中,是否有任何功能可以像我们在whatsapp中所做的那样为会议室设置头像图像或组图像?

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?

我已经检查了 XEP-0045 扩展名,但不是.很有帮助,

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

因此,我通过创建会议室向Psi咨询,我了解到用户拥有vcard,因此他可以存储他的头像图像,但是XMPP不为我们创建的组提供任何vcards.现在我可能理解为什么它不可用.

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.

但是,我不能说服whatsapp能够实现.我还考虑了使用pub/sub通过url发送组图像的替代方法.但是我正在搜索XMPP提供的默认选项是否对我不可见.

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.

请确认我该功能在XMPP中是否可用?还是建议您有其他不同的答案?

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

推荐答案

更好的解决方案是将图像托管在其他服务器上,进行上传并获取该图像的公共路径,并作为自定义节共享.组图像.

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.

示例

  1. 开始上传图片
  2. 获取公共图像路径,例如 https://...some url .../groupimage_timestamp.jpg
  3. 将此消息作为群聊消息与以下节共享
  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 from=abc@muc-light.chat.server.com to mygroup@muc-light.chat.server.com type=groupchat id=groupimage-XXXX>
  <body>groupimage</body>
  <metadata>
   <type>groupimage>
   <filesize>..bytes</filesize>
   <imageurl>https://...someurl.../groupimage_timestamp.jpg</imageurl>
  </metadata>
  </message>

  1. 现在将此消息作为普通组消息广播.
  2. 任何接收者收到此消息后,他都会识别出每次更新时的组图像url是不同的,因为末尾文件名的时间戳工厂是differnet(如果您使用图像缓存)
  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. 它将在解析此节后自动更新该图像.

这是我如何理解whatsapp家伙也在做的事情.

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

这篇关于群聊的XMPP多用户聊天设置头像图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆