diff options
author | Anna Larch <anna@nextcloud.com> | 2021-06-23 14:03:52 +0300 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2021-08-24 13:41:14 +0300 |
commit | 2422e15270ab69b1da62f01231018c078738a66d (patch) | |
tree | 65bb81dd0153972c48f740dfb72f65e07b179872 /lib/Controller/SettingsController.php | |
parent | 251d6f0d23a3dcaa41daaf84d12fd10a85095515 (diff) |
Create anti spam report feature
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/Controller/SettingsController.php')
-rw-r--r-- | lib/Controller/SettingsController.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index dd1a19dc4..d88705f23 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -28,6 +28,7 @@ namespace OCA\Mail\Controller; use OCA\Mail\AppInfo\Application; use OCA\Mail\Exception\ValidationException; use OCA\Mail\Http\JsonResponse as HttpJsonResponse; +use OCA\Mail\Service\AntiSpamService; use OCA\Mail\Service\Provisioning\Manager as ProvisioningManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; @@ -39,10 +40,15 @@ class SettingsController extends Controller { /** @var ProvisioningManager */ private $provisioningManager; + /** @var AntiSpamService */ + private $antiSpamService; + public function __construct(IRequest $request, - ProvisioningManager $provisioningManager) { + ProvisioningManager $provisioningManager, + AntiSpamService $antiSpamService) { parent::__construct(Application::APP_ID, $request); $this->provisioningManager = $provisioningManager; + $this->antiSpamService = $antiSpamService; } public function index(): JSONResponse { @@ -88,4 +94,24 @@ class SettingsController extends Controller { return new JSONResponse([]); } + + /** + * + * @return JSONResponse + */ + public function setAntiSpamEmail(string $spam, string $ham): JSONResponse { + $this->antiSpamService->setSpamEmail($spam); + $this->antiSpamService->setHamEmail($ham); + return new JSONResponse([]); + } + + /** + * Store the credentials used for SMTP in the config + * + * @return JSONResponse + */ + public function deleteAntiSpamEmail(): JSONResponse { + $this->antiSpamService->deleteConfig(); + return new JSONResponse([]); + } } |