From fec00803e0ea6f0f0ab56dd3052402eb3b8dc0d4 Mon Sep 17 00:00:00 2001
From: John Livingston First draft.
+ There are some contexts in which you want to be able to rate limit &xep0045;
+ messages. This could have multiple motivations: avoid flooding, garantee
+ a better readability of the room when there are hundreds of active users, …
+
+ This specification propose a new option to MUC rooms, allowing room owners
+ to fix a duration that users MUST wait between two messages.
+ We will also specify how the server MUST reject messages send too quickly,
+ and how clients SHOULD handle this feature (by preventing users to send
+ messages without waiting the delay to be over).
+ This document addresses the following requirements:
+ The MUC Slow Mode can for example be used when a MUC room is associated
+ to a live video stream. In such case, there are often hundreds of people
+ writing at the same time. To avoid flooding, and encourage participants to
+ post relevant messages, slow mode can be usefull.
+
+ Your implementation MAY allow the Slow Mode feature to be set room by
+ room, by their owners.
+
+ If room owners can configure the Slow Mode feature, the server MUST add a
+ 'muc#roomconfig_slow_mode_duration' field in the room
+ configuration form.
+
+ This field MUST have its type equal to 'text-single'.
+
+ This field SHOULD use
+
+ Data Forms Validation
+ , having its datatype equal to 'xs:integer'.
+
+ The 'value' of the field MUST be a positive integer, so you MUST
+ add a 'range' validation, as described in &xep-0122;.
+
+ Value '0' means that the slow mode is disabled for this room.
+
+ Any positive value is the duration, in seconds, users must wait between
+ two messages.
+
+ Here is an example of response the server could send when a client is
+ querying
+ room configuration form:
+
+ If the configuration is changed, the server SHOULD send a status code
+ '104', as specified in
+
+ XEP-0045 - Notification of configuration changes
+ .
+
+ The feature can be enabled on a room:
+
+ In other words: you can enable this feature, without adding the field in
+ the room configuration form. This allows for example server admins to
+ apply a rate limit server-wide, or to set the slow mode programmatically
+ on any wanted criteria (number of users in the room, current server load,
+ room context, ...).
+
+ In any case, to allow clients to discover that the feature is active, the
+ server MUST respond on
+
+ room information queries
+
+ by adding a 'muc#roominfo_slow_mode_duration' field.
+ This field type MUST be 'text-single', and its value MUST be a
+ positive integer.
+
+ Value '0' means that the slow mode is disabled for this room.
+
+ Any positive value is the duration, in seconds, users must wait between
+ two messages.
+
+ Any invalid (non-positive integer) value sent by the server MUST be
+ considered as equal to '0' (in case of a bad implementation).
+
+ Here is an example of response the server could send when a client is
+
+ querying room information:
+
+ If the slow mode duration has changed (either because the room configuration
+ was modified, or because a server parameter has changed), the server SHOULD
+ send a status code '104', as specified in
+
+ XEP-0045 - Notification of configuration changes.
+
+ When the Slow Mode is enabled, server MUST NOT accept two consecutive
+ messages from the same user, to the same room, until the slow mode duration
+ has elapsed.
+
+ Only messages containing at least one '<body/>' element must
+ be taking into account (to avoid counting 'chatstate' messages for
+ example).
+
+ Room administrators and owners MUST NOT be rate limited.
+
+ If a user bypass the limit, the server MUST reply an error stanza, that
+ respects &rfc6120; stanza erors (see
+
+ RFC6120 - stanza errors), especially:
+
+ Here is an example or error stanza:
+
+ When a participant joins a room, the client SHOULD request room information
+ as described in section
+ Client discovering", and look for the
+ 'muc#roominfo_slow_mode_duration' field.
+
+ If this field is present, and contains a valid strictly positive integer
+ value, the client SHOULD display an information somewhere, to tell users
+ that there is a slow mode limitation that applies to this room.
+ This information MAY also be displayed to users for which the rate limit
+ does not apply (administrators, owners, ...).
+
+ Moreover, each time a participant sends a text message, the client SHOULD
+ prevent the user to send another message before the timeout is passed.
+ This MAY be done either by disabling the input field, or the submit button.
+ If the user has at least the administrator acces level,
+ the client SHOULD NOT disable the input field or the submit button.
+
+ To avoid some frustrating behaviour, in case there is some lag on the server
+ for example, the client MAY start counting time after receiving the message
+ echo. Indeed, if the first message is processed with some delay by the
+ server, it could consider that the duration is not passed yet when receiving
+ the next one.
+
+ As a same user can join a room with multiple sessions and/or nicknames,
+ the server MUST use the appropriate criteria to identify the account, and
+ apply the same limits to all user's sessions.
+
+ The slow mode duration parameter is a positive integer. When parsing its
+ value, clients and servers MUST ignore invalid value.
+ They MUST also check that this value is not to big to store in memory
+ (this depends on the data type used by the implementation).
+
+ This document requires no interaction with the Internet Assigned Numbers
+ Authority (IANA).
+
+ &xep0068; defines a process for standardizing the fields used within Data
+ Forms scoped by a particular namespace, and the XMPP Registrar maintains a
+ registry of such FORM_TYPES (see &FORMTYPES;).
+ In this XEP there are two uses of such form fields:
+
+ The registry submissions associated with these namespaces are defined
+ below.
+
+ The registrar shall add the following field to the 'muc#roomconfig' data
+ form:
+
+ The registrar shall add the following field to the 'muc#roominfo' data
+ form:
+
+
+
+
+
+
+
+
+
+
+
Here is an example of response the server could send when a client is querying - room configuration form: + room configuration form:
If the slow mode duration has changed (either because the room configuration - was modified, or because a server parameter has changed), the server SHOULD - send a status code '104', as specified in - + was modified, or because a server parameter has changed, or any other + reason), the server SHOULD send a status code '104', as specified + in XEP-0045 - Notification of configuration changes.
@@ -343,7 +345,7 @@ If a user bypass the limit, the server MUST reply an error stanza, that respects &rfc6120; stanza erors (see - RFC6120 - stanza errors), especially: + RFC6120 - stanza errors), to reject the message. Especially:+ The rejected message MUST NOT be forwarded to other room occupants. +
@@ -403,8 +408,8 @@ Moreover, each time a participant sends a text message, the client SHOULD prevent the user to send another message before the timeout is passed. This MAY be done either by disabling the input field, or the submit button. - If the user has at least the administrator acces level, - the client SHOULD NOT disable the input field or the submit button. + If the user has at least the administrator acces level, the client + SHOULD NOT disable the input field or the submit button.
To avoid some frustrating behaviour, in case there is some lag on the server
From 45b62e47c93c77732a712542474572b25c39a485 Mon Sep 17 00:00:00 2001
From: John Livingston