powered by Jive Software

How to get status message?

Hello,

I’m trying to get the status message of users who are on my roster, but .getStatus() always return null while I know the user has set a custom status message. What I’m missing ?

public String convertValueToText(Object value, boolean selected,

boolean expanded, boolean leaf, int row,

boolean hasFocus) {

if (value != null && value instanceof DefaultMutableTreeNode) {

Object node = ((DefaultMutableTreeNode)value).getUserObject();

if (node instanceof RosterEntry)

{

String messageEtat;

if (((RosterEntry)node).getStatus()!=null)

{

messageEtat = ((RosterEntry)node).getStatus().toString();

}

else

{

messageEtat="";

}

return ((RosterEntry)node).getName() + " ";

}

else

{

return super.convertValueToText(value,selected,expanded,leaf,row,hasFocus);

}

}

return super.convertValueToText(value,selected,expanded,leaf,row,hasFocus);

}

};[/code]

Thanks !

Because RosterEntry.getStatus() is not the same as Presence.getStatus().

You can get the users last Presence packet through Roster.getPresence().

Thanks ! It’s working better this way