使用smack编程(2)
Roster和Presence
Roster Entries
包括:
1、一个XMPP地址(e.g. jsmith@example.com).
2、对方昵称 (e.g. "Joe").
3、所属群组.
Roster,Presence监听事件
final Roster roster = con.getRoster();
roster.addRosterListener(new RosterListener() {
public void rosterModified() {
// Ignore event for this example.
}
public void presenceChanged(String user) {
// If the presence is unavailable then "null" will be printed,
// which is fine for this example.
System.out.println("Presence changed: " + roster.getPresence(user));
}
});