Mercurial > prosody-modules
changeset 6344:e407d9795b6a
mod_drop_chatstates: Remove module; never worked correctly
| author | Chaz Kettleson <chaz@pyr3x.com> |
|---|---|
| date | Fri, 17 Oct 2025 21:18:07 -0400 |
| parents | ee2ebdec1fae |
| children | 8a131d44fc7f |
| files | mod_drop_chatstates/README.md mod_drop_chatstates/mod_drop_chatstates.lua |
| diffstat | 2 files changed, 0 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_drop_chatstates/README.md Thu Oct 16 19:08:20 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ ---- -labels: -- 'Stage-Alpha' -- 'Type-Web' -summary: Drop chatstates for specific domains. -rockspec: - build: - modules: - mod_drop_chatstates: mod_drop_chatstates.lua -... - -Introduction -============ - -This is a Prosody module to drop chatstates for specific domains. - -Clients that request chatstates to virtual JIDs (i.e. those created by -modules like mod\_voipms to send/receive SMS/MMS on domains like -'sms.example.com') will, by design, receive errors indicating the -service is unavailable. While most clients will silently ignore this, -clients like profanity will not. This module allows us to drop responses -for chatstates on selected domains if we know they will never respond. - -Configuration -============= - -| option | type | default | description -|---------------------------|--------|---------|-------------------------------| -| drop\_chatstates\_domains | table | {} | Domains to drop chatstates for - -Sample module configuration: - -``` -modules_enabled = { - "drop_chatstates"; -} -drop_chatstates_domains = { "sms.example.com" } -```
--- a/mod_drop_chatstates/mod_drop_chatstates.lua Thu Oct 16 19:08:20 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -local jid = require "util.jid" -local st = require "util.stanza" - -local CHATSTATES_NS = "http://jabber.org/protocol/chatstates" -local domains = module:get_option_set("drop_chatstates_domains", {}) - -local function handle_pre_message(event) - local stanza = event.stanza - local to_host = jid.host(stanza.attr.to) - if not to_host or not domains:contains(to_host) then return end - if stanza:get_child(nil, CHATSTATES_NS) then return true end -end - -module:hook("pre-message/bare", handle_pre_message)
