Hi, I need to update my contacts Presence.
I tried the following code from Gato. I always have a null presence for my contacts.
Somebody knows why?
Roster roster = connection.getRoster();
for (Iterator i=roster.getEntries(); i.hasNext(); ) {
RosterEntry entry = (RosterEntry)i.next();
Presence presence = roster.getPresence(entry.getUser());
System.out.println(entry + “\t” + presence);
}
Are the users you’‘re trying to retrieve the presence from currently online and connected? I’'m pretty sure your will retrieve a null presence if the user is not currently connected.
ofupien
February 9, 2004, 10:00am
3
Hi ddman,
This is not only a null presence for disconnected contacts.
I’'ve got a null pointer for all contacts
ofupien
February 9, 2004, 10:10am
4
Sorry ddman,
you were right. It works fine.
Some of my contacts are doubled on the server, but the code works right.
cheers