在openfire服务器中创建聊天室的问题

发布于 2024-12-02 03:20:50 字数 83 浏览 1 评论 0原文

当我尝试在多用户聊天 (MUC) 中创建房间时,服务器响应“此房间已被锁定,无法进入,直到确认配置”。我怎样才能克服这个问题?

提前致谢

When I try to create a room in Multi User Chat (MUC) the server responds 'This room is locked from entry until configuration is confirmed'. How can I overcome this?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧伤慢歌 2024-12-09 03:20:50

您需要发送房间的配置表单。如果您使用 smack,代码将如下所示:

Form submitForm = multiUserChat.getConfigurationForm().createAnswerForm();
submitForm.setAnswer("muc#roomconfig_publicroom", false);
submitForm.setAnswer("muc#roomconfig_roomname", room);
multiUserChat.sendConfigurationForm(submitForm);

You need to send a configuration form for the room. If you are using smack the code would look something like this:

Form submitForm = multiUserChat.getConfigurationForm().createAnswerForm();
submitForm.setAnswer("muc#roomconfig_publicroom", false);
submitForm.setAnswer("muc#roomconfig_roomname", room);
multiUserChat.sendConfigurationForm(submitForm);
潦草背影 2024-12-09 03:20:50

我在使用 Candy Chat 1.7.1 和 Openfire 3.9.3 时遇到了这个问题。

这花了我一段时间才解决,但在阅读了多用户聊天规范后:
http://xmpp.org/extensions/xep-0045.html#createroom

我最终解决了这个问题;首先是 Strope,然后从中找到了 Candy 方式。

因此,回答您的问题:

在 Strope

通过发送存在(规范中的示例 153)创建房间后,

我发送了以下内容(按照规范中的示例 155)

conn.sendIQ($iq({
    type: "set",
    to: escapedRoomId,
    from: me.getEscapedJid(),
    id: "create:" + conn.getUniqueId()
}).c("query", {
    xmlns: "http://jabber.org/protocol/muc#owner"
}).c("x", {
    xmlns: "jabber:x:data",
    type: "submit"
}));

,其中 conn 是 Strope.Connection

然后以帮助可能有相同情况的其他人Candy Chat 中的问题:

在 Candy Chat 中

在 candy libs 包中搜索上面的 Strope 消息的位后,我发现了这个:

createInstantRoom: function(room, success_cb, error_cb) {
    var roomiq;
    roomiq = $iq({
        to: room,
        type: "set"
    }).c("query", {
        xmlns: Strophe.NS.MUC_OWNER
    }).c("x", {
        xmlns: "jabber:x:data",
        type: "submit"
    });
    return this._connection.sendIQ(roomiq.tree(), success_cb, error_cb);
},

那么这在 Candy Chat 中解决了这个问题。

$(Candy).on('candy:view.room.after-add', function(evt, args) {
    Candy.Core.getConnection().muc.createInstantRoom(Candy.Util.escapeJid(args.roomJid));
});

当你知道如何做时,事情就变得简单得令人恼火。顺便说一句,我认为该方法应该称为configureAsInstantRoom,并且Candy chat应该在init方法或类似方法上有一个选项。

I was having this problem using Candy Chat 1.7.1 with Openfire 3.9.3.

This took me a while to work out, but after reading through the Multi-User Chat spec:
http://xmpp.org/extensions/xep-0045.html#createroom

I eventually solved it; first with Strophe, then from that found the Candy way.

So to answer your question:

In Strophe

After creating the room by sending the presence (Example 153 in spec)

I sent the below (as per Example 155 in spec)

conn.sendIQ($iq({
    type: "set",
    to: escapedRoomId,
    from: me.getEscapedJid(),
    id: "create:" + conn.getUniqueId()
}).c("query", {
    xmlns: "http://jabber.org/protocol/muc#owner"
}).c("x", {
    xmlns: "jabber:x:data",
    type: "submit"
}));

where conn is the Strophe.Connection

Then to help others who may have the same problem in Candy Chat:

In Candy Chat

After searching for bits of the Strophe message above in the candy libs bundle I found this:

createInstantRoom: function(room, success_cb, error_cb) {
    var roomiq;
    roomiq = $iq({
        to: room,
        type: "set"
    }).c("query", {
        xmlns: Strophe.NS.MUC_OWNER
    }).c("x", {
        xmlns: "jabber:x:data",
        type: "submit"
    });
    return this._connection.sendIQ(roomiq.tree(), success_cb, error_cb);
},

So then this solves it in Candy Chat.

$(Candy).on('candy:view.room.after-add', function(evt, args) {
    Candy.Core.getConnection().muc.createInstantRoom(Candy.Util.escapeJid(args.roomJid));
});

Irritatingly simple when you know how. Incidentally I think the method should be called configureAsInstantRoom and Candy chat should have an option for this on the init method or similar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文