Good article found to share :
Google Talk uses XMPP, and then if you can connect using XMPP clientyours Google account, you can use the client instead of Google conversations.
The whole mechanism is too simple (Smack uses XMPP Libraryit because it is simple and serves me well):
- To come in.
- Calculate the difference between the current and the target date.
- Submit Availability
To come in
import org.jivesoftware.smack.XMPPConnection;
public void connect() {
XMPPConnection connection = new XMPPConnection(server);
connection.connect();
connection.login(username, password);
}
Calculate difference between current and target date
Java Calendar Date:
import java.util.Calendar;
import java.util.Date;
{
Calendar calendar1 = Calendar.getInstance();
Date d = new Date();
calendar1.setTime(d);
Calendar calendar2 = Calendar.getInstance();
calendar2.setTime(endLine); //End line is the date we're counting to.
long milliseconds1 = calendar1.getTimeInMillis();
long milliseconds2 = calendar2.getTimeInMillis();
long diff = milliseconds2 - milliseconds1;
long diffDays = diff / (24 * 60 * 60 * 1000);
diff = diff % (24 * 60 * 60 * 1000);
long diffHours = diff / (60 * 60 * 1000);
diff = diff % (60 * 60 * 1000);
long diffMinutes = diff / (60 * 1000);
diff = diff % (60 * 1000);
}
, .
, , :
import org.jivesoftware.smack.packet.Presence;
{
String remaining = Long.toString(diffDays) + " day(s), " + Long.toString(diffHours) + " hour(s), " + Long.toString(diffMinutes) + " minute(s) " + message; //Message is usually: Until "something".
Presence presence = new Presence(Presence.Type.available);
presence.setStatus(remaining);
presence.setPriority(24); //Highest priority in Google Talk
presence.setMode(presenceMode); //This is one of XMPP modes (Available, Chat, DND, Away, XA).
connection.sendPacket(presence);
}
, , Google Talk. ( , Google Talk, , . , , ).