原始地址:XMPPFrameWork IOS 开发(六)聊天室
聊天室
//初始化聊天室 XMPPJID *roomJID = [XMPPJID jidWithString:ROOM_JID]; xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:self jid:roomJID]; [xmppRoom activate:xmppStream]; [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
//创建聊天室成功 - (void)xmppRoomDidCreate:(XMPPRoom *)sender { DDLogInfo(@"%@: %@", THIS_FILE, THIS_METHOD); }
//加入聊天室,使用昵称 [xmppRoom joinRoomUsingNickname:@"quack" history:nil];
//获取聊天室信息 - (void)xmppRoomDidJoin:(XMPPRoom *)sender { [xmppRoom fetchConfigurationForm]; [xmppRoom fetchBanList]; [xmppRoom fetchMembersList]; [xmppRoom fetchModeratorsList]; }
// 收到禁止名单列表 - (void)xmppRoom:(XMPPRoom *)sender didFetchBanList:(NSArray *)items; // 收到好友名单列表 - (void)xmppRoom:(XMPPRoom *)sender didFetchMembersList:(NSArray *)items; // 收到主持人名单列表 - (void)xmppRoom:(XMPPRoom *)sender didFetchModeratorsList:(NSArray *)items;
- (void)xmppRoom:(XMPPRoom *)sender didNotFetchBanList:(XMPPIQ *)iqError; - (void)xmppRoom:(XMPPRoom *)sender didNotFetchMembersList:(XMPPIQ *)iqError; - (void)xmppRoom:(XMPPRoom *)sender didNotFetchModeratorsList:(XMPPIQ *)iqError;
[xmppRoom deactivate:xmppStream];
//离开聊天室 - (void)xmppRoomDidLeave:(XMPPRoom *)sender { DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD); }
其他代理
//新人加入群聊 - (void)xmppRoom:(XMPPRoom *)sender occupantDidJoin:(XMPPJID *)occupantJID { DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD); } //有人退出群聊 - (void)xmppRoom:(XMPPRoom *)sender occupantDidLeave:(XMPPJID *)occupantJID { DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD); } //有人在群里发言 - (void)xmppRoom:(XMPPRoom *)sender didReceiveMessage:(XMPPMessage *)message fromOccupant:(XMPPJID *)occupantJID { DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD); }