Mercurial > prosody-modules
annotate mod_muc_block_pm/mod_muc_block_pm.lua @ 6261:1c62edeb9147
mod_pastebin: Update Readme
diff --git a/mod_pastebin/README.md b/mod_pastebin/README.md
--- a/mod_pastebin/README.md
+++ b/mod_pastebin/README.md
@@ -37,12 +37,14 @@ For example:
Pastes will be available by default at
`http://<your-prosody>:5280/pastebin/` by default.
-In Prosody 0.9 and later this can be changed with [HTTP
-settings](https://prosody.im/doc/http).
+Ports and path can be changed with [HTTP
+settings](https://prosody.im/doc/http), for example like:
-In 0.8 and older this can be changed with `pastebin_ports` (see below),
-or you can forward another external URL from your web server to Prosody,
-use `pastebin_url` to set that URL.
+``` {.lua}
+ http_paths = {
+ pastebin = "/$host-paste";
+ }
+```
# Discovery
@@ -82,27 +84,16 @@ The line and character tresholds are adv
pastebin_line_threshold The maximum number of lines a message may have before it is sent to the pastebin. (default 4 lines)
pastebin_trigger A string of characters (e.g. "!paste ") which if detected at the start of a message, always sends the message to the pastebin, regardless of length. (default: not set)
pastebin_expire_after Number of hours after which to expire (remove) a paste, defaults to 24. Set to 0 to store pastes permanently on disk.
- pastebin_ports List of ports to run the HTTP server on, same format as mod_httpserver's http_ports[^1]
- pastebin_url Base URL to display for pastebin links, must end with / and redirect to Prosody's built-in HTTP server[^2]
# Compatibility
- ------ -------
- trunk Works
+ ------ ---------------------
+ trunk Works as of 25-06-13
+ 13 Works
0.12 Works
- 0.11 Works
- 0.10 Works
- 0.9 Works
- 0.8 Works
- ------ -------
+ ------ ---------------------
# Todo
- Maximum paste length
- Web interface to submit pastes?
-
-[^1]: As of Prosody 0.9, `pastebin_ports` is replaced by `http_ports`,
- see [Prosody HTTP server documentation](https://prosody.im/doc/http)
-
-[^2]: See also
- [http_external_url](https://prosody.im/doc/http#external_url)
| author | Menel <menel@snikket.de> |
|---|---|
| date | Fri, 13 Jun 2025 11:39:58 +0200 |
| parents | 67f7df9892bb |
| children |
| rev | line source |
|---|---|
|
5591
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
1 local st = require "util.stanza"; |
|
2588
69d3e0037435
mod_muc_block_pm: Prevent unaffiliated users from sending private messages in MUC
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
|
5610
67f7df9892bb
mod_muc_block_pm: Advertise that Moderators are allowed to send PMs
Kim Alvefur <zash@zash.se>
parents:
5609
diff
changeset
|
3 module:hook("muc-disco#info", function(event) |
|
67f7df9892bb
mod_muc_block_pm: Advertise that Moderators are allowed to send PMs
Kim Alvefur <zash@zash.se>
parents:
5609
diff
changeset
|
4 table.insert(event.form, { name = "muc#roomconfig_allowpm"; value = "moderators" }); |
|
67f7df9892bb
mod_muc_block_pm: Advertise that Moderators are allowed to send PMs
Kim Alvefur <zash@zash.se>
parents:
5609
diff
changeset
|
5 end); |
|
67f7df9892bb
mod_muc_block_pm: Advertise that Moderators are allowed to send PMs
Kim Alvefur <zash@zash.se>
parents:
5609
diff
changeset
|
6 |
|
5591
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
7 module:hook("muc-private-message", function(event) |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
8 local stanza, room = event.stanza, event.room; |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
9 local from_occupant = room:get_occupant_by_nick(stanza.attr.from); |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
10 |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
11 if from_occupant and from_occupant.role == "moderator" then |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
12 return -- moderators may message anyone |
|
3636
afedc2430b0d
mod_muc_block_pm: Add support for Prosody 0.11
JC Brand <jc@opkode.com>
parents:
2588
diff
changeset
|
13 end |
|
2588
69d3e0037435
mod_muc_block_pm: Prevent unaffiliated users from sending private messages in MUC
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 |
|
5591
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
15 local to_occupant = room:get_occupant_by_nick(stanza.attr.to) |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
16 if to_occupant and to_occupant.role == "moderator" then |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
17 return -- messaging moderators is ok |
|
4027
291a45919988
mod_muc_block_pm: Don't respond to error stanzas
JC Brand <jc@opkode.com>
parents:
3636
diff
changeset
|
18 end |
|
2588
69d3e0037435
mod_muc_block_pm: Prevent unaffiliated users from sending private messages in MUC
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 |
|
5609
e469642e6a6c
mod_muc_block_pm: Allow private messages to yourself
Kim Alvefur <zash@zash.se>
parents:
5591
diff
changeset
|
20 if to_occupant.bare_jid == from_occupant.bare_jid then |
|
e469642e6a6c
mod_muc_block_pm: Allow private messages to yourself
Kim Alvefur <zash@zash.se>
parents:
5591
diff
changeset
|
21 return -- to yourself is okay, used by some clients to sync read state in public channels |
|
e469642e6a6c
mod_muc_block_pm: Allow private messages to yourself
Kim Alvefur <zash@zash.se>
parents:
5591
diff
changeset
|
22 end |
|
e469642e6a6c
mod_muc_block_pm: Allow private messages to yourself
Kim Alvefur <zash@zash.se>
parents:
5591
diff
changeset
|
23 |
|
5591
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
24 room:route_to_occupant(from_occupant, st.error_reply(stanza, "cancel", "policy-violation", "Private messages are disabled", room.jid)) |
|
c7e532ac6bf7
mod_muc_block_pm: Update to 0.12+ API, use roles instead of affiliations
Kim Alvefur <zash@zash.se>
parents:
4027
diff
changeset
|
25 return false; |
|
2588
69d3e0037435
mod_muc_block_pm: Prevent unaffiliated users from sending private messages in MUC
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 end, 1); |
