You can set terms & conditions on the instance level (called "global terms"), or at the streamers' channels level (called "muc terms", as it is related to muc rooms).
## Backend
The `mod_muc_peertubelivechat_terms` prosody modules handles the terms configuration.
It has a configuration option for the global terms.
It also adds muc terms in the room data.
When a new occupant session is opened, this modules sends him messages containing the global and muc terms (if set).
To avoid anyone spoofing terms & conditions, incoming message stanza are filtered, and any `x-livechat-terms` tag will be removed.
Message history is disabled for message containing the `x-livechat-terms`, so that messages broadcasted when the terms change are not stored by muc_mam modume ("Message Archiving Management").
For standard XMPP clients, terms will be shown as delayed messages.
For the livechat frontend, there is a `livechat-converse-terms` Converse plugin that will intercept these messages, and prevent them to be shown in the chat history.
It will also create infobox at the top of the chat to display the terms content.
If muc terms are updated, the new terms will be shown.
Users can hide the terms.
To remember that a user has already hidden the terms, we store the content in localStorage.
We will only show terms again if the content in this localStorage changes.
We do so for both global terms and muc terms, in two separate localStorage keys.
The keys in localstorage does not depends on the room JID or the origin peertube instance.
This means that message will be shown again:
* if terms are modified
* if the user switch to another channel
* if the user switch to a video from a different peertube instance