Mercurial > prosody-modules
annotate misc/sasl/example.lua @ 6214:cc5c0f1dc89b
mod_muc_anonymize_moderation_actions: Fix mentioning Virtualhost for MUC, Compatibility section and License.
diff --git a/mod_muc_anonymize_moderation_actions/README.md b/mod_muc_anonymize_moderation_actions/README.md
--- a/mod_muc_anonymize_moderation_actions/README.md
+++ b/mod_muc_anonymize_moderation_actions/README.md
@@ -1,8 +1,10 @@
-<!--
-SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
-SPDX-License-Identifier: AGPL-3.0-only
--->
-# mod_muc_anonymize_moderation_actions
+---
+labels:
+- 'Stage-Alpha'
+summary: Anonymize moderator actions for participants
+---
+
+## Introduction
This modules allows to anonymize affiliation and role changes in MUC rooms.
@@ -11,13 +13,10 @@ When the feature is enabled, when a mode
This is particularly usefull to prevent some revenge when a moderator bans someone.
-This module is under AGPL-3.0 license.
-
-It was tested on Prosody 0.12.x.
## Configuration
-Just enable the module on your MUC VirtualHost.
+Just enable the module on your MUC Component.
The feature will be accessible throught the room configuration form.
You can tweak the position of the settings in the MUC configuration form using `anonymize_moderation_actions_form_position`.
@@ -26,7 +25,20 @@ This value will be passed as priority fo
By default, the field will be between muc#roomconfig_changesubject and muc#roomconfig_moderatedroom (default value is `78`).
``` lua
-VirtualHost "muc.example.com"
+Component "muc.example.com" "muc"
modules_enabled = { "muc_anonymize_moderation_actions" }
anonymize_moderation_actions_form_position = 96
```
+
+## Compatibility
+
+ ------ ----------------------
+ trunk Works as of 25-05-12
+ 0.13 Works
+ 0.12 Works
+ ------ ----------------------
+
+### License
+
+SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
+SPDX-License-Identifier: AGPL-3.0-only
| author | Menel <menel@snikket.de> |
|---|---|
| date | Mon, 12 May 2025 10:42:26 +0200 |
| parents | 7d2fcc7a15f7 |
| children |
| rev | line source |
|---|---|
|
2354
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local method = {} |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 local method_mt = { __index = method } |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 -- This should return a set of supported mechanisms |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 function method:mechanisms() |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 return { |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 ["OAUTH-SOMETHING"] = true; |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 } |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 -- Called when a mechanism is selecetd |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 function method:select(mechanism) |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 return mechanism == "OAUTH-SOMETHING"; |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 -- Called for each message received |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 function method:process(message) |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 -- parse the message |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 if false then |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 -- To send a SASL challenge: |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 return "challenge", "respond-to-this"; |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 if false then |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 -- To fail, send: |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 return "failure", "not-authorized", "Helpful error message here"; |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 self.username = "someone"; |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 return "success"; |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 local function new_sasl() |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 return setmetatable({}, method_mt); |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 function method:clean_clone() |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 return setmetatable({}, method_mt); |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 local provider = {} |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 function provider.get_sasl_handler() |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 return new_sasl(); |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 end |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 |
|
7d2fcc7a15f7
Example SASL mechanism implementation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 module:provides("auth", provider); |
