diff --git a/conversejs/custom/plugins/terms/index.js b/conversejs/custom/plugins/terms/index.js index 838820d8..8459cd82 100644 --- a/conversejs/custom/plugins/terms/index.js +++ b/conversejs/custom/plugins/terms/index.js @@ -36,6 +36,11 @@ converse.plugins.add('livechat-converse-terms', { console.error('Invalid x-livechat-terms type: ', type) return } + if (attrs.is_archived) { + // This should not happen, as we add some no-store hints. But, just in case. + console.info('Dropping an archived x-livechat-terms message') + return + } // console.info('Received a x-livechat-terms message', attrs) const options = {} options['x_livechat_terms_' + type] = attrs diff --git a/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua b/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua index c11d8f33..18a165db 100644 --- a/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua +++ b/prosody-modules/mod_muc_peertubelivechat_terms/mod_muc_peertubelivechat_terms.lua @@ -32,8 +32,10 @@ local function create_terms_message(room, type, terms) id = id.medium() }, terms) :tag('x-livechat-terms', { type = type }):up() -- adding a custom tag to specify that it is a "terms" message, so that frontend can display it with a special template. - :tag("delay", { xmlns = "urn:xmpp:delay", from = from, stamp = datetime.datetime() }):up(); -- adding a delay to trick the moderation bot (see below) - + :tag("delay", { xmlns = "urn:xmpp:delay", from = from, stamp = datetime.datetime() }):up() -- adding a delay to trick the moderation bot (see below) + :tag("no-copy", { xmlns = "urn:xmpp:hints" }):up() + :tag("no-store", { xmlns = "urn:xmpp:hints" }):up() + :tag("no-permanent-store", { xmlns = "urn:xmpp:hints" }):up(); -- concerning the delay tag: -- We are sending message to rooms from non-existant occupants. -- If the message contains something that should be moderated by the livechat moderation bot, diff --git a/support/documentation/content/en/technical/terms.md b/support/documentation/content/en/technical/terms.md index 9c23217c..bd2772c4 100644 --- a/support/documentation/content/en/technical/terms.md +++ b/support/documentation/content/en/technical/terms.md @@ -25,6 +25,9 @@ Here is an example of sent messages: + + + @@ -32,6 +35,9 @@ Here is an example of sent messages: + + + ``` @@ -47,6 +53,8 @@ We must do so, because without nickname, some XMPP clients won't show the messag We also add a `delay` tag, to trick the moderation bot (see comments in code). This also ensure clients will not drop the message because there is no occupant with this name. +We also add some `urn:xmpp:hints` to avoid storing or copying these messages. + When muc terms are updated, the new terms will be broadcasted. To avoid anyone spoofing terms & conditions, incoming message stanza are filtered, and any `x-livechat-terms` tag will be removed.