Reputation: 3689
I have email list for my gmail id...it got using XMPP...how can i get those user status availability in java...
Upvotes: 2
Views: 332
Reputation: 3608
Here is an example using Smack
SASLAuthentication.supportSASLMechanism("PLAIN");
ConnectionConfiguration config = new ConnectionConfiguration(
"talk.google.com", 5222, "gmail.com");
XMPPConnection conn = new XMPPConnection(config);
conn.connect();
conn.login("[email protected]", "password");
Roster roster = conn.getRoster();
Collection<RosterEntry> set = roster.getEntries();
for (RosterEntry re: set) {
System.out.println(">> " + re.getUser());
Presence pres = roster.getPresence(re.getUser());
//This is the status.
System.out.println("\t> " + pres.getMode());
}
Use Prescence.getStatus()
to get the message string
Upvotes: 2