我正在使用以下代码加入现有的 MUC 房间:
XMPPRoomMemoryStorage *roomStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPJID *roomJID = [XMPPJID jidWithString:@"[email protected] /cdn-cgi/l/email-protection"];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomStorage
jid:roomJID
dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:[self appDelegate].xmppStream];
[xmppRoom addDelegate:self
delegateQueue:dispatch_get_main_queue()];
[xmppRoom joinRoomUsingNickname:[self appDelegate].xmppStream.myJID.user
history:nil
password:nil];
XMPPMUC * xmppMUC = [[XMPPMUC alloc] initWithDispatchQueue:dispatch_get_main_queue()];
[xmppMUC activate:[self appDelegate].xmppStream];
[xmppMUC addDelegate:self delegateQueue:dispatch_get_main_queue()];
在用户加入房间后,我尝试将其权限更改为所有者,而不使用创建房间的用户(实际所有者帐户):
- (void)xmppRoomDidJoin:(XMPPRoom *)sender {
// ADD USERS TO OWNERS LIST
[xmppRoom editRoomPrivileges:@[[XMPPRoom itemWithAffiliation:@"owner" jid:[XMPPJID jidWithString:[self appDelegate].xmppStream.myJID.user]]]];
}
我收到错误,我不确定它是否相关:
RECV: <iq xmlns="jabber:client" type="error"
id="64BBA616-56D7-4CB1-AC07-CBEA4C37E98C"
from="[email protected] /cdn-cgi/l/email-protection"
to="newuser236@administrator/26ee7a3d">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="member" jid="newuser236"/>
</query>
<error code="403" type="auth">
<forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
并且该用户不会添加到 Openfire 中的所有者列表中。
我还想补充一下我设置的:
publicRoom : 1
moderated : 0
membersOnly : 0
canInvite : 1
roomPassword : nil
canRegister : 1
canDiscoverJID : 1
logEnabled : 1
关于如何将刚刚加入房间的用户添加到所有者列表中,有什么建议吗?还有我为什么会收到错误的任何想法?
由于我无法使用 xmpp 库,所以我使用 PHP 创建了功能,所以问题没有解决,但使用 PHP 编码和 DB 你可以解决它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)