Created
May 8, 2010 12:31
-
-
Save CyberShadow/394539 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
USERNAME = "thecybershadow" # don't include @gmail.com | |
PASSWORD = "hunter2" | |
RESOURCE = "gmail.com" | |
import sys | |
if len(sys.argv) < 2: | |
print 'Usage: python gstatus.py <show> [<status>]' | |
print ' <show> is either "default" or "dnd"' | |
print ' <status> is the status string (optional)' | |
exit() | |
import warnings | |
warnings.filterwarnings("ignore") # 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)>2 else ""]) | |
])) | |
cl.disconnect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment