@@ -58,6 +58,9 @@ def __init__(self, hs: "HomeServer"):
58
58
self ._msc2409_to_device_messages_enabled = (
59
59
hs .config .experimental .msc2409_to_device_messages_enabled
60
60
)
61
+ self ._msc3202_transaction_extensions_enabled = (
62
+ hs .config .experimental .msc3202_transaction_extensions
63
+ )
61
64
62
65
self .current_max = 0
63
66
self .is_processing = False
@@ -204,9 +207,9 @@ def notify_interested_services_ephemeral(
204
207
Args:
205
208
stream_key: The stream the event came from.
206
209
207
- `stream_key` can be "typing_key", "receipt_key", "presence_key" or
208
- "to_device_key". Any other value for `stream_key` will cause this function
209
- to return early.
210
+ `stream_key` can be "typing_key", "receipt_key", "presence_key",
211
+ "to_device_key" or "device_list_key" . Any other value for `stream_key`
212
+ will cause this function to return early.
210
213
211
214
Ephemeral events will only be pushed to appservices that have opted into
212
215
receiving them by setting `push_ephemeral` to true in their registration
@@ -230,6 +233,7 @@ def notify_interested_services_ephemeral(
230
233
"receipt_key" ,
231
234
"presence_key" ,
232
235
"to_device_key" ,
236
+ "device_list_key" ,
233
237
):
234
238
return
235
239
@@ -253,15 +257,37 @@ def notify_interested_services_ephemeral(
253
257
):
254
258
return
255
259
260
+ # Ignore device lists if the feature flag is not enabled
261
+ if (
262
+ stream_key == "device_list_key"
263
+ and not self ._msc3202_transaction_extensions_enabled
264
+ ):
265
+ return
266
+
256
267
# Check whether there are any appservices which have registered to receive
257
268
# ephemeral events.
258
269
#
259
270
# Note that whether these events are actually relevant to these appservices
260
271
# is decided later on.
272
+ services = self .store .get_app_services ()
261
273
services = [
262
274
service
263
- for service in self .store .get_app_services ()
264
- if service .supports_ephemeral
275
+ for service in services
276
+ # Different stream keys require different support booleans
277
+ if (
278
+ stream_key
279
+ in (
280
+ "typing_key" ,
281
+ "receipt_key" ,
282
+ "presence_key" ,
283
+ "to_device_key" ,
284
+ )
285
+ and service .supports_ephemeral
286
+ )
287
+ or (
288
+ stream_key == "device_list_key"
289
+ and service .msc3202_transaction_extensions
290
+ )
265
291
]
266
292
if not services :
267
293
# Bail out early if none of the target appservices have explicitly registered
0 commit comments