PySM: sending IQ stuff

So, using sleekxmpp to send IQ set / get is quite simple, but requires some manual labor…

This is what I came up with, it’s all quite arbitrary, and can be put in a function easily. But at least now I finally figured out how to send IQ stuff. Receiving some might prove harder…

# Because the backbone works with this... >.>
from xml.etree import cElementTree as cET
[...]
iq = self.makeIqSet()
iq.attrib['from'] = self.fulljid
iq.attrib['to'] = 'test@localhost/bla'
query = self.makeIqQuery(iq, "pysm:iq:shutdown")
shutdown = cET.Element('shutdown')
query.append(shutdown)
shutdown.attrib['when'] = 'now'
self.send(iq)

The shutdown stuff is nothing at the moment, it doesn’t really do anything. The current server just displays the received xml…

Share and Enjoy:
  • Print
  • Reddit
  • Identi.ca
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Slashdot

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.