comparison sat/plugins/plugin_xep_0346.py @ 3584:edc79cefe968

plugin XEP-0060: `getItem(s)`, `publish` and `(un)subscribe` are now coroutines
author Goffi <goffi@goffi.org>
date Wed, 30 Jun 2021 16:19:14 +0200
parents b977c74f9c85
children 5f65f4e9f8cb
comparison
equal deleted inserted replaced
3583:16ade4ad63f3 3584:edc79cefe968
625 else: 625 else:
626 schema = None 626 schema = None
627 extra = data_format.deserialise(extra) 627 extra = data_format.deserialise(extra)
628 return client, service, node or None, schema, item_id or None, extra 628 return client, service, node or None, schema, item_id or None, extra
629 629
630 @defer.inlineCallbacks 630 async def copyMissingValues(self, client, service, node, item_id, form_ns, values):
631 def copyMissingValues(self, client, service, node, item_id, form_ns, values):
632 """Retrieve values existing in original item and missing in update 631 """Retrieve values existing in original item and missing in update
633 632
634 Existing item will be retrieve, and values not already specified in values will 633 Existing item will be retrieve, and values not already specified in values will
635 be filled 634 be filled
636 @param service: same as for [XEP_0060.getItems] 635 @param service: same as for [XEP_0060.getItems]
641 This dict will be modified *in place* to fill value present in existing 640 This dict will be modified *in place* to fill value present in existing
642 item and missing in the dict. 641 item and missing in the dict.
643 """ 642 """
644 try: 643 try:
645 # we get previous item 644 # we get previous item
646 items_data = yield self._p.getItems( 645 items_data = await self._p.getItems(
647 client, service, node, item_ids=[item_id] 646 client, service, node, item_ids=[item_id]
648 ) 647 )
649 item_elt = items_data[0][0] 648 item_elt = items_data[0][0]
650 except Exception as e: 649 except Exception as e:
651 log.warning( 650 log.warning(