powered by Jive Software

server.getPresenceManager().getPresence(_user) always returns null (in my plugin)

Hello all,

I am trying to create a roster plugin that will display a users roster and the current presence of each roster member.

I am having a problem with the PresenceManager in that it always returns a null Presence.

private String getStatusString(XMPPServer _server, User _user) throws UserNotFoundException {
String presence = null;
String image    = null;
JiveGlobals.setProperty("plugin.rosterplugin.public","true");
Log.info("IS IT PUBLIC? " + JiveGlobals.getBooleanProperty("plugin.rosterplugin.public",false));
Presence p = _server.getPresenceManager().getPresence(_user);
Log.info("CAN PROBE=" + String.valueOf(_server.getPresenceManager().canProbePresence(new JID("dufus@myjabber"),"test01")));
if(p == null) {
Log.info("P equals null" + _server.toString() + "///" + _user.getUID());
//Always drops into this block (everyones presence is always null) } else if(p.getShow().equals(Presence.Show.away) {//do something}

Here is the output from the Log.info:

2008.02.04 17:31:02 IS IT PUBLIC? true2008.02.04 17:31:02 CAN PROBE=true2008.02.04 17:31:02 P equals null org.jivesoftware.openfire.XMPPServer@100a289///test02

Any ideas as to what I am doing wrong?

TIA!

Are you sure “_user” does exist?

Thanks for the response!

I just figured it out.

Stupid mistake on my part.

_user does exist , however _user is the person that I am retrieving the roster for, so he should show up as null as he is offline while I am retrieving his roster.

_buddy is what I should have been passing.

Sorry for the wasted post!