Hi, i modified this code so that it would get the resoucre name of the user that just logged in but for some reason when it hits the PresenceStatus.append("Presence Changed: "+presence) line, it seems to ignre the other 4 lines of code in the class.
//The line Below sets the subscription mode to accept all
//This way since the clients use anonymous user they request to be added to
//The online help users contact so that they may chat with them
Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.accept_all);
//The presence information will likely change often, and it’s also possible for the roster entries
//to change or be deleted. To listen for changing roster and presence data, a RosterListener
//should be used. The following code snippet registers a RosterListener with
//the Roster that prints any presence changes in the roster to standard out. A normal client would use similar
//code to update the roster UI with the changing information.
final Roster roster = connection1.getRoster();
roster.addRosterListener(new RosterListener() {
// Ignored events public void entriesAdded(Collection<String> addresses) {}
public void entriesDeleted(Collection<String> addresses) {}
public void entriesUpdated(Collection<String> addresses) {}
public void presenceChanged(Presence presence) {
PresenceStatus.append(“Presence changed: " + presence +”\n");
index = presence.getFrom().toString().indexOf("/");
addresses[count] = presence.getFrom().substring(index+1);
PresenceStatus.append(addresses[count]);
count++;
}
public void entriesAdded(Collection<String> arg0) {
throw new UnsupportedOperationException(“Not supported yet.”);
}
});
Any help with this would be appreciated greatly, Garya445