changeset 3447:c3f07c0cb2de

plugin XEP-0431: Fulltext Search for MAM implementation
author Goffi <goffi@goffi.org>
date Thu, 10 Dec 2020 10:32:54 +0100
parents d2298ed6de7f
children 987198910e56
files sat/plugins/plugin_xep_0313.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0313.py	Thu Dec 10 10:28:05 2020 +0100
+++ b/sat/plugins/plugin_xep_0313.py	Thu Dec 10 10:32:54 2020 +0100
@@ -43,7 +43,8 @@
     C.PI_NAME: "Message Archive Management",
     C.PI_IMPORT_NAME: "XEP-0313",
     C.PI_TYPE: "XEP",
-    C.PI_PROTOCOLS: ["XEP-0313"],
+    # XEP-0431 only defines a namespace, so we register it here
+    C.PI_PROTOCOLS: ["XEP-0313", "XEP-0431"],
     C.PI_DEPENDENCIES: ["XEP-0059", "XEP-0359"],
     C.PI_MAIN: "XEP_0313",
     C.PI_HANDLER: "yes",
@@ -55,6 +56,7 @@
 KEY_LAST_STANZA_ID = "last_stanza_id"
 MESSAGE_RESULT = "/message/result[@xmlns='{mam_ns}' and @queryid='{query_id}']"
 MESSAGE_STANZA_ID = '/message/stanza-id[@xmlns="{ns_stanza_id}"]'
+NS_FTS = "urn:xmpp:fulltext:0"
 
 
 class XEP_0313(object):
@@ -62,6 +64,7 @@
         log.info(_("Message Archive Management plugin initialization"))
         self.host = host
         self.host.registerNamespace("mam", mam.NS_MAM)
+        host.registerNamespace("fulltextmam", NS_FTS)
         self._rsm = host.plugins["XEP-0059"]
         self._sid = host.plugins["XEP-0359"]
         # Deferred used to store last stanza id in order of reception