Mercurial > prosody-modules
comparison mod_drop_chatstates/mod_drop_chatstates.lua @ 6310:92e2dcf039d9
mod_drop_chatstates: New module to drop chatstates for specific domains
| author | Chaz Kettleson <chaz@pyr3x.com> |
|---|---|
| date | Sat, 02 Aug 2025 10:51:20 -0400 |
| parents | |
| children | 2525f247084c |
comparison
equal
deleted
inserted
replaced
| 6309:f4eba826a308 | 6310:92e2dcf039d9 |
|---|---|
| 1 local jid = require "util.jid" | |
| 2 local st = require "util.stanza" | |
| 3 | |
| 4 local CHATSTATES_NS = "http://jabber.org/protocol/chatstates" | |
| 5 local domains = module:get_option_set("drop_chatstates_domains", {}) | |
| 6 | |
| 7 local function handle_pre_message(event) | |
| 8 local to_host = jid.host(stanza.attr.to) | |
| 9 if not to_host or not domains:contains(to_host) then return end | |
| 10 if event.stanza:get_child(nil, CHATSTATES_NS) then return true end | |
| 11 end | |
| 12 | |
| 13 module:hook("pre-message/bare", handle_pre_message) |
