Well, so far I’‘ve figured out that while Smack can automatically accept requests from other clients, it has problems actually adding people to its own roster such that it is never notified of presence changes. I’‘ve come to think that Smack is actually useless just because of this one annoyance. ACCEPT_ALL in my mind means that, when someone adds me I add them. If this isn’‘t the case then give me some code in the documentation that says "here’‘s the full sequence for adding somebody to your roster after they request to add you". Even the unit tests don’‘t do this. I think the chief source of this problem is that Roster.getPresence() returns a null, which is just bad form people. C’'mon, how hard is it to add extend presence so that you can return a “NOT_AVAILABLE”, “OFFLINE”, etc. field in the Presence object. Much cleaner and more consistent.
So, I’‘m going to start looking elsewhere for a solution, but if you’‘re interested, here’'s the code in my roster listener that should give me the presence of the newly added or existing person:
Presence presence = myRoster.getPresence(user);
RosterEntry entry = myRoster.getEntry(user);
System.out.println("Presence changed: " + presence + " user: " + user);
Person person = null;
if(presence == null) {
// WTF: they should have some presence, they were just added.
System.out.println(“USER has no presence: " + entry.getUser() + " has no presence.”);
person = new Person(entry.getUser(), entry.getName(), “OFFLINE”, “”);
} else {
person = new Person(presence, entry);
}
The only other thing is that I subscription mode with:
myRoster.setSubscriptionMode(Roster.SUBSCRIPTION_ACCEPT_ALL);
And that should be all I need to do. People request to be added, Smack adds them and then nothing happens.
Well, good luck with Smack. Hopefully you can beef up the docs to clue people in, but until then I have to move on. Thanks again.
Zed A. Shaw