I am doing a very simple Jabber bot with Smack. I set it up with
roster.setSubscriptionMode(Roster.SUBSCRIPTION_ACCEPT_ALL);
and then at some events, I want to send a message to everyone in my Roster that is presently online (no matter if they’'re away or whatever).
for (Iterator i = con.getRoster().getEntries(); i.hasNext(); ) {
RosterEntry entry = (RosterEntry) i.next();
Presence presence = con.getRoster().getPresence(entry.getUser());
System.out.println(“presence=’’” + presence);
}
This always prints “presence=null”, even for my own user that has the bot in its own roster and is definitely online. According to how I read the api docs, I should get a Presence object, but I always get null, for all users. Any ideas here?