Mercurial > libervia-backend
diff src/plugins/plugin_xep_0060.py @ 1903:29564cec913f
plugin XEP-0060: service, node and uri are added to metadata when doing a getItems
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 09 Mar 2016 16:59:29 +0100 |
parents | fc6eeacf31bc |
children | 614f3abb2c69 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0060.py Wed Mar 09 14:33:54 2016 +0100 +++ b/src/plugins/plugin_xep_0060.py Wed Mar 09 16:59:29 2016 +0100 @@ -281,6 +281,7 @@ - list of items - metadata with the following keys: - rsm_first, rsm_last, rsm_count, rsm_index: first, last, count and index value of RSMResponse + - service, node: service and node used """ if rsm_request and item_ids: raise ValueError(u"items_id can't be used with rsm") @@ -328,10 +329,12 @@ def addMetadata(result): items, rsm_response = result + metadata = {'service': service or client.jid.host, + 'node': node, + 'uri': self.getNodeURI(service, node), + } if rsm_request is not None and rsm_response is not None: - metadata = {'rsm_{}'.format(key): value for key, value in rsm_response.toDict().iteritems()} - else: - metadata = {} + metadata.update({'rsm_{}'.format(key): value for key, value in rsm_response.toDict().iteritems()}) return (items, metadata) d.addCallback(addMetadata)