comparison sat/plugins/plugin_xep_0060.py @ 3854:8a2c46122a11

plugin XEP-0060: fix bad naming of return variable
author Goffi <goffi@goffi.org>
date Thu, 14 Jul 2022 12:55:30 +0200
parents bc24ce903835
children 3ef988734869
comparison
equal deleted inserted replaced
3853:a56d5ad466b3 3854:8a2c46122a11
631 f"{policy}" 631 f"{policy}"
632 ) 632 )
633 else: 633 else:
634 raise e 634 raise e
635 try: 635 try:
636 return [item['id'] 636 return [
637 for item in iq_result.pubsub.publish.elements(pubsub.NS_PUBSUB, 'item')] 637 item['id']
638 for item in iq_result.pubsub.publish.elements(pubsub.NS_PUBSUB, 'item')
639 ]
638 except AttributeError: 640 except AttributeError:
639 return [] 641 return []
640 642
641 async def publish( 643 async def publish(
642 self, 644 self,
643 client: SatXMPPEntity, 645 client: SatXMPPEntity,
644 service: jid.JID, 646 service: jid.JID,
645 nodeIdentifier: str, 647 nodeIdentifier: str,
646 items: Optional[List[domish.Element]] = None, 648 items: Optional[List[domish.Element]] = None,
647 options: Optional[dict] = None 649 options: Optional[dict] = None
648 ) -> List[str]: 650 ) -> domish.Element:
649 published_ids = await client.pubsub_client.publish( 651 """Publish pubsub items
652
653 @return: IQ result stanza
654 """
655 iq_result_elt = await client.pubsub_client.publish(
650 service, nodeIdentifier, items, client.pubsub_client.parent.jid, 656 service, nodeIdentifier, items, client.pubsub_client.parent.jid,
651 options=options 657 options=options
652 ) 658 )
653 659
654 await self.host.trigger.asyncPoint( 660 await self.host.trigger.asyncPoint(
655 "XEP-0060_publish", client, service, nodeIdentifier, items, options, 661 "XEP-0060_publish", client, service, nodeIdentifier, items, options,
656 published_ids 662 iq_result_elt
657 ) 663 )
658 return published_ids 664 return iq_result_elt
659 665
660 def _unwrapMAMMessage(self, message_elt): 666 def _unwrapMAMMessage(self, message_elt):
661 try: 667 try:
662 item_elt = reduce( 668 item_elt = reduce(
663 lambda elt, ns_name: next(elt.elements(*ns_name)), 669 lambda elt, ns_name: next(elt.elements(*ns_name)),