plugin XEP-0060: fix bad naming of return variable

This commit is contained in:
Goffi 2022-07-14 12:55:30 +02:00
commit 5ceb75a137
2 changed files with 14 additions and 7 deletions

View file

@ -280,7 +280,8 @@ class PubsubCache:
except error.StanzaError as e:
if e.condition == "service-unavailable":
log.warning(
"service is hidding disco infos, we'll only cache latest 20 items"
"service {service} is hidding disco infos, we'll only cache "
"latest 20 items"
)
items, __ = await client.pubsub_client.items(
pubsub_node.service, pubsub_node.name, maxItems=20

View file

@ -633,8 +633,10 @@ class XEP_0060(object):
else:
raise e
try:
return [item['id']
for item in iq_result.pubsub.publish.elements(pubsub.NS_PUBSUB, 'item')]
return [
item['id']
for item in iq_result.pubsub.publish.elements(pubsub.NS_PUBSUB, 'item')
]
except AttributeError:
return []
@ -645,17 +647,21 @@ class XEP_0060(object):
nodeIdentifier: str,
items: Optional[List[domish.Element]] = None,
options: Optional[dict] = None
) -> List[str]:
published_ids = await client.pubsub_client.publish(
) -> domish.Element:
"""Publish pubsub items
@return: IQ result stanza
"""
iq_result_elt = await client.pubsub_client.publish(
service, nodeIdentifier, items, client.pubsub_client.parent.jid,
options=options
)
await self.host.trigger.asyncPoint(
"XEP-0060_publish", client, service, nodeIdentifier, items, options,
published_ids
iq_result_elt
)
return published_ids
return iq_result_elt
def _unwrapMAMMessage(self, message_elt):
try: