Presence bug?

Hello,

I have the following snippet of code:

Roster roster = connection.getRoster();

for (RosterEntry entry : roster.getEntries()) {

String user = entry.getUser();

System.out.println ("User: " + user + " Presence: " + roster.getPresence(user));

}

The presence always shows up as unavailable. Is it a bug or am I doing something wrong?

maryann

I’'m a newbie, can you tell?

When are you getting the list? This is updated well after connecting (asynchronously).

oh, I see. I am checking immediately after connecting. How long should I wait in general?

Thanks, M.

Actually, I’'ve just tested for how long I should wait. While services show up as available pretty quickly, users (on jabber.org) still do not show as available through smack. hmmmm…

M

If you add a rosterlistener then you’'ll be able to catch your contacts presence updates and update whatever you need to accordingly.