Created
August 7, 2010 15:34
-
-
Save 0xnbk/512903 to your computer and use it in GitHub Desktop.
catch invisible friends on gtalk
This file contains hidden or 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
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment