Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XMPPFramework - How to get currently logged-in user's display name

In my application utilizing XMPPFramework, I have a login page to authenticate one user. Once logged in, I wish to show the displayName of the user in my status page. The displayName is a NSString in XMPPUserCoreDataStorageObject.

The following line returns me the XMPPJID of my currently logged-in user. I thought this would be useful to check against my roster to get his displayName.

[[[self appDelegate] xmppStream] myJID];

However, placing the above in the code below returns me a null.

XMPPUserCoreDataStorageObject *user = [[[self appDelegate] xmppRosterStorage]
                                           userForJID:[[[self appDelegate] xmppStream] myJID]
                                           xmppStream:[[self appDelegate] xmppStream]
                                           managedObjectContext:[[self appDelegate] managedObjectContext_roster]];

Appreciate any advice on how to go about retrieving the displayName of the current user.

like image 648
Keith OYS Avatar asked Jan 24 '26 17:01

Keith OYS


1 Answers

As vitalyster mentioned in the comment above, there is no way to retrieve my own display name if I am logged in.

To verify that, I went to my Openfire server settings.

In Users/Groups > User Summary > KeithOYS > Roster, there is no same user called KeithOYS in the roster list.

Same concept applies for every other users.


In a nutshell, every user has all other users in their Roster (as long as they are classified under the same Group), all except himself.

like image 63
Keith OYS Avatar answered Jan 27 '26 06:01

Keith OYS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!