Mercurial > prosody-modules
annotate mod_block_outgoing/mod_block_outgoing.lua @ 6217:694f8fab07d4
: mod_sasl2*** : Update Compability for all of them
diff --git a/mod_sasl2/README.md b/mod_sasl2/README.md
--- a/mod_sasl2/README.md
+++ b/mod_sasl2/README.md
@@ -31,6 +31,7 @@ This module requires Prosody **trunk** a
Prosody Version Status
----------------------- ----------------
- trunk as of 2024-11-24 Works
+ trunk as of 2025-05-25 Works
+ 0.13 Works
0.12 Does not work
----------------------- ----------------
diff --git a/mod_sasl2_bind2/README.md b/mod_sasl2_bind2/README.md
--- a/mod_sasl2_bind2/README.md
+++ b/mod_sasl2_bind2/README.md
@@ -16,5 +16,6 @@ This module depends on [mod_sasl2]. It e
Prosody-Version Status
--------------- ----------------------
- trunk Works as of 2024-12-21
+ trunk Works as of 2025-05-25
+ 0.13 Works
0.12 Does not work
diff --git a/mod_sasl2_fast/README.md b/mod_sasl2_fast/README.md
--- a/mod_sasl2_fast/README.md
+++ b/mod_sasl2_fast/README.md
@@ -33,5 +33,6 @@ clients being logged out unexpectedly.
Prosody-Version Status
--------------- ----------------------
- trunk Works as of 2024-12-21
+ trunk Works as of 2025-05-25
+ 0.13 Work
0.12 Does not work
diff --git a/mod_sasl2_sm/README.md b/mod_sasl2_sm/README.md
--- a/mod_sasl2_sm/README.md
+++ b/mod_sasl2_sm/README.md
@@ -17,5 +17,6 @@ configuration options.
Prosody-Version Status
--------------- ----------------------
- trunk Works as of 2024-12-21
+ trunk Works as of 2025-05-25
+ 0.13 Work
0.12 Does not work
diff --git a/mod_sasl_ssdp/README.md b/mod_sasl_ssdp/README.md
--- a/mod_sasl_ssdp/README.md
+++ b/mod_sasl_ssdp/README.md
@@ -18,8 +18,8 @@ There are no configuration options for t
# Compatibility
-For SASL2 (XEP-0388) clients, it is compatible with the mod_sasl2 community module.
-
-For clients using RFC 6120 SASL, it requires Prosody trunk 33e5edbd6a4a or
-later. It is not compatible with Prosody 0.12 (it will load, but simply
-won't do anything) for "legacy SASL".
+ Prosody-Version Status
+ --------------- ----------------------
+ trunk Works as of 2025-05-25
+ 0.13 Works
+ 0.12 Does not work
| author | Menel <menel@snikket.de> |
|---|---|
| date | Mon, 12 May 2025 11:07:45 +0200 |
| parents | dc1299ca0185 |
| children |
| rev | line source |
|---|---|
|
2004
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 -- Module to block all outgoing stanzas from a list of users |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 local jid_bare = require "util.jid".bare; |
|
2005
c769ed3e5b2b
mod_block_outgoing: Make admins exempt from restrictions
Matthew Wild <mwild1@gmail.com>
parents:
2004
diff
changeset
|
4 local is_admin = require "core.usermanager".is_admin; |
|
2007
dc1299ca0185
mod_block_outgoing: Make blocked stanza types configurable, and default to blocking messages only
Matthew Wild <mwild1@gmail.com>
parents:
2006
diff
changeset
|
5 local set = require "util.set"; |
|
2004
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 local block_users = module:get_option_set("block_outgoing_users", {}); |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 local block_all = block_users:empty(); |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 |
|
2007
dc1299ca0185
mod_block_outgoing: Make blocked stanza types configurable, and default to blocking messages only
Matthew Wild <mwild1@gmail.com>
parents:
2006
diff
changeset
|
10 local stanza_types = module:get_option_set("block_outgoing_stanzas", { "message" }); |
|
dc1299ca0185
mod_block_outgoing: Make blocked stanza types configurable, and default to blocking messages only
Matthew Wild <mwild1@gmail.com>
parents:
2006
diff
changeset
|
11 local jid_types = set.new{ "host", "bare", "full" }; |
|
2004
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 local function block_stanza(event) |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 local stanza = event.stanza; |
|
2005
c769ed3e5b2b
mod_block_outgoing: Make admins exempt from restrictions
Matthew Wild <mwild1@gmail.com>
parents:
2004
diff
changeset
|
15 local from_jid = jid_bare(stanza.attr.from); |
|
2006
cb810a2bca47
mod_block_outgoing: Allow stanzas to user's login host (e.g. disco queries)
Matthew Wild <mwild1@gmail.com>
parents:
2005
diff
changeset
|
16 if stanza.attr.to == nil or stanza.attr.to == module.host or is_admin(from_jid, module.host) then |
|
2004
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 return; |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 end |
|
2005
c769ed3e5b2b
mod_block_outgoing: Make admins exempt from restrictions
Matthew Wild <mwild1@gmail.com>
parents:
2004
diff
changeset
|
19 if block_all or block_users:contains(from_jid) then |
|
2004
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 module:log("debug", "Blocked outgoing %s stanza from %s", stanza.name, stanza.attr.from); |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 return true; |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 end |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 end |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 function module.load() |
|
2007
dc1299ca0185
mod_block_outgoing: Make blocked stanza types configurable, and default to blocking messages only
Matthew Wild <mwild1@gmail.com>
parents:
2006
diff
changeset
|
26 for stanza_type in stanza_types do |
|
dc1299ca0185
mod_block_outgoing: Make blocked stanza types configurable, and default to blocking messages only
Matthew Wild <mwild1@gmail.com>
parents:
2006
diff
changeset
|
27 for jid_type in jid_types do |
|
2004
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 module:hook("pre-"..stanza_type.."/"..jid_type, block_stanza, 10000); |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 end |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 end |
|
41fd55eba4a8
mod_block_outgoing: Module to block outgoing stanzas from users
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 end |
