0
NSString *ipAddress   =[NSMutableString stringWithFormat:@"%@@204.93.197.136", selectedBuddy];
XMPPJID *newBuddy hString:ipAddress];
[[self appDelegate].xmppRoster acceptPresenceSubscriptionRequestFrom:newBuddy andAddToRoster:YES];

这是我在 xmpp 中用于接受好友请求的代码,但问题是在接受请求时另一个人收到订阅请求如何解决这个问题。

4

1 回答 1

1

You can easily check for the other user's roster elements that if the subscription request coming from the user is already asked for subscription from your end or not?

When you (A) send a request to a user (B). There will be one entry in A's roster with type = "subscription" also there will be an attribute for the item element of you xml response thay is called ask".

When B accept the request with your given method. A will get a subscription request too. You can check that if B is available in A's roster or not and handle accordingly.

于 2013-05-30T12:31:33.213 回答