MUC配置错误:找不到指定变量的字段 [英] MUC configuration error : Couldn't find a field for the specified variable

查看:154
本文介绍了MUC配置错误:找不到指定变量的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建类似于whatsapp的群聊.我正在ejabberd服务器上使用MUC服务. 我已经成功创建了组,但无法在组中永久添加成员. 我也尝试过使用发送邀请和加入组,但是当用户离线时它不起作用.离线时会自动将用户从组中删除.

因此,我尝试使用belove代码在组中添加成员,但它给出了错误消息:

找不到指定变量的字段.

这是我的代码:

EntityBareJid mucJid = JidCreate.entityBareFrom("groupname@conference.servicename");

MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(conn);

MultiUserChat muc = manager.getMultiUserChat(mucJid);

Resourcepart nickname = Resourcepart.from("admin");

List<String> owners = new ArrayList<>();
owners.add("user1@servicename");
owners.add("user2@servicename");

muc.create(nickname);
Form form = muc.getConfigurationForm().createAnswerForm();
form.setAnswer("muc#roomconfig_roomowners", owners);
muc.sendConfigurationForm(form);

有人可以帮助我吗?

解决方案

@D G,您无法在组中永久添加成员,XMPP会在连接断开时踢房间用户.

这是我用来解决此问题的方法

在创建组时,使用API​​将组详细信息和组成员保存在服务器上的任何位置,或者从XMPP获取会议室信息,但我建议使用API​​保存组详细信息,因为从XMPP不能获得我们所需的整个会议室详细信息./p>

然后在打开应用程序时创建连接后,向所有组成员发送组邀请,因此,如果任何组成员在线或已连接,他都会加入该组(确保此过程在后台进行).

更多信息,请检查 XEP-0045:多用户聊天

I want to create group chat like whatsapp. i am using MUC service with ejabberd server. I have created group successfully but i unable to add member permanentantly in a group. I have also tried using send invitation and join group but it not work when user is offline. it is autometically remove user from group when it is offline.

So i have tried belove code to add member in a group but it gives error :

Couldn't find a field for the specified variable.

Here is my code :

EntityBareJid mucJid = JidCreate.entityBareFrom("groupname@conference.servicename");

MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(conn);

MultiUserChat muc = manager.getMultiUserChat(mucJid);

Resourcepart nickname = Resourcepart.from("admin");

List<String> owners = new ArrayList<>();
owners.add("user1@servicename");
owners.add("user2@servicename");

muc.create(nickname);
Form form = muc.getConfigurationForm().createAnswerForm();
form.setAnswer("muc#roomconfig_roomowners", owners);
muc.sendConfigurationForm(form);

Can anyone help me ?

解决方案

Hey @D G there is no way add member permanently in a group, XMPP kicks the room user while connection lost.

Here is a way which I'm using for this problem

while you create a group save your group detail and group members anywhere on your Server using API OR get room information from XMPP but I'd recommend save Groups detail using API because from XMPP not getting whole Room details which we need.

Then after while you create a connection while app open send group invitation to all groups members, so if any group member is online or connected he will join the group (make sure this process is in the background).

fro more info check XEP-0045: Multi-User Chat

这篇关于MUC配置错误:找不到指定变量的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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