<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CyberShadow’s blog &#187; XMPP</title>
	<atom:link href="http://blog.thecybershadow.net/tag/xmpp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thecybershadow.net</link>
	<description>Code and miscellanea</description>
	<lastBuildDate>Wed, 05 Oct 2011 15:01:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting shared Google Talk / Gmail status programmatically</title>
		<link>http://blog.thecybershadow.net/2010/05/08/setting-shared-google-talk-gmail-status-programmatically/</link>
		<comments>http://blog.thecybershadow.net/2010/05/08/setting-shared-google-talk-gmail-status-programmatically/#comments</comments>
		<pubDate>Sat, 08 May 2010 12:21:37 +0000</pubDate>
		<dc:creator>CyberShadow</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[XMPP]]></category>
		<category><![CDATA[xmpppy]]></category>

		<guid isPermaLink="false">http://blog.thecybershadow.net/?p=201</guid>
		<description><![CDATA[There are a few ways to programmatically set the Google Talk / Gmail status via XMPP, however they have some problems if you are signed in into the same account with Google Talk or Gmail chat: You need to keep the program running &#8211; otherwise, the status will revert when the connection is closed; Other [...]]]></description>
			<content:encoded><![CDATA[<p>There are a few ways to programmatically set the Google Talk / Gmail status via XMPP, however they have some problems if you are signed in into the same account with Google Talk or Gmail chat:</p>
<ol>
<li>You need to keep the program running &#8211; otherwise, the status will revert when the connection is closed;</li>
<li>Other logged-in applications will not see the status change.</li>
</ol>
<p>Enter Google&#8217;s <a href="http://code.google.com/apis/talk/jep_extensions/shared_status.html">Shared Status Messages</a> XMPP extension. Here&#8217;s a short Python script which uses the extension to set the status from the command line (needs <a href="http://xmpppy.sourceforge.net/">xmpppy</a>):</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/env python

USERNAME = &quot;thecybershadow&quot;       # don't include @gmail.com
PASSWORD = &quot;hunter2&quot;
RESOURCE = &quot;gmail.com&quot;

import sys

if len(sys.argv) &lt; 2:
	print 'Usage: python gstatus.py &lt;show&gt; [&lt;status&gt;]'
	print '		&lt;show&gt; is either &quot;default&quot; or &quot;dnd&quot;'
	print '		&lt;status&gt; is the status string (optional)'
	exit()

import warnings
warnings.filterwarnings(&quot;ignore&quot;) # silence DeprecationWarning messages
from xmpp import *

cl=Client(server='gmail.com',debug=[])
if not cl.connect(server=('talk.google.com',5222)):
	raise IOError('Can not connect to server.')
if not cl.auth(USERNAME, PASSWORD, RESOURCE):
    raise IOError('Can not auth with server.')
cl.send(Iq('set','google:shared-status', payload=[
		Node('show',payload=[sys.argv[1]]),
		Node('status',payload=[sys.argv[2] if len(sys.argv)&gt;2 else &quot;&quot;])
]))
cl.disconnect()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.thecybershadow.net/2010/05/08/setting-shared-google-talk-gmail-status-programmatically/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

