'what after in-band account registration
i am using xmpp framework to develop an chat application using openfire server. The users are registered on the server using In Band account registration. But i am not able to understand how a user will be added into the roaster list of another user . Does the app have to fetch all the users that are registered on the server , so that user using the app can send buddy requests Or when any user comes online the server must broadcast it to other users.
I am having difficulties in the flow . Please help me out.
Solution 1:[1]
There are two ways to do that.
- Having database of users on server where you can fetch all users on server.
- Using Search api of openfire. If you are not using any webservice, you can implement xep-0055
As a response of search you can get a list of jids, from where you have to select one. Now again there are two options to add that jid in your roster list
Install User service plugin and use add roster api provided by openfire.
From app as below
XMPPJID *newBuddy = [XMPPJID jidWithString:@"jid"]; [xmppRoster addUser:newBuddy withNickname:nil];
Other user will get it via presence
if([presenceType isEqualToString:@"subscribe"])
{
NSXMLElement *presenceToRequest = [NSXMLElement elementWithName:@"presence"];
[presenceToRequest addAttributeWithName:@"type" stringValue:@"subscribed"];
[presenceToRequest addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"%@", [presence fromStr]]];
[presenceToRequest addAttributeWithName:@"from" stringValue:[NSString stringWithFormat:@"%@", [presence toStr]]];
[[self xmppStream] sendElement:presenceToRequest];
}
This list out iq used for various purpose.
PS: Links with openfire will work after modifying openfire ip and port
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |