changeset 3928:7e7ac4af6e0c

mod_nooffline_noerror: New module that disables errors for disabled offline storage
author tmolitor <thilo@eightysoft.de>
date Mon, 02 Mar 2020 19:32:11 +0100
parents 4c1f80076606
children bd687d586a8a c49fea05772e
files mod_nooffline_noerror/README.markdown mod_nooffline_noerror/mod_nooffline_noerror.lua
diffstat 2 files changed, 47 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_nooffline_noerror/README.markdown	Mon Mar 02 19:32:11 2020 +0100
@@ -0,0 +1,30 @@
+---
+labels:
+- 'Stage-Alpha'
+summary: Discard offline stanzas instead of generating stanza errors if mod_offline is not loaded
+...
+
+Introduction
+============
+
+By default without mod_offline stanzas that would go to offline storage
+trigger error stanzas sent back to the sender to inform him of undeliverable stanzas.
+
+But if you use MAM on your server and are certain, all of your clients are using it,
+you can use this module to disable the error stanzas.
+If mod_offline is loaded, this module will do nothing.
+
+Warning
+=======
+
+You most certainly *should not* use this module if you cannot be certain
+that *all* your clients support and use MAM!
+
+Compatibility
+=============
+
+  ----- -------------------------------------------------------------------
+  trunk Works
+  0.10  Works
+  0.9   Untested but should work
+  ----- -------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_nooffline_noerror/mod_nooffline_noerror.lua	Mon Mar 02 19:32:11 2020 +0100
@@ -0,0 +1,17 @@
+-- Ignore disabled offline storage
+--
+-- Copyright (C) 2019-2020 Thilo Molitor
+--
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
+--
+
+-- depend on mod_mam to make sure mam is at least loaded and active
+module:depends "mam";
+
+-- ignore offline messages and don't return any error (the message will be already in MAM at this point)
+-- this is *only* triggered if mod_offline is *not* loaded and completely ignored otherwise
+module:hook("message/offline/handle", function(event)
+	event.origin.log("info", "Ignoring offline message (mod_offline seems to be *not* loaded)...");
+	return true;
+end, -100);