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