plugin XEP-0060: service, node and uri are added to metadata when doing a getItems
This commit is contained in:
parent
3890a108f4
commit
c4ac825c8f
2 changed files with 7 additions and 3 deletions
|
|
@ -281,6 +281,7 @@ class XEP_0060(object):
|
|||
- 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 @@ class XEP_0060(object):
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names
|
|||
html_entity_re = re.compile(r'&([a-zA-Z]+?);')
|
||||
XML_ENTITIES = ('quot', 'amp', 'apos', 'lt', 'gt')
|
||||
|
||||
# TODO: move XMLUI stuff in a separate module
|
||||
|
||||
# Helper functions
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue