Software /
code /
prosody-modules
Changeset
3937:e7dc25e54d02
mod_smacks_noerror: This module is superseded by mod_smacks and mod_nooffline_noerror
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Sun, 08 Mar 2020 19:52:33 +0100 |
parents | 3936:a3693e0d26b8 |
children | 3938:3f4df08dce14 |
files | mod_smacks_noerror/README.markdown mod_smacks_noerror/mod_smacks_noerror.lua |
diffstat | 2 files changed, 8 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_smacks_noerror/README.markdown Sun Mar 08 19:50:43 2020 +0100 +++ b/mod_smacks_noerror/README.markdown Sun Mar 08 19:52:33 2020 +0100 @@ -1,43 +1,12 @@ --- labels: - 'Stage-Alpha' -summary: Monkeypatch mod_smacks to silently discard unacked message stanzas when a hibernation times out +summary: Module deprecated, just use mod_smacks and mod_nooffline_noerror ... Introduction ============ -By default mod_smacks sends back error stanzas for every unacked message -stanza when the hibernation times out. -This leads to "message not delivered" errors displayed in clients. - -When you are certain that *all* your clients use MAM, this is unnecessary and -confuses users (the message will eventually be delivered via MAM). - -This module therefore monkeypatches mod_smacks to silently drop those -unacked message stanzas instead of sending error replies. -Unacked iq stanzas are still answered with an error reply though. - -If you disable mod_offline, this module will also silence "message not delivered" -error messages that will otherwise be generated when prosody would normally -store offline message but can't do this because of disabled mod_offline. -If mod_offline is *not* disabled this module will not change offline storage -behaviour at all. - -Warning -======= - -You most certainly *should not* use this module if you cannot be certain -that *all* your clients support and use MAM! - -Compatibility -============= - - ----- ------------------------------------------------------------------- - trunk Untested - 0.10 Works - 0.9 Untested but should work - 0.8 Untested but should work, use version [7693724881b3] of mod_smacks - ----- ------------------------------------------------------------------- - -[7693724881b3]: //hg.prosody.im/prosody-modules/raw-file/7693724881b3/mod_smacks/mod_smacks.lua +This module is deprecated and superseded by mod_smacks. +If you explicitly disabled mod_offline you need the new module +mod_nooffline_noerror to regain all features of this deprecated module.
--- a/mod_smacks_noerror/mod_smacks_noerror.lua Sun Mar 08 19:50:43 2020 +0100 +++ b/mod_smacks_noerror/mod_smacks_noerror.lua Sun Mar 08 19:52:33 2020 +0100 @@ -1,40 +1,5 @@ -local t_insert = table.insert; - -local mod_smacks = module:depends"smacks" - --- 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("debug", "Ignoring offline message (mod_offline seems to be *not* loaded)..."); - return true; -end, -100); - -local function discard_unacked_messages(session) - local queue = session.outgoing_stanza_queue; - local replacement_queue = {}; - session.outgoing_stanza_queue = replacement_queue; +-- this module is deprecated, log an error and load the superseding modules instead +module:depends"smacks" +module:depends"nooffline_noerror" - for _, stanza in ipairs(queue) do - if stanza.name == "message" and stanza.attr.xmlns == nil and - ( stanza.attr.type == "chat" or ( stanza.attr.type or "normal" ) == "normal" ) then - -- do nothing here for normal messages and don't send out "message delivery errors", - -- because messages are already in MAM at this point (no need to frighten users) - else - t_insert(replacement_queue, stanza); - end - end -end - -local handle_unacked_stanzas = mod_smacks.handle_unacked_stanzas; - -mod_smacks.handle_unacked_stanzas = function (session) - -- Only deal with authenticated (c2s) sessions - if session.username then - discard_unacked_messages(session) - end - return handle_unacked_stanzas(session); -end - -function module.unload() - mod_smacks.handle_unacked_stanzas = handle_unacked_stanzas; -end +module:log("error", "mod_smacks_noerror is deprecated! Just use mod_smacks and load mod_nooffline_noerror if you explicitly disabled offline storage (mod_offline)"); \ No newline at end of file