Instead of this, you can simply use the [XMPPRoster addUser:withNickname:] method.
> //right next line, i do:
> XMPPPresence *presenceFromUserB = [XMPPPresence
> presenceWithType:@"subscribe" to:UserAJid];
> [[self xmppStream] sendElement:myPresenceSub];
This isn't needed. The previous call (with andAddToRoster:YES) handled all this for you.
> the result is:
> User A has two roster items: userB@localhost, userB@localhost/
> resource (this is wrong)
Yes, that's certainly wrong. The changes above might fix this problem. Although the bug still technically exists. What roster storage are you using?
-Robbie Hanson
On Feb 14, 2012, at 1:28 AM, skyline wrote:
> I would like to create a mutual subscription like this:
> userA sends a presence subscription to userB, then userB accepts the
> subscription request and subscribe back to userA.
>
> I tried the following:
>
> User A:
> XMPPPresence *presenceFromUserA = [XMPPPresence
> presenceWithType:@"subscribe" to:UserBJid];
> [[self xmppStream] sendElement:myPresenceSub];
>
> User B:
> [xmppRoster acceptPresenceSubscriptionRequestFrom:[presenceFromUserA
> from] andAddToRoster:YES withNickName:UserA];
> //right next line, i do:
> XMPPPresence *presenceFromUserB = [XMPPPresence
> presenceWithType:@"subscribe" to:UserAJid];
> [[self xmppStream] sendElement:myPresenceSub];
>
> the result is:
> User A has two roster items: userB@localhost, userB@localhost/
> resource (this is wrong)
> User B has one roster item: userA@localhost (this is correct)
>
> please correct me if i do anything wrong, or could you please suggest
> me a better solution?
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups "XMPPFramework" group.
> To post to this group, send email to xmppfr...@googlegroups.com.
> To unsubscribe from this group, send email to xmppframewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/xmppframework?hl=en.
>