Pergunta

I've to send xmpp based chat client (hipchat) and I'm using xmpp.py for this purpose. For now, I'm trying to send message from shell. Following are the statements that I'm executing from the shell:

>>> import xmpp
>>> jid = xmpp.protocol.JID('99999_9999@chat.hipchat.com')
>>> cl=xmpp.Client(jid.getDomain(),debug=[])
>>> cl.connect()
'tls'
>>> cl.auth(jid.getNode(),'password')
'sasl'
>>> cl.send(xmpp.protocol.Message('99999_9999@chat.hipchat.com','hey!'))
'3'

I'm using the same jabber id for authentication and as a receiver. I'm also online in chat room but I don't get any message. What's missing?

Foi útil?

Solução 2

I was missing the typ parameter. Adding it with value chat solved the problem:

cl.send(xmpp.protocol.Message('99999_9999@chat.hipchat.com','hey!', typ='chat'))

Outras dicas

Some older XMPP servers need an initial presence state. The state is sent using the following call before the cl.send:

cl.SendInitPresence(requestRoster=0)

See also the xsend example from xmpppy home page: http://xmpppy.sourceforge.net/examples/xsend.py

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top