Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Found a good <a href="http://mpcabd.igeex.biz/google-talk-status-countdown/" rel="nofollow">article to share</a>:</p> <p>Google Talk uses XMPP then if you can connect using an <code>XMPP client</code> to your <code>Google account</code> you can use the client instead of Google talk. </p> <p>The whole mechanism is too simple (Used the Smack <code>XMPP Library</code> because it is simple and serves me well):</p> <ol> <li>Login.</li> <li>Calculate difference between now and the targeted date.</li> <li>Send the presence</li> </ol> <p><strong>Login</strong></p> <pre><code>import org.jivesoftware.smack.XMPPConnection; public void connect() { XMPPConnection connection = new XMPPConnection(server); //Server is gmail.com for Google Talk. connection.connect(); connection.login(username, password); //Username and password. } </code></pre> <p><strong>Calculate difference between now and the targeted date</strong></p> <p>This process is done using Java Calendar and Date objects:</p> <pre><code>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); } </code></pre> <p>This code calculates the difference between the two dates in days, hours and minutes.</p> <p><strong>Send the presence</strong></p> <p>After calculating the difference all we have to do is to send the presence:</p> <pre><code>import org.jivesoftware.smack.packet.Presence; { String remaining = Long.toString(diffDays) + &amp;quot; day(s), &amp;quot; + Long.toString(diffHours) + &amp;quot; hour(s), &amp;quot; + Long.toString(diffMinutes) + &amp;quot; minute(s) &amp;quot; + message; //Message is usually: Until &amp;quot;something&amp;quot;. 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); } </code></pre> <p>After this point people will see your new status instead of the one in Google Talk. (Notice that you won’t be able to see the change inside Google Talk but rest assured it is changed.f you wanna make sure it is changed ask one of your friends to tell you your status).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload