5 def __init__(self
,userjid
,password
):
7 self
.password
= password
11 jid
=xmpp
.protocol
.JID(self
.userjid
)
12 self
.cl
=xmpp
.Client(jid
.getDomain(),debug
=[])
16 print 'could not connect!'
18 print 'connected with',con
21 auth
=self
.cl
.auth(jid
.getNode(),self
.password
,resource
=jid
.getResource())
23 print 'could not authenticate!'
25 print 'authenticated using',auth
27 #cl.SendInitPresence(requestRoster=0) # you may need to uncomment this for old server
29 def sendMessage(self
,to_jid
,text
):
30 id=self
.cl
.send(xmpp
.protocol
.Message(to_jid
,text
))
31 print 'sent message with id',id