参考此我正在实施群聊配置。
XMPPFramework - Implement Group Chat (MUC)
然而,作为参与者而非主持人,我无法获得会员列表。我尝试读取多个堆栈的答案,要求实现'muc#roomconfig_getmemberlist',但是XMPPRoom的fetchconfiguration委托没有在回调中给出这个字段值。
任何人都可以建议实现这个的确切方法,我该如何获取成员列表。
答案 0 :(得分:1)
使用
创建xmpp会议室/**
This fuction is used to setup room with roomId
*/
-(void)setUpRoom:(NSString *)ChatRoomJID
{
if (!ChatRoomJID)
{
return;
}
// Configure xmppRoom
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPJID *roomJID = [XMPPJID jidWithString:ChatRoomJID];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:roomJID dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@" maxchars" stringValue:@"0"];
[xmppRoom joinRoomUsingNickname:xmppStream.myJID.user
history:history
password:nil];
[self performSelector:@selector(ConfigureNewRoom:) withObject:nil afterDelay:4];
}
/**
This fuction is used configure new
*/
- (void)ConfigureNewRoom:(id)sender
{
[xmppRoom configureRoomUsingOptions:nil];
[xmppRoom fetchConfigurationForm];
[xmppRoom fetchBanList];
[xmppRoom fetchMembersList];
[xmppRoom fetchModeratorsList];
}
创建房间后使用Xmpp房间的委托方法
- (void)xmppRoom:(XMPPRoom *)sender occupantDidJoin:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence
- (void)xmppRoom:(XMPPRoom *)sender occupantDidLeave:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence
使用这两种委托方法,您可以轻松维护加入MUC Room的用户列表
答案 1 :(得分:0)
默认情况下,这是在服务器中启用的配置,因此无需设置,我们必须自定义服务器以使成员甚至脱机并留下空间。所以要像其他聊天应用程序成员一样显示要求。