diff --git a/sat/plugins/plugin_xep_0277.py b/sat/plugins/plugin_xep_0277.py index e4239110..a1b5c11c 100644 --- a/sat/plugins/plugin_xep_0277.py +++ b/sat/plugins/plugin_xep_0277.py @@ -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):]