diff options
Diffstat (limited to 'apps/dav/lib/CalDAV/Schedule/IMipPlugin.php')
-rw-r--r-- | apps/dav/lib/CalDAV/Schedule/IMipPlugin.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 1cfe8f47cb5..8ed3cf4d56f 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -12,7 +12,7 @@ use OCA\DAV\CalDAV\CalendarObject; use OCA\DAV\CalDAV\EventComparisonService; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Defaults; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\IUserSession; use OCP\Mail\IMailer; use OCP\Mail\Provider\IManager as IMailManager; @@ -44,7 +44,7 @@ use Sabre\VObject\Reader; */ class IMipPlugin extends SabreIMipPlugin { private IUserSession $userSession; - private IConfig $config; + private IAppConfig $config; private IMailer $mailer; private LoggerInterface $logger; private ITimeFactory $timeFactory; @@ -59,7 +59,8 @@ class IMipPlugin extends SabreIMipPlugin { private EventComparisonService $eventComparisonService; private IMailManager $mailManager; - public function __construct(IConfig $config, + public function __construct( + IAppConfig $config, IMailer $mailer, LoggerInterface $logger, ITimeFactory $timeFactory, @@ -254,7 +255,7 @@ class IMipPlugin extends SabreIMipPlugin { */ $recipientDomain = substr(strrchr($recipient, '@'), 1); - $invitationLinkRecipients = explode(',', preg_replace('/\s+/', '', strtolower($this->config->getAppValue('dav', 'invitation_link_recipients', 'yes')))); + $invitationLinkRecipients = explode(',', preg_replace('/\s+/', '', strtolower($this->config->getValueString('dav', 'invitation_link_recipients', 'yes')))); if (strcmp('yes', $invitationLinkRecipients[0]) === 0 || in_array(strtolower($recipient), $invitationLinkRecipients) @@ -273,12 +274,13 @@ class IMipPlugin extends SabreIMipPlugin { $mailService = null; try { - // retrieve user object - $user = $this->userSession->getUser(); - // evaluate if user object exist - if ($user !== null) { - // retrieve appropriate service with the same address as sender - $mailService = $this->mailManager->findServiceByAddress($user->getUID(), $sender); + if ($this->config->getValueBool('core', 'mail_providers_enabled', true)) { + // retrieve user object + $user = $this->userSession->getUser(); + if ($user !== null) { + // retrieve appropriate service with the same address as sender + $mailService = $this->mailManager->findServiceByAddress($user->getUID(), $sender); + } } // evaluate if a mail service was found and has sending capabilities if ($mailService !== null && $mailService instanceof IMessageSend) { |