On Thu, Aug 5, 2010 at 8:09 AM, Tha.Suresh <[email protected]> wrote:
> Ever wanted to know that someone is really offline or has just gone > invisible in GTalk? Here is a small trick. The bellow peace of python > code get the list of invisible users from your GTalk buddy list. It > uses XMPP module for python. You can install this module in > Ubuntu/Debian via apt. It also requires python dns module. > > sudo aptitude install python-xmpp python-dnspython > > Now here is our script. Open your favorite text editor and save the > code as ‘gchat.py’. Dont forget to fill your gtalk username and > password in the script. > > #gtalk.py > > import xmpp > > # Google Talk constants > FROM_GMAIL_ID = "[email protected]" > GMAIL_PASS = "secret passwd" > GTALK_SERVER = "gmail.com" > > jid=xmpp.protocol.JID(FROM_GMAIL_ID) > C=xmpp.Client(jid.getDomain(),debug=[]) > > if not C.connect((GTALK_SERVER,5222)): > raise IOError('Can not connect to server.') > if not C.auth(jid.getNode(),GMAIL_PASS): > raise IOError('Can not auth with server.') > > C.sendInitPresence(requestRoster=1) > > def myPresenceHandler(con, event): > if event.getType() == 'unavailable': > print event.getFrom().getStripped() > > C.RegisterHandler('presence', myPresenceHandler) > while C.Process(1): > pass > > > $ python gchat.py > So , Next time do not let anyone fool you , rather catch him Invisibly. > ;-) > > Thanks to http://segfault.in/ > > -- > Regards, > Tha.Suresh > > Kanchi Linux User Group Rocks !!!! > http://kanchilug.wordpress.com > > My experiences with Linux are here, > http://thasulinux.wordpress.com > > -- > l...@iitd - http://tinyurl.com/ycueutm > Its really nice, but i m getting this: c:\Python25>python c:\users\jayaraj\desktop\gchat.py Traceback (most recent call last): File "c:\users\jayaraj\desktop\gchat.py", line 3, in <module> import xmpp ImportError: No module named xmpp -- Abhineet Jayaraj -- l...@iitd - http://tinyurl.com/ycueutm
