« Back to APIs

RE: Get DisplayName of the logged user

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hello,
The display name of my logged in user returns the userId!
Imagine i have two Jabber users:
UserID (JID): JabberDude1@bla.com
Display Name: Jabber Dude One
UserID (JID): JabberDude2@bla.com
Display Name: Jabber Dude Two

From the contacts list, if i login with JabberDude1, i can get the display name from JabberDude2.
If i login with JabberDude2, i can get the display name from JabberDude1:
updateRosterItem: function (contact) {
alert(contact.getDisplayName()); // it works ok, returning "Jabber Dude One" (when JabberDude2 is logged in)
}
But i can't get the logged user's displayname:
client.connectedUser.getDisplayName(); // it returns "JabberDude2" instead of "Jabber Dude Two"
 
Any reason why the connectedUser.getDisplayName() does not return de displayname?
Is there any other way to get the current logged in user's display name?
 
Thanks

Filipe,
From the document, I think the connectedUser is the field from jabberwerx.Client class. It returns only jabberwerx.User.
You can try jabberwerx.JID class where there is an object with the following properties: It will return the username of the jid.
{
// REQUIRED: domain portion of JID
domain: "hostname",
// OPTIONAL: node portion of JID
node: "username",
// OPTIONAL: resource portion of JID
resource: "resource",
// OPTIONAL: "true" if the node is unescaped, and should
// be translated via #.escapeNode
unescaped: true|false
}

Howard

Hello Filipe, were you able to get the display name for the connected user? Im trying to get the same results as you.