@@ -37,14 +37,8 @@ registration for suspicious regex strings.
37
37
{{% /boxes/note %}}
38
38
39
39
Application services register "namespaces" of user IDs, room aliases and
40
- room IDs. These namespaces are represented as regular expressions. An
41
- application service is said to be "interested" in a given event if one
42
- of the IDs in the event match the regular expression provided by the
43
- application service, such as the room having an alias or ID in the
44
- relevant namespaces. Similarly, the application service is said to be
45
- interested in a given event if one of the application service's
46
- namespaced users is the target of the event, or is a joined member of
47
- the room where the event occurred.
40
+ room IDs. An application service is said to be "interested" in a given event
41
+ if it matches any of the namespaces.
48
42
49
43
An application service can also state whether they should be the only
50
44
ones who can manage a specified namespace. This is referred to as an
@@ -53,28 +47,12 @@ application services from creating/deleting entities in that namespace.
53
47
Typically, exclusive namespaces are used when the rooms represent real
54
48
rooms on another service (e.g. IRC). Non-exclusive namespaces are used
55
49
when the application service is merely augmenting the room itself (e.g.
56
- providing logging or searching facilities). Namespaces are represented
57
- by POSIX extended regular expressions and look like:
50
+ providing logging or searching facilities).
58
51
59
- users:
60
- - exclusive: true
61
- regex: "@_irc_bridge_.*"
62
-
63
- Application services may define the following namespaces (with none
64
- being explicitly required):
65
-
66
- | Name | Description |
67
- | ----------| ------------------------------------------------------------|
68
- | users | Events which are sent from certain users. |
69
- | aliases | Events which are sent in rooms with certain room aliases. |
70
- | rooms | Events which are sent in rooms with certain room IDs. |
71
-
72
- Each individual namespace MUST declare the following fields:
52
+ The registration is represented by a series of key-value pairs, which
53
+ is normally encoded as an object in a YAML file. It has the following structure:
73
54
74
- | Name | Description |
75
- | ------------| ------------------------------------------------------------------------------------------------------------------------------------|
76
- | exclusive | ** Required** A true or false value stating whether this application service has exclusive access to events within this namespace. |
77
- | regex | ** Required** A regular expression defining which values this namespace includes. |
55
+ {{% definition path="api/application-service/definitions/registration" %}}
78
56
79
57
Exclusive user and alias namespaces should begin with an underscore
80
58
after the sigil to avoid collisions with other users on the homeserver.
@@ -83,38 +61,37 @@ they represent in the reserved namespace. For example, `@_irc_.*` would
83
61
be a good namespace to register for an application service which deals
84
62
with IRC.
85
63
86
- The registration is represented by a series of key-value pairs, which
87
- this specification will present as YAML. See below for the possible
88
- options along with their explanation:
89
-
90
-
91
- | Name | Description |
92
- | -------------------| -----------------------------------------------------------------------------------------------------------------------------------------------|
93
- | id | ** Required** A unique, user-defined ID of the application service which will never change. |
94
- | url | ** Required** The URL for the application service. May include a path after the domain name. Optionally set to null if no traffic is required. |
95
- | as_token | ** Required** A unique token for application services to use to authenticate requests to Homeservers. |
96
- | hs_token | ** Required** A unique token for Homeservers to use to authenticate requests to application services. |
97
- | sender_localpart | ** Required** The localpart of the user associated with the application service. |
98
- | namespaces | ** Required** A list of ` users ` , ` aliases ` and ` rooms ` namespaces that the application service controls. |
99
- | rate_limited | Whether requests from masqueraded users are rate-limited. The sender is excluded. |
100
- | protocols | The external protocols which the application service provides (e.g. IRC). |
101
-
102
64
An example registration file for an IRC-bridging application service is
103
65
below:
104
66
105
- id: "IRC Bridge"
106
- url: "http://127.0.0.1:1234"
107
- as_token: "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46"
108
- hs_token: "312df522183efd404ec1cd22d2ffa4bbc76a8c1ccf541dd692eef281356bb74e"
109
- sender_localpart: "_irc_bot" # Will result in @_irc_bot:example.org
110
- namespaces:
111
- users:
112
- - exclusive: true
113
- regex: "@_irc_bridge_.*"
114
- aliases:
115
- - exclusive: false
116
- regex: "#_irc_bridge_.*"
117
- rooms: []
67
+ ``` yaml
68
+ id : " IRC Bridge"
69
+ url : " http://127.0.0.1:1234"
70
+ as_token : " 30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46"
71
+ hs_token : " 312df522183efd404ec1cd22d2ffa4bbc76a8c1ccf541dd692eef281356bb74e"
72
+ sender_localpart : " _irc_bot" # Will result in @_irc_bot:example.org
73
+ namespaces :
74
+ users :
75
+ - exclusive : true
76
+ regex : " @_irc_bridge_.*"
77
+ aliases :
78
+ - exclusive : false
79
+ regex : " #_irc_bridge_.*"
80
+ rooms : []
81
+ ` ` `
82
+
83
+ {{% boxes/note %}}
84
+ For the ` users` namespace, application services can only register interest in
85
+ *local* users (i.e., users whose IDs end with the `server_name` of the local
86
+ homeserver). Events affecting users on other homeservers are not sent to an application
87
+ service, even if the user happens to match the one of the `users` namespaces (unless,
88
+ of course, the event affects a room that the application service is interested in
89
+ for another room - for example, because there is another user in the room that the
90
+ application service is interested in).
91
+
92
+ For the `rooms` and `aliases` namespaces, all events in a matching room will be
93
+ sent to the application service.
94
+ {{% /boxes/note %}}
118
95
119
96
{{% boxes/warning %}}
120
97
If the homeserver in question has multiple application services, each
0 commit comments