diff options
author | Joas Schilling <coding@schilljs.com> | 2021-10-29 16:18:57 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-11-03 16:53:23 +0300 |
commit | 93a080c492df907a3440558e6dc599021ff98672 (patch) | |
tree | 59666e4bc01958dd386b85f63747b2781b078ed6 /lib | |
parent | 214cf55ad4ff82d7b1fa0dec313155c1e18842ba (diff) |
Correctly register the cloud federation provider
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index dca18aaff..a85d6f7d7 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -44,6 +44,7 @@ use OCA\Talk\Events\AttendeesAddedEvent; use OCA\Talk\Events\AttendeesRemovedEvent; use OCA\Talk\Events\ChatEvent; use OCA\Talk\Events\RoomEvent; +use OCA\Talk\Federation\CloudFederationProviderTalk; use OCA\Talk\Files\Listener as FilesListener; use OCA\Talk\Files\TemplateLoader as FilesTemplateLoader; use OCA\Talk\Flow\RegisterOperationsListener; @@ -79,12 +80,16 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\IAppContainer; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Collaboration\Resources\IProviderManager; use OCP\EventDispatcher\IEventDispatcher; +use OCP\Federation\ICloudFederationProvider; +use OCP\Federation\ICloudFederationProviderManager; use OCP\Group\Events\GroupDeletedEvent; use OCP\Group\Events\UserAddedEvent; use OCP\Group\Events\UserRemovedEvent; +use OCP\IConfig; use OCP\IServerContainer; use OCP\IUser; use OCP\Security\CSP\AddContentSecurityPolicyEvent; @@ -166,6 +171,7 @@ class Application extends App implements IBootstrap { $this->registerRoomActivityHooks($dispatcher); $this->registerChatHooks($dispatcher); + $context->injectFn(\Closure::fromCallable([$this, 'registerCloudFederationProviderManager'])); } protected function registerNotifier(IServerContainer $server): void { @@ -226,4 +232,21 @@ class Application extends App implements IBootstrap { }; $dispatcher->addListener(Room::EVENT_AFTER_ROOM_DELETE, $listener); } + + protected function registerCloudFederationProviderManager( + IConfig $config, + ICloudFederationProviderManager $manager, + IAppContainer $appContainer): void { + if ($config->getAppValue('spreed', 'federation_enabled', 'no') !== 'yes') { + return; + } + + $manager->addCloudFederationProvider( + 'talk-room', + 'Talk Federation', + static function () use ($appContainer): ICloudFederationProvider { + return $appContainer->get(CloudFederationProviderTalk::class); + } + ); + } } |