SettingsManager.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  5. *
  6. * @author Bjoern Schiessle <bjoern@schiessle.org>
  7. * @author dems54 <2083596+dems54@users.noreply.github.com>
  8. * @author Nicolas SIMIDE <2083596+dems54@users.noreply.github.com>
  9. * @author noiob <8197071+noiob@users.noreply.github.com>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. *
  12. * @license GNU AGPL version 3 or any later version
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License as
  16. * published by the Free Software Foundation, either version 3 of the
  17. * License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. *
  27. */
  28. namespace OCA\ShareByMail\Settings;
  29. use OCP\IConfig;
  30. class SettingsManager {
  31. /** @var IConfig */
  32. private $config;
  33. private $sendPasswordByMailDefault = 'yes';
  34. private $replyToInitiatorDefault = 'yes';
  35. public function __construct(IConfig $config) {
  36. $this->config = $config;
  37. }
  38. /**
  39. * should the password for a mail share be send to the recipient
  40. *
  41. * @return bool
  42. */
  43. public function sendPasswordByMail(): bool {
  44. $sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault);
  45. return $sendPasswordByMail === 'yes';
  46. }
  47. /**
  48. * should add reply to with initiator mail
  49. *
  50. * @return bool
  51. */
  52. public function replyToInitiator(): bool {
  53. $replyToInitiator = $this->config->getAppValue('sharebymail', 'replyToInitiator', $this->replyToInitiatorDefault);
  54. return $replyToInitiator === 'yes';
  55. }
  56. }