@@ -68,118 +68,118 @@ request being made was invalid.
68
68
69
69
The common error codes are:
70
70
71
- ` M_FORBIDDEN `
71
+ ` M_FORBIDDEN `
72
72
Forbidden access, e.g. joining a room without permission, failed login.
73
73
74
- ` M_UNKNOWN_TOKEN `
74
+ ` M_UNKNOWN_TOKEN `
75
75
The access token specified was not recognised.
76
76
77
77
An additional response parameter, ` soft_logout ` , might be present on the
78
78
response for 401 HTTP status codes. See [ the soft logout
79
79
section] ( #soft-logout ) for more information.
80
80
81
- ` M_MISSING_TOKEN `
81
+ ` M_MISSING_TOKEN `
82
82
No access token was specified for the request.
83
83
84
- ` M_BAD_JSON `
84
+ ` M_BAD_JSON `
85
85
Request contained valid JSON, but it was malformed in some way, e.g.
86
86
missing required keys, invalid values for keys.
87
87
88
- ` M_NOT_JSON `
88
+ ` M_NOT_JSON `
89
89
Request did not contain valid JSON.
90
90
91
- ` M_NOT_FOUND `
91
+ ` M_NOT_FOUND `
92
92
No resource was found for this request.
93
93
94
- ` M_LIMIT_EXCEEDED `
94
+ ` M_LIMIT_EXCEEDED `
95
95
Too many requests have been sent in a short period of time. Wait a while
96
96
then try again.
97
97
98
- ` M_UNKNOWN `
98
+ ` M_UNKNOWN `
99
99
An unknown error has occurred.
100
100
101
101
Other error codes the client might encounter are:
102
102
103
- ` M_UNRECOGNIZED `
103
+ ` M_UNRECOGNIZED `
104
104
The server did not understand the request.
105
105
106
- ` M_UNAUTHORIZED `
106
+ ` M_UNAUTHORIZED `
107
107
The request was not correctly authorized. Usually due to login failures.
108
108
109
- ` M_USER_DEACTIVATED `
109
+ ` M_USER_DEACTIVATED `
110
110
The user ID associated with the request has been deactivated. Typically
111
111
for endpoints that prove authentication, such as ` /login ` .
112
112
113
- ` M_USER_IN_USE `
113
+ ` M_USER_IN_USE `
114
114
Encountered when trying to register a user ID which has been taken.
115
115
116
- ` M_INVALID_USERNAME `
116
+ ` M_INVALID_USERNAME `
117
117
Encountered when trying to register a user ID which is not valid.
118
118
119
- ` M_ROOM_IN_USE `
119
+ ` M_ROOM_IN_USE `
120
120
Sent when the room alias given to the ` createRoom ` API is already in
121
121
use.
122
122
123
- ` M_INVALID_ROOM_STATE `
123
+ ` M_INVALID_ROOM_STATE `
124
124
Sent when the initial state given to the ` createRoom ` API is invalid.
125
125
126
- ` M_THREEPID_IN_USE `
126
+ ` M_THREEPID_IN_USE `
127
127
Sent when a threepid given to an API cannot be used because the same
128
128
threepid is already in use.
129
129
130
- ` M_THREEPID_NOT_FOUND `
130
+ ` M_THREEPID_NOT_FOUND `
131
131
Sent when a threepid given to an API cannot be used because no record
132
132
matching the threepid was found.
133
133
134
- ` M_THREEPID_AUTH_FAILED `
134
+ ` M_THREEPID_AUTH_FAILED `
135
135
Authentication could not be performed on the third party identifier.
136
136
137
- ` M_THREEPID_DENIED `
137
+ ` M_THREEPID_DENIED `
138
138
The server does not permit this third party identifier. This may happen
139
139
if the server only permits, for example, email addresses from a
140
140
particular domain.
141
141
142
- ` M_SERVER_NOT_TRUSTED `
142
+ ` M_SERVER_NOT_TRUSTED `
143
143
The client's request used a third party server, e.g. identity server,
144
144
that this server does not trust.
145
145
146
- ` M_UNSUPPORTED_ROOM_VERSION `
146
+ ` M_UNSUPPORTED_ROOM_VERSION `
147
147
The client's request to create a room used a room version that the
148
148
server does not support.
149
149
150
- ` M_INCOMPATIBLE_ROOM_VERSION `
150
+ ` M_INCOMPATIBLE_ROOM_VERSION `
151
151
The client attempted to join a room that has a version the server does
152
152
not support. Inspect the ` room_version ` property of the error response
153
153
for the room's version.
154
154
155
- ` M_BAD_STATE `
155
+ ` M_BAD_STATE `
156
156
The state change requested cannot be performed, such as attempting to
157
157
unban a user who is not banned.
158
158
159
- ` M_GUEST_ACCESS_FORBIDDEN `
159
+ ` M_GUEST_ACCESS_FORBIDDEN `
160
160
The room or resource does not permit guests to access it.
161
161
162
- ` M_CAPTCHA_NEEDED `
162
+ ` M_CAPTCHA_NEEDED `
163
163
A Captcha is required to complete the request.
164
164
165
- ` M_CAPTCHA_INVALID `
165
+ ` M_CAPTCHA_INVALID `
166
166
The Captcha provided did not match what was expected.
167
167
168
- ` M_MISSING_PARAM `
168
+ ` M_MISSING_PARAM `
169
169
A required parameter was missing from the request.
170
170
171
- ` M_INVALID_PARAM `
171
+ ` M_INVALID_PARAM `
172
172
A parameter that was specified has the wrong value. For example, the
173
173
server expected an integer and instead received a string.
174
174
175
- ` M_TOO_LARGE `
175
+ ` M_TOO_LARGE `
176
176
The request or entity was too large.
177
177
178
- ` M_EXCLUSIVE `
178
+ ` M_EXCLUSIVE `
179
179
The resource being requested is reserved by an application service, or
180
180
the application service making the request has not created the resource.
181
181
182
- ` M_RESOURCE_LIMIT_EXCEEDED `
182
+ ` M_RESOURCE_LIMIT_EXCEEDED `
183
183
The request cannot be completed because the homeserver has reached a
184
184
resource limit imposed on it. For example, a homeserver held in a shared
185
185
hosting environment may reach a resource limit if it starts using too
@@ -189,7 +189,7 @@ Typically, this error will appear on routes which attempt to modify
189
189
state (e.g.: sending messages, account data, etc) and not routes which
190
190
only read state (e.g.: ` /sync ` , get account data, etc).
191
191
192
- ` M_CANNOT_LEAVE_SERVER_NOTICE_ROOM `
192
+ ` M_CANNOT_LEAVE_SERVER_NOTICE_ROOM `
193
193
The user is unable to reject an invite to join the server notices room.
194
194
See the [ Server Notices] ( #server-notices ) module for more information.
195
195
@@ -238,23 +238,23 @@ time.
238
238
239
239
In this section, the following terms are used with specific meanings:
240
240
241
- ` PROMPT `
241
+ ` PROMPT `
242
242
Retrieve the specific piece of information from the user in a way which
243
243
fits within the existing client user experience, if the client is
244
244
inclined to do so. Failure can take place instead if no good user
245
245
experience for this is possible at this point.
246
246
247
- ` IGNORE `
247
+ ` IGNORE `
248
248
Stop the current auto-discovery mechanism. If no more auto-discovery
249
249
mechanisms are available, then the client may use other methods of
250
250
determining the required parameters, such as prompting the user, or
251
251
using default values.
252
252
253
- ` FAIL_PROMPT `
253
+ ` FAIL_PROMPT `
254
254
Inform the user that auto-discovery failed due to invalid/empty data and
255
255
` PROMPT ` for the parameter.
256
256
257
- ` FAIL_ERROR `
257
+ ` FAIL_ERROR `
258
258
Inform the user that auto-discovery did not return any usable URLs. Do
259
259
not continue further with the current login process. At this point,
260
260
valid data was obtained, but no server is available to serve the client.
@@ -606,7 +606,7 @@ flow with three stages will resemble the following diagram:
606
606
607
607
#### Authentication types
608
608
609
- This specification defines the following auth types:
609
+ This specification defines the following auth types:
610
610
- ` m.login.password `
611
611
- ` m.login.recaptcha `
612
612
- ` m.login.sso `
@@ -893,7 +893,7 @@ type of identifier being used, and depending on the type, has other
893
893
fields giving the information required to identify the user as described
894
894
below.
895
895
896
- This specification defines the following identifier types:
896
+ This specification defines the following identifier types:
897
897
- ` m.id.user `
898
898
- ` m.id.thirdparty `
899
899
- ` m.id.phone `
@@ -1712,7 +1712,7 @@ event also has a `creator` key which contains the user ID of the room
1712
1712
creator. It will also generate several other events in order to manage
1713
1713
permissions in this room. This includes:
1714
1714
1715
- - ` m.room.power_levels ` : Sets the power levels of users and required power
1715
+ - ` m.room.power_levels ` : Sets the power levels of users and required power
1716
1716
levels for various actions within the room such as sending events.
1717
1717
1718
1718
- ` m.room.join_rules ` : Whether the room is "invite-only" or not.
@@ -1778,6 +1778,8 @@ in that room. There are several states in which a user may be, in
1778
1778
relation to a room:
1779
1779
1780
1780
- Unrelated (the user cannot send or receive events in the room)
1781
+ - Knocking (the user has requested to participate in the room, but has
1782
+ not yet been allowed to)
1781
1783
- Invited (the user has been invited to participate in the room, but
1782
1784
is not yet participating)
1783
1785
- Joined (the user can send and receive events in the room)
@@ -1786,49 +1788,28 @@ relation to a room:
1786
1788
There is an exception to the requirement that a user join a room before
1787
1789
sending events to it: users may send an ` m.room.member ` event to a room
1788
1790
with ` content.membership ` set to ` leave ` to reject an invitation if they
1789
- have currently been invited to a room but have not joined it.
1791
+ have currently been invited to a room but have not joined it. The same
1792
+ applies for retracting knocks on the room that the user sent.
1790
1793
1791
1794
Some rooms require that users be invited to it before they can join;
1792
1795
others allow anyone to join. Whether a given room is an "invite-only"
1793
1796
room is determined by the room config key ` m.room.join_rules ` . It can
1794
1797
have one of the following values:
1795
1798
1796
- ` public `
1799
+ ` public `
1797
1800
This room is free for anyone to join without an invite.
1798
1801
1799
- ` invite `
1802
+ ` invite `
1800
1803
This room can only be joined if you were invited.
1801
1804
1805
+ ` knock `
1806
+ This room can only be joined if you were invited, and allows anyone to
1807
+ request an invite to the room. Note that this join rule is only available
1808
+ to rooms based upon [ room version 7] ( /rooms/v7 ) .
1809
+
1802
1810
The allowable state transitions of membership are:
1803
1811
1804
- ```
1805
- /ban
1806
- +------------------------------------------------------+
1807
- | |
1808
- | +----------------+ +----------------+ |
1809
- | | /leave | | | |
1810
- | | v v | |
1811
- /invite +--------+ +-------+ | |
1812
- ------------>| invite |<----------| leave |----+ | |
1813
- +--------+ /invite +-------+ | | |
1814
- | | ^ | | |
1815
- | | | | | |
1816
- /join | +---------------+ | | | |
1817
- | | /join if | | | |
1818
- | | join_rules | | /ban | /unban |
1819
- | | public /leave | | | |
1820
- v v or | | | |
1821
- +------+ /kick | | | |
1822
- ------------>| join |-------------------+ | | |
1823
- /join +------+ v | |
1824
- if | +-----+ | |
1825
- join_rules +-------------------------->| ban |-----+ |
1826
- public /ban +-----+ |
1827
- ^ ^ |
1828
- | | |
1829
- ----------------------------------------------+ +----------------------+
1830
- /ban
1831
- ```
1812
+ ![ membership-flow-diagram] ( /diagrams/membership.png )
1832
1813
1833
1814
{{% http-api spec="client-server" api="list_joined_rooms" %}}
1834
1815
@@ -1838,22 +1819,59 @@ The allowable state transitions of membership are:
1838
1819
1839
1820
{{% http-api spec="client-server" api="joining" %}}
1840
1821
1822
+ ##### Knocking on rooms
1823
+
1824
+ <!--
1825
+ This section is here because it's most similar to being invited/joining a
1826
+ room, though has added complexity which needs to be explained. Otherwise
1827
+ this will have been just the API definition and nothing more (like invites).
1828
+ -->
1829
+
1830
+ If the join rules allow, external users to the room can ` /knock ` on it to
1831
+ request permission to join. Users with appropriate permissions within the
1832
+ room can then approve (` /invite ` ) or deny (` /kick ` , ` /ban ` , or otherwise
1833
+ set membership to ` leave ` ) the knock. Knocks can be retracted by calling
1834
+ ` /leave ` or otherwise setting membership to ` leave ` .
1835
+
1836
+ Users who are currently in the room, already invited, or banned cannot
1837
+ knock on the room.
1838
+
1839
+ To accept another user's knock, the user must have permission to invite
1840
+ users to the room. To reject another user's knock, the user must have
1841
+ permission to either kick or ban users (whichever is being performed).
1842
+ Note that setting another user's membership to ` leave ` is kicking them.
1843
+
1844
+ The knocking homeserver should assume that an invite to the room means
1845
+ that the knock was accepted, even if the invite is not explicitly related
1846
+ to the knock.
1847
+
1848
+ Homeservers are permitted to automatically accept invites as a result of
1849
+ knocks as they should be aware of the user's intent to join the room. If
1850
+ the homeserver is not auto-accepting invites (or there was an unrecoverable
1851
+ problem with accepting it), the invite is expected to be passed down normally
1852
+ to the client to handle. Clients can expect to see the join event if the
1853
+ server chose to auto-accept.
1854
+
1855
+ {{% http-api spec="client-server" api="knocking" %}}
1856
+
1841
1857
#### Leaving rooms
1842
1858
1843
1859
A user can leave a room to stop receiving events for that room. A user
1844
1860
must have been invited to or have joined the room before they are
1845
1861
eligible to leave the room. Leaving a room to which the user has been
1846
- invited rejects the invite. Once a user leaves a room, it will no longer
1847
- appear in the response to the [ ` /sync ` ] ( /client-server-api/#get_matrixclientr0sync ) API unless it is explicitly
1848
- requested via a filter with the ` include_leave ` field set to ` true ` .
1862
+ invited rejects the invite, and can retract a knock. Once a user leaves
1863
+ a room, it will no longer appear in the response to the
1864
+ [ ` /sync ` ] ( /client-server-api/#get_matrixclientr0sync ) API unless it is
1865
+ explicitly requested via a filter with the ` include_leave ` field set
1866
+ to ` true ` .
1849
1867
1850
1868
Whether or not they actually joined the room, if the room is an
1851
1869
"invite-only" room the user will need to be re-invited before they can
1852
1870
re-join the room.
1853
1871
1854
1872
A user can also forget a room which they have left. Rooms which have
1855
1873
been forgotten will never appear the response to the [ ` /sync ` ] ( /client-server-api/#get_matrixclientr0sync ) API,
1856
- until the user re-joins or is re-invited.
1874
+ until the user re-joins, is re-invited, or knocks .
1857
1875
1858
1876
A user may wish to force another user to leave a room. This can be done
1859
1877
by 'kicking' the other user. To do so, the user performing the kick MUST
0 commit comments