summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-05-13 20:57:48 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-05-13 20:57:48 +0200
commit92ea13172187e2da59d2a2dc596147eb99e33ced (patch)
tree78a203b283ab34d7a9afbd63dc87674578f3dcde /examples
parentdd7f67d10d32dadd12a841847f438b457d662b1e (diff)
downloadslixmpp-92ea13172187e2da59d2a2dc596147eb99e33ced.tar.gz
slixmpp-92ea13172187e2da59d2a2dc596147eb99e33ced.tar.bz2
slixmpp-92ea13172187e2da59d2a2dc596147eb99e33ced.tar.xz
slixmpp-92ea13172187e2da59d2a2dc596147eb99e33ced.zip
examples: Add support for node configuration to pubsub_client.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/pubsub_client.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/pubsub_client.py b/examples/pubsub_client.py
index d9733036..6f59380d 100755
--- a/examples/pubsub_client.py
+++ b/examples/pubsub_client.py
@@ -21,7 +21,7 @@ class PubsubClient(slixmpp.ClientXMPP):
self.register_plugin('xep_0059')
self.register_plugin('xep_0060')
- self.actions = ['nodes', 'create', 'delete',
+ self.actions = ['nodes', 'create', 'delete', 'get_configure',
'publish', 'get', 'retract',
'purge', 'subscribe', 'unsubscribe']
@@ -65,6 +65,13 @@ class PubsubClient(slixmpp.ClientXMPP):
except XMPPError as error:
logging.error('Could not delete node %s: %s', self.node, error.format())
+ def get_configure(self):
+ try:
+ configuration_form = yield from self['xep_0060'].get_configure_form(self.pubsub_server, self.node)
+ logging.info('Configure form received from node %s: %s', self.node, configuration_form)
+ except XMPPError as error:
+ logging.error('Could not retrieve configure form from node %s: %s', self.node, error.format())
+
def publish(self):
payload = ET.fromstring("<test xmlns='test'>%s</test>" % self.data)
try:
@@ -118,7 +125,7 @@ if __name__ == '__main__':
parser = ArgumentParser()
parser.version = '%%prog 0.1'
parser.usage = "Usage: %%prog [options] <jid> " + \
- 'nodes|create|delete|purge|subscribe|unsubscribe|publish|retract|get' + \
+ 'nodes|create|delete|get_configure|purge|subscribe|unsubscribe|publish|retract|get' + \
' [<node> <data>]'
parser.add_argument("-q","--quiet", help="set logging to ERROR",
@@ -139,7 +146,7 @@ if __name__ == '__main__':
help="password to use")
parser.add_argument("server")
- parser.add_argument("action", choices=["nodes", "create", "delete", "purge", "subscribe", "unsubscribe", "publish", "retract", "get"])
+ parser.add_argument("action", choices=["nodes", "create", "delete", "get_configure", "purge", "subscribe", "unsubscribe", "publish", "retract", "get"])
parser.add_argument("node", nargs='?')
parser.add_argument("data", nargs='?')