Reputation: 1779
In Openfire users are created with a "Username" (which is used as the basis for the JID) and a descriptive "Name". How does one retrieve the Name for a given JID in XMPP? I'm using XMPPFramework.
Upvotes: 2
Views: 1629
Reputation: 2305
You may retrieve a user's Display Name using his JID from XMPPUserCoreDataStorageObject
like this:
XMPPJID *userJID = @"shakespeare";
XMPPUserCoreDataStorageObject *user = [[[self appDelegate] xmppRosterStorage]
userForJID:userJID
xmppStream:[[self appDelegate] xmppStream]
managedObjectContext:[[self appDelegate] managedObjectContext_roster]];
NSString *userDisplayName = user.displayName;
Upvotes: 1
Reputation: 51
Are you using the CoreData portion of the roster when setting up the XMPPFramework? You can get the user via the JID from the storage class that is set (for example, the XMPPRosterCoreDataStorage).
From here, you can get the user stored from the roster request via the storage class such as:
[xmppStorage userForJID:jid ...]
and from here, the resulting object (XMPPUserCoreDataStorageObject) has fields for 'nickname', 'displayName', etc. Some information can also be obtained from the associated vCard for that JID.
Upvotes: 0