Comparison

mod_muc_inject_mentions/README.markdown @ 4138:e8c1b35bc25b

mod_muc_inject_mentions: Publish module to repository
author Seve Ferrer <seve@delape.net>
date Sun, 20 Sep 2020 10:31:02 +0200
child 4160:9626d5d1adc4
comparison
equal deleted inserted replaced
4137:5f4bcaad18ee 4138:e8c1b35bc25b
1 # Introduction
2
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)
4
5 ## Features
6
7 1. Multiple mentions in the same message using affixes, including multiple mentions to the same user.
8 Examples:
9 `Hello nickname`
10 `@nickname hey!`
11 `nickname, hi :)`
12 `Are you sure @nickname?`
13
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.
15
16 3. Configuration settings for customizing affixes and enabling/disabling the module for specific rooms.
17
18
19 # Configuring
20
21 ## Enabling
22
23 ```{.lua}
24
25 Component "rooms.example.net" "muc"
26
27 modules_enabled = {
28 "muc_inject_mentions";
29 }
30
31 ```
32
33 ## Settings
34
35 Apart from just writing the nick of an occupant to trigger this module,
36 common affixes used when mentioning someone can be configured in Prosody's config file.
37 Recommended affixes:
38
39 ```
40 muc_inject_mentions_prefixes = {"@"} -- Example: @bob hello!
41 muc_inject_mentions_suffixes = {":", ",", "!", ".", "?"} -- Example: bob! How are you doing?
42 ```
43
44 This module can be enabled/disabled for specific rooms.
45 Only one of the following settings must be set.
46
47 ```
48 -- muc_inject_mentions_enabled_rooms = {"room@conferences.server.com"}
49 -- muc_inject_mentions_disabled_rooms = {"room@conferences.server.com"}
50 ```
51
52 If none or both are found, all rooms in the muc component will have mentions enabled.
53
54 # Example stanzas
55
56 Alice sends the following message
57
58 ```
59 <message id="af6ca" to="room@conference.localhost" type="groupchat">
60 <body>@bob hey! Are you there?</body>
61 </message>
62 ```
63
64 Then, the module detects `@bob` is a mention to `bob` and injects a mention type reference to him
65
66 ```
67 <message from="room@conference.localhost/alice" id="af6ca" to="alice@localhost/ThinkPad" type="groupchat">
68 <body>@bob hey! Are you there?</body>
69 <reference xmlns="urn:xmpp:reference:0"
70 begin="1"
71 end="3"
72 uri="xmpp:bob@localhost"
73 type="mention"
74 />
75 </message>
76 ```