I am developing an xmpp client for iphone. i am able to send and receive message. I want to accept the buddy request automatically without prompting to user. In which function will i receive request. Please give me any hints.
Thanks in advance.
I am developing an xmpp client for iphone. i am able to send and receive message. I want to accept the buddy request automatically without prompting to user. In which function will i receive request. Please give me any hints.
Thanks in advance.
U won't receive request in separate function. Whenever a buddy comes to online or send request your didReceivePresence delegate function is called. if you get presence type= subscription then it is buddyrequest. Hope this helps you.
You will receive the subscription in function didReceivePresence.
To accept the subscription, you can use this code:
May it helps :)
Alright, I have got a perfect answer for you!
Here is the code:
I have provided you with the complete code of DidReceivePresence method for your better understanding.
Now let me explain you with the code. If you notice in the else if condition I'm comparing the value (element) which we are receiving. So when I get the string as Subscribe (when the user sends the friend request), you just need to add that particular user in your tableview buddy list.
You can get the username from "presenceFromUser".
If you need anymore understanding then email me on blueobaid@gmail.com because I don't get alerts when you response to my answer, though I'll come back and reply here itself so that it might help others too! and I'm going to put a tutorial soon on http://Czartechnogeeks.com/iSolutions
I'm glad that I'm able to share something valuable to the user with stackoverflow after it helped me much.