plugin XEP-0277: be sure to have service set in item2mbdata and node when provided
rel 365
This commit is contained in:
parent
6a0ca28f45
commit
436bb119e8
1 changed files with 9 additions and 5 deletions
|
|
@ -269,7 +269,10 @@ class XEP_0277(object):
|
|||
if None, "uri" won't be set
|
||||
@return: microblog data
|
||||
"""
|
||||
microblog_data = {}
|
||||
if service is None:
|
||||
service = client.jid.userhostJID()
|
||||
|
||||
microblog_data = {"service": service.full()}
|
||||
|
||||
def check_conflict(key, increment=False):
|
||||
"""Check if key is already in microblog data
|
||||
|
|
@ -343,9 +346,10 @@ class XEP_0277(object):
|
|||
# uri
|
||||
# FIXME: node should alway be set in the future, check FIXME in method signature
|
||||
if node is not None:
|
||||
microblog_data["node"] = node
|
||||
microblog_data['uri'] = xmpp_uri.buildXMPPUri(
|
||||
"pubsub",
|
||||
path=service.full() if service is not None else client.jid.userhost(),
|
||||
path=service.full(),
|
||||
node=node,
|
||||
item=id_,
|
||||
)
|
||||
|
|
@ -445,13 +449,13 @@ class XEP_0277(object):
|
|||
"uri": uri,
|
||||
}
|
||||
try:
|
||||
service, node = self.parseCommentUrl(uri)
|
||||
comment_service, comment_node = self.parseCommentUrl(uri)
|
||||
except Exception as e:
|
||||
log.warning(f"Can't parse comments url: {e}")
|
||||
continue
|
||||
else:
|
||||
comments_data["service"] = service.full()
|
||||
comments_data["node"] = node
|
||||
comments_data["service"] = comment_service.full()
|
||||
comments_data["node"] = comment_node
|
||||
comments.append(comments_data)
|
||||
else:
|
||||
rel = link_elt.getAttribute("rel", "")
|
||||
|
|
|
|||
Loading…
Reference in a new issue