Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de923d8d authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

code refactoring

parent 09dbe23c
Loading
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -71,17 +71,7 @@ class Application extends App implements IBootstrap {


	public function boot(IBootContext $context): void {
	public function boot(IBootContext $context): void {
		$eventDispatcher = $context->getServerContainer()->get(IEventDispatcher::class);
		$eventDispatcher = $context->getServerContainer()->get(IEventDispatcher::class);

		$eventDispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', [$this, 'registerDavPlugin']);
		// Add a listener for the 'OCA\DAV\Connector\Sabre::addPlugin' event
		$eventDispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $event) use ($context) {
			$eventServer = $event->getServer();

			if ($eventServer !== null) {
				// Register the CheckPlugin
				$plugin = $context->getAppContainer()->get(CheckPlugin::class);
				$eventServer->addPlugin($plugin);
			}
		});
		$serverContainer = $context->getServerContainer();
		$serverContainer = $context->getServerContainer();
		$serverContainer->registerService('LDAPConnectionService', function ($c) {
		$serverContainer->registerService('LDAPConnectionService', function ($c) {
			return new LDAPConnectionService(
			return new LDAPConnectionService(
@@ -90,6 +80,18 @@ class Application extends App implements IBootstrap {
		});
		});
	}
	}


	/**
	 * Registers the CheckPlugin for DAV integration
	 */
	public function registerDavPlugin(SabrePluginEvent $event): void {
		$eventServer = $event->getServer();

		if ($eventServer !== null) {
			$plugin = $this->getContainer()->get(CheckPlugin::class);
			$eventServer->addPlugin($plugin);
		}
	}

	/**
	/**
	 * @internal
	 * @internal
	 */
	 */