plugin XEP-0277: bridge method mbIsCommentNode + methods renaming
This commit is contained in:
parent
36eb09e53e
commit
6a0ca28f45
1 changed files with 11 additions and 4 deletions
|
|
@ -190,6 +190,13 @@ class XEP_0277(object):
|
|||
out_sign="s",
|
||||
method=self._mbGetFromManyWithComments,
|
||||
)
|
||||
host.bridge.addMethod(
|
||||
"mbIsCommentNode",
|
||||
".plugin",
|
||||
in_sign="s",
|
||||
out_sign="b",
|
||||
method=self.isCommentNode,
|
||||
)
|
||||
|
||||
def getHandler(self, client):
|
||||
return XEP_0277_handler()
|
||||
|
|
@ -699,16 +706,16 @@ class XEP_0277(object):
|
|||
|
||||
## publish/preview ##
|
||||
|
||||
def isCommentsNode(self, item_id: str) -> bool:
|
||||
def isCommentNode(self, node: str) -> bool:
|
||||
"""Indicate if the node is prefixed with comments namespace"""
|
||||
return item_id.startswith(NS_COMMENT_PREFIX)
|
||||
return node.startswith(NS_COMMENT_PREFIX)
|
||||
|
||||
def getParentNode(self, item_id: str) -> str:
|
||||
def getParentItem(self, item_id: str) -> str:
|
||||
"""Return parent of a comment node
|
||||
|
||||
@param item_id: a comment node
|
||||
"""
|
||||
if not self.isCommentsNode(item_id):
|
||||
if not self.isCommentNode(item_id):
|
||||
raise ValueError("This node is not a comment node")
|
||||
return item_id[len(NS_COMMENT_PREFIX):]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue