Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:54:18+00:00 2026-06-04T09:54:18+00:00

I am developing an xmpp client for iphone. i am able to send and

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:54:20+00:00Added an answer on June 4, 2026 at 9:54 am

    Alright, I have got a perfect answer for you!

    Here is the code:

    - (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence {
    
        // a buddy went offline/online
    
        NSString *presenceType = [presence type];            // online/offline
        NSString *myUsername = [[sender myJID] user];
        NSString *presenceFromUser = [[presence from] user];
    
        if (![presenceFromUser isEqualToString:myUsername]) {
    
            if ([presenceType isEqualToString:@"available"]) {
    
                [_chatDelegate newBuddyOnline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, kHostName]];
                   NSLog(@"presence user is %@",presenceFromUser);
    
            } 
    
            else if  ([presenceType isEqualToString:@"unavailable"]) {
    
                [_chatDelegate buddyWentOffline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, kHostName]];
                NSLog(@"presence user is invisible %@",presenceFromUser);
    
            }
            else if  ([presenceType isEqualToString:@"subscribe"]) {
    
                [_chatDelegate newBuddyOnline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, kHostName]];
                            NSLog(@"presence user wants to subscribe %@",presenceFromUser);
    
            }
    
        }
    }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing chat application using xmpp client. I can send and receive message
Hi i am new to stackoverflow. I am developing an xmpp client application for
I'm developing an iphone app with XMPP. I'm trying to print the images of
I am currently developing android XMPP client to communicate with the Tigase server setup
I am trying to write an xmpp client to send/recieve messages from gtalk. Before
I'm interested in developing a XMPP client on the mobile S60 Symbian platform using
Im developing an iPhone app that has an groupchat. Im using the XMPP framework.
I am interested in developing a chat engine using XMPP and I want to
I am developing a XMPP based chat client for iOS. One of the requirements
I am developing an IM client for iPhone, which will have support for an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.