powered by Jive Software

Alias for User Logging onto Server

Hi, when establishing an XMPPConnection and calling the login() method, retrieving the Roster does not include the user you’‘re logged in under. How do you get the Alias of the user I’‘m logged in under, to displau in a GUI component, since this is typically found in a RosterEntry? XMPPConnection.getUser() returns the XMPP Address but I want the Alias assigned to it. I don’'t see any method to get it. Thanks…

Hey Charles,

What do you mean by alias? When you connect to an XMPP server you can access your XMPP address which will be of the form username@server/resource but there is no alias. You may use StringUtils for parsing the name, the server or the resource of an address and then display in your GUI the name or the bare JID (i.e. username@server).


– Gato

Hi, when you retrieve a Roster from a Jabber Server, after connecting and logging on, each entry in the Roster is a RosterEntry containing a User (XMPP Address) and Name (Alias) configured for the entry. There is no way to get this information for the user you’‘ve logged in as, because your own entry is not returned in the Roster. From a usability pespective, you have to display the “username” portion of the XMPP Address for yourself, but the Name (Alias) for your other users, which is inconsistent. We don’'t really want to display the username portion of the XMPP Address as it can be quite user-unfriendly and the Name value is typically more appropriate.

I see what you mean but the logged user won’‘t appear in the roster unless the same user has made more than one connection to the server. An even in that case you can’'t control the name of the roster entry.

The alias that you are referring to is the name that the user wants to give to each contact. Since the logged user is not part of the roster you don’‘t have that information. Usually, clients do not show the logged user as part of the user’'s roster since it may be confusing. Normally, the username or the bare JID of the logged user is what appear in the title of the window.


– Gato

Yeah, this is basically what I determined. I wanted to display the logged in users’’ Name value just like the rest of the users but I guess I’'ll have to settle for what I can get. Thanks for confirming my findings…