From 9cd8fecdc5cb2bb4064410ebc8e125551a617820 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Wed, 8 Mar 2023 15:42:24 +0000 Subject: Move Account Validity callbacks to a dedicated file Spreading module callback registration across the codebase is both a bit messy and makes it unclear where a user should register callbacks if they want to define a new class of callbacks. Consolidating these under the synapse.module_api module cleans things up a bit, puts related code in the same place and makes it much more obvious how to extend it. --- synapse/server.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'synapse/server.py') diff --git a/synapse/server.py b/synapse/server.py index df80fc1beb..9bd374ceae 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -108,6 +108,7 @@ from synapse.http.matrixfederationclient import MatrixFederationHttpClient from synapse.media.media_repository import MediaRepository from synapse.metrics.common_usage_metrics import CommonUsageMetricsManager from synapse.module_api import ModuleApi +from synapse.module_api.callbacks import ModuleApiCallbacks from synapse.notifier import Notifier, ReplicationNotifier from synapse.push.bulk_push_rule_evaluator import BulkPushRuleEvaluator from synapse.push.pusherpool import PusherPool @@ -777,6 +778,10 @@ class HomeServer(metaclass=abc.ABCMeta): def get_module_api(self) -> ModuleApi: return ModuleApi(self, self.get_auth_handler()) + @cache_in_self + def get_module_api_callbacks(self) -> ModuleApiCallbacks: + return ModuleApiCallbacks() + @cache_in_self def get_account_data_handler(self) -> AccountDataHandler: return AccountDataHandler(self) -- cgit 1.5.1