我正在使用 XMPP RobbieHanson 框架,目前我在 didReceivePresence 函数中使用以下代码启用了自动订阅。
if([[presence type] isEqualToString:@"subscribe"])
{
NSLog(@"presence user wants to subscribe %@",[presence fromStr]);
[[self xmppRoster] acceptPresenceSubscriptionRequestFrom:[presence from] andAddToRoster:YES];
}
else if([[presence type] isEqualToString:@"unsubscribe"])
{
[xmppRoster rejectPresenceSubscriptionRequestFrom:[presence from]];
[xmppRoster revokePresencePermissionFromUser:[presence from]];
}
对于某些用户,我仍然将最后一次视为“0”秒或 403 禁止。但有时我确实知道他们离线或在线,enter code here
这意味着我已经并且他们已经接受了在线订阅。
if([[presence type] isEqualToString:@"subscribe"])
{
NSLog(@"presence user wants to subscribe %@",[presence fromStr]);
[[self xmppRoster] acceptPresenceSubscriptionRequestFrom:[presence from] andAddToRoster:YES];
}
else if([[presence type] isEqualToString:@"unsubscribe"])
{
[xmppRoster rejectPresenceSubscriptionRequestFrom:[presence from]];
[xmppRoster revokePresencePermissionFromUser:[presence from]];
}