diff --git a/content/rooms/fragments/v1-stringy-power-levels.md b/content/rooms/fragments/v1-stringy-power-levels.md index 01fe23e5..aa86acc2 100644 --- a/content/rooms/fragments/v1-stringy-power-levels.md +++ b/content/rooms/fragments/v1-stringy-power-levels.md @@ -5,18 +5,42 @@ toc_hide: true ##### `m.room.power_levels` events accept values as strings In order to maintain backwards compatibility with early implementations, -power levels can optionally be represented in string format instead of -integer format. A homeserver must be prepared to deal with this by parsing -the power level from a string. In these cases, the following formatting of the -power level string is allowed: +each of the integer-valued properties within +[`m.room.power_levels`](/client-server-api#mroompower_levels) events can +be encoded as strings instead of integers. This includes the nested values +within the `events`, `notifications` and `users` properties. +For example, the following is a valid `m.room.power_levels` event in this room version: + +```json +{ + "content": { + "ban": "50", + "events": { + "m.room.power_levels": "100" + }, + "events_default": "0", + "state_default": "50", + "users": { + "@example:localhost": "100" + }, + "users_default": "0" + }, + "origin_server_ts": 1432735824653, + "room_id": "!jEsUZKDJdhlrceRyVU:example.org", + "sender": "@example:example.org", + "state_key": "", + "type": "m.room.power_levels" +} +``` + +When the value is representative of an integer, they must be the following format: * a single base 10 integer, no float values or decimal points, optionally with any number of leading zeroes (`"100"`, `"000100"`); -* optionally with any number of leading or trailing whitespace characters (`" 100 "`, - `" 00100 "`); -* optionally prefixed with a single `-` or `+` character before the integer - but after leading whitespace padding (`" +100 "`, `" -100 "`, `"+100"`, +* optionally prefixed with a single `-` or `+` character before the integer (`"+100"`, `"-100"`). +* optionally with any number of leading or trailing whitespace characters (`" 100 "`, + `" 00100 "`, `" +100 "`, `" -100 "`); {{% boxes/note %}} The integer represented by the string must still be within the `[-(2**53)+1, (2**53)-1]` diff --git a/content/rooms/v1.md b/content/rooms/v1.md index 392c20f1..3d3e9738 100644 --- a/content/rooms/v1.md +++ b/content/rooms/v1.md @@ -48,7 +48,7 @@ Events in version 1 rooms have the following structure: {{% definition path="api/server-server/definitions/pdu" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v10.md b/content/rooms/v10.md index 44d07c31..983eb73f 100644 --- a/content/rooms/v10.md +++ b/content/rooms/v10.md @@ -58,7 +58,7 @@ Room version 10 is based upon room version 9 with the following considerations. The event format is unchanged by this room version. See [below](#event-format-1) for details on the current event format. -#### Deprecated formatting +#### Deprecated event content schemas While this room version does not change the event format specifically, some deprecated behaviours are strictly no longer supported. diff --git a/content/rooms/v2.md b/content/rooms/v2.md index c468cff8..274e0ea0 100644 --- a/content/rooms/v2.md +++ b/content/rooms/v2.md @@ -46,7 +46,7 @@ Events in rooms of this version have the following structure: {{% definition path="api/server-server/definitions/pdu" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v3.md b/content/rooms/v3.md index b4c1af56..8dd261e8 100644 --- a/content/rooms/v3.md +++ b/content/rooms/v3.md @@ -81,7 +81,7 @@ The complete structure of a event in a v3 room is shown below. {{% definition path="api/server-server/definitions/pdu_v3" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v4.md b/content/rooms/v4.md index 79a5b532..c329f342 100644 --- a/content/rooms/v4.md +++ b/content/rooms/v4.md @@ -69,7 +69,7 @@ the changes in this room version. {{% rver-fragment name="v4-event-format" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v5.md b/content/rooms/v5.md index 438c1171..25147e9e 100644 --- a/content/rooms/v5.md +++ b/content/rooms/v5.md @@ -51,7 +51,7 @@ completeness. {{% rver-fragment name="v4-event-format" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v6.md b/content/rooms/v6.md index c0735af5..0e2e70dc 100644 --- a/content/rooms/v6.md +++ b/content/rooms/v6.md @@ -212,7 +212,7 @@ completeness. {{% rver-fragment name="v4-event-format" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v7.md b/content/rooms/v7.md index 6656b911..5960c198 100644 --- a/content/rooms/v7.md +++ b/content/rooms/v7.md @@ -205,7 +205,7 @@ completeness. {{% rver-fragment name="v4-event-format" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v8.md b/content/rooms/v8.md index 32523aa1..2a8cf125 100644 --- a/content/rooms/v8.md +++ b/content/rooms/v8.md @@ -110,7 +110,7 @@ completeness. {{% rver-fragment name="v4-event-format" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} diff --git a/content/rooms/v9.md b/content/rooms/v9.md index 7f7a4122..0bbaa42a 100644 --- a/content/rooms/v9.md +++ b/content/rooms/v9.md @@ -57,7 +57,7 @@ completeness. {{% rver-fragment name="v4-event-format" %}} -#### Deprecated formatting +#### Deprecated event content schemas {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}