Python Send Code

From ThePlaz.com

Revision as of 20:07, 9 December 2009 by ThePlaz (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#!/usr/bin/python
import sys,os,xmpp 

msg="Hello World!"
jid="mac@jabber.laptop.org" #had to register this account with the server
pwd="test" #don't know what the password is for the xos
 
#c9dcdd473a2817adf24ff26430f657c981857134@jabber.laptop.org plaz
#182f647d0a622b2fbc0a7bfbb35aba6f927b1b53@jabber.laptop.org kbaum
recipient="c9dcdd473a2817adf24ff26430f657c981857134@jabber.laptop.org"

jid=xmpp.protocol.JID(jid)
  
cl=xmpp.Client(jid.getDomain(),debug=[])
  
if cl.connect() == "":
         print "not connected"
         sys.exit(0)
 
if cl.auth(jid.getNode(),pwd) == None:
       print "authentication failed"
       sys.exit(0)
 
 
cl.send(xmpp.protocol.Message(recipient,msg))
 
cl.disconnect()