Software /
code /
prosody-modules
Annotate
mod_muc_inject_mentions/README.markdown @ 4160:9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
author | Seve Ferrer <seve@delape.net> |
---|---|
date | Mon, 28 Sep 2020 19:06:20 +0200 |
parent | 4138:e8c1b35bc25b |
child | 4161:032e1c79d039 |
rev | line source |
---|---|
4138
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
1 # Introduction |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
2 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
3 This module intercepts messages sent to a MUC, looks in the message's body if a user was mentioned and injects a mention type reference to that user implementing [XEP-0372](https://xmpp.org/extensions/xep-0372.html#usecase_mention) |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
4 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
5 ## Features |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
6 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
7 1. Multiple mentions in the same message using affixes, including multiple mentions to the same user. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
8 Examples: |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
9 `Hello nickname` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
10 `@nickname hey!` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
11 `nickname, hi :)` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
12 `Are you sure @nickname?` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
13 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
14 2. Mentions are only injected if no mention was found in a message, avoiding this way, injecting mentions in messages sent from clients with mentions support. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
15 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
16 3. Configuration settings for customizing affixes and enabling/disabling the module for specific rooms. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
17 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
18 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
19 # Configuring |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
20 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
21 ## Enabling |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
22 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
23 ```{.lua} |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
24 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
25 Component "rooms.example.net" "muc" |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
26 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
27 modules_enabled = { |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
28 "muc_inject_mentions"; |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
29 } |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
30 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
31 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
32 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
33 ## Settings |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
34 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
35 Apart from just writing the nick of an occupant to trigger this module, |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
36 common affixes used when mentioning someone can be configured in Prosody's config file. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
37 Recommended affixes: |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
38 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
39 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
40 muc_inject_mentions_prefixes = {"@"} -- Example: @bob hello! |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
41 muc_inject_mentions_suffixes = {":", ",", "!", ".", "?"} -- Example: bob! How are you doing? |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
42 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
43 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
44 This module can be enabled/disabled for specific rooms. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
45 Only one of the following settings must be set. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
46 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
47 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
48 -- muc_inject_mentions_enabled_rooms = {"room@conferences.server.com"} |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
49 -- muc_inject_mentions_disabled_rooms = {"room@conferences.server.com"} |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
50 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
51 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
52 If none or both are found, all rooms in the muc component will have mentions enabled. |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
53 |
4160
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
54 |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
55 It is also possible to modify how this module detects mentions. |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
56 In short, the module will detect if a mention is actually a mention |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
57 if the nickname (with or without affixes) is between spaces, new lines, or at the beginning/end of the message. |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
58 This can be changed using: |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
59 |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
60 ``` |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
61 -- muc_inject_mentions_mention_delimiters = {" ", "", "\n"} |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
62 ``` |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
63 Generally speaking and unless the use-case is very specific, there should be no need to modify the defaults of this setting. |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
64 |
9626d5d1adc4
mod_muc_inject_mentions: Update README explainig mention_delimiters setting
Seve Ferrer <seve@delape.net>
parents:
4138
diff
changeset
|
65 |
4138
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
66 # Example stanzas |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
67 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
68 Alice sends the following message |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
69 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
70 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
71 <message id="af6ca" to="room@conference.localhost" type="groupchat"> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
72 <body>@bob hey! Are you there?</body> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
73 </message> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
74 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
75 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
76 Then, the module detects `@bob` is a mention to `bob` and injects a mention type reference to him |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
77 |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
78 ``` |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
79 <message from="room@conference.localhost/alice" id="af6ca" to="alice@localhost/ThinkPad" type="groupchat"> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
80 <body>@bob hey! Are you there?</body> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
81 <reference xmlns="urn:xmpp:reference:0" |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
82 begin="1" |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
83 end="3" |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
84 uri="xmpp:bob@localhost" |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
85 type="mention" |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
86 /> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
87 </message> |
e8c1b35bc25b
mod_muc_inject_mentions: Publish module to repository
Seve Ferrer <seve@delape.net>
parents:
diff
changeset
|
88 ``` |