This is a sample, which will help set the status message on gtalk.
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Presence;
public class SmackToGtalk {
public static void main(String[] args)
{
ConnectionConfiguration config = new ConnectionConfiguration(
"talk.google.com", 5222, "google.com");
XMPPConnection connection = new XMPPConnection(config);
Presence presence;
String status;
try {
connection.connect();
connection.login("[email protected]", "password");
status = "DND";
presence = new Presence(Presence.Type.available, status, 24,
Presence.Mode.available);
while (true) {
status = set(status);
presence.setStatus(status);
connection.sendPacket(presence);
Thread.sleep(1000);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
connection.disconnect();
}
}
private static String set(String input) {
return input.substring(1) + input.charAt(0);
}
}