Is there any way to add and automatically accept friends using XMPP?

I am trying to create an iOS application using XMPP protocol. I am using XMPPFramework for iOS. My application has some limitations. I should automatically register new users (well, that was easy to do). Users should also be able to add other users as friends automatically, so I have to implement something to automatically accept invitations from friends, and then be able to see the list of friends. Is there a good way to do this?

I was thinking about implementing something:

- (void)xmppRoster:(XMPPRoster *)sender didReceiveBuddyRequest:(XMPPPresence *)presence 

which automatically accepts requests.

But how can I add this contact to my friends list? The documentation in this part is not entirely clear. Should I use the save method from the XMPPCoreDataStorage class?

Thanks for any help!

+4
source share
1 answer

You can use the autoAcceptKnownPresenceSubscriptionRequests property of the autoAcceptKnownPresenceSubscriptionRequests class. The default is YES . If it is NO , the delegate method xmppRoster:didReceivePresenceSubscriptionRequest: will be called.

PS method: xmppRoster:didReceiveBuddyRequest: in the sample application will never be called. There is no link to it in the application. This is an old method.

0
source

All Articles