在我的聊天应用程序中,我想获取所有在线注册用户。所以每个人,而不仅仅是我名单中的人,这是通过以下代码实现的:
- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence {
// a buddy went offline/online
NSString *presenceType = [presence type]; // online/offline
NSString *myUsername = [[sender myJID] user];
NSString *presenceFromUser = [[presence from] user];
if (![presenceFromUser isEqualToString:myUsername]) {
if ([presenceType isEqualToString:@"available"]) {
[_chatDelegate newBuddyOnline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, @"chat.denederlandsewateren.nl"]];
} else if ([presenceType isEqualToString:@"unavailable"]) {
[_chatDelegate buddyWentOffline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, @"chat.denederlandsewateren.nl"]];
}
}
}
使用此代码,用户只能看到“朋友”的其他用户,但我需要在此特定域上注册的所有用户。ejabberd可以做到这一点吗?