From db8ce9187cdcc751593d2ace7ed313b0267088fb Mon Sep 17 00:00:00 2001 From: jinyu <96060102+jinyu2022@users.noreply.github.com> Date: Sun, 8 Sep 2024 00:39:10 +0800 Subject: [PATCH] feat: Add is_correction method to XEP-0308 Last Message Correction plugin --- slixmpp/plugins/xep_0308/correction.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slixmpp/plugins/xep_0308/correction.py b/slixmpp/plugins/xep_0308/correction.py index 69889ef7..f3947dc7 100644 --- a/slixmpp/plugins/xep_0308/correction.py +++ b/slixmpp/plugins/xep_0308/correction.py @@ -5,7 +5,6 @@ # See the file LICENSE for copying permissio import logging -import slixmpp from slixmpp.stanza import Message from slixmpp.xmlstream.handler import Callback from slixmpp.xmlstream.matcher import StanzaPath @@ -45,5 +44,8 @@ class XEP_0308(BasePlugin): def session_bind(self, jid): self.xmpp.plugin['xep_0030'].add_feature(Replace.namespace) - def _handle_correction(self, msg): + def is_correction(self, msg: Message): + return msg.xml.find('{%s}replace' % Replace.namespace) is not None + + def _handle_correction(self, msg: Message): self.xmpp.event('message_correction', msg)