title: XMPPFramework - Which XMPPRoster function to use to send a friend request?
body: <p>I am trying to implement an Instant Messaging App where users can chat as well as add other users to their roster and accept buddy requests. So, far I have been able to implement the chat and I am also able to receive and accept/reject friend requests. </p>
  
  <p>For accepting/rejecting a subscription request, the code is as follows:</p>
  
  <pre><code>- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
  {
      NSString *presenceType = [presence type]; // online / offline
      NSString *myUsername = [[sender myJID] user];
      NSString *presenceFromUser = [[presence from] user];
      NSString *presencefromStr=[presence fromStr];
  
      if  ([presenceType isEqualToString:@"subscribe"]) {
          if(buttonIndex==1) { // For accept button
              [xmppRoster acceptPresenceSubscriptionRequestFrom:[tmpPresence from] andAddToRoster:YES];
      }
      else { // For reject button
          [xmppRoster rejectPresenceSubscriptionRequestFrom:[tmpPresence from]];
      }
  }
  </code></pre>
  
  <p>However, now I am stuck with the problem of not being able to send a friend request. Can anyone guide me on which function of XMPPRoster to use? I tried using the <strong>subscribePresenceToUser</strong> function, but, it didn't work. Any help will be highly appreciated.  </p>
  
  <p>Also, can someone tell if the way I am going with this XMPPRoster subscription mechanism is right or is there a better way to handle the friend requests in XMPPFramework?</p>
  
  <p>Thanks in advance.   </p>