Skip to content

Instantly share code, notes, and snippets.

@nixmaniack
Created February 8, 2012 16:46

Revisions

  1. nixmaniack revised this gist Feb 8, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion xmppgtalk.py
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    raise IOError('Can not auth with server')

    # use following to get list of contacts
    #C.sendInitPresence(requestRoster=1)
    C.sendInitPresence(requestRoster=1)
    #rosterobject = C.getRoster()
    # I used the following loop just to check my contacts, it's not need if you know the ID
    #for i in rosterobject.getItems():
  2. nixmaniack revised this gist Feb 8, 2012. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions xmppgtalk.py
    Original file line number Diff line number Diff line change
    @@ -7,9 +7,10 @@
    raise IOError('Can not connect')
    if not C.auth(jid.getNode(),PASS):
    raise IOError('Can not auth with server')
    C.sendInitPresence(requestRoster=1)
    rosterobject = C.getRoster()

    # use following to get list of contacts
    #C.sendInitPresence(requestRoster=1)
    #rosterobject = C.getRoster()
    # I used the following loop just to check my contacts, it's not need if you know the ID
    #for i in rosterobject.getItems():
    # print i
  3. nixmaniack created this gist Feb 8, 2012.
    17 changes: 17 additions & 0 deletions xmppgtalk.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    import xmpp
    GMAIL_ID = '[email protected]'
    PASS = 'yourpass' # if you have app specific pass, you'll need to generate one for this
    jid = xmpp.protocol.JID(GMAIL_ID)
    C = xmpp.Client(jid.getDomain(), debug=['always'])
    if not C.connect(("talk.google.com",5223)):
    raise IOError('Can not connect')
    if not C.auth(jid.getNode(),PASS):
    raise IOError('Can not auth with server')
    C.sendInitPresence(requestRoster=1)
    rosterobject = C.getRoster()

    # I used the following loop just to check my contacts, it's not need if you know the ID
    #for i in rosterobject.getItems():
    # print i

    C.send( xmpp.Message('[email protected]', "hello") )