1: <?php
2: /**
3: * This code is licensed under Afterlogic Software License.
4: * For full statements of the license see LICENSE file.
5: */
6:
7: namespace Aurora\Modules\MailMultiAccountsPlugin;
8:
9: /**
10: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
11: * @copyright Copyright (c) 2023, Afterlogic Corp.
12: *
13: * @package Modules
14: */
15: class Module extends \Aurora\System\Module\AbstractLicensedModule
16: {
17: public function init()
18: {
19: $this->subscribeEvent('Mail::CreateAccount::before', array($this, 'onBeforeCreateAccount'));
20: $this->subscribeEvent('Mail::CreateAccount::after', array($this, 'onAfterCreateAccount'));
21:
22: $this->subscribeEvent('Mail::GetSettings::after', array($this, 'onAfterGetSettings'));
23: }
24:
25: public function onBeforeCreateAccount($aArguments, &$mResult)
26: {
27: \Aurora\System\Api::GetModule('Mail')->setAccountsManager(new Manager($this));
28:
29: return false;
30: }
31:
32: public function onAfterCreateAccount($aArguments, &$mResult)
33: {
34: \Aurora\System\Api::GetModule('Mail')->setAccountsManager(new Manager($this));
35:
36: return false;
37: }
38:
39: /**
40: *
41: * @param array $aArguments
42: * @param mixed $mResult
43: */
44: public function onAfterGetSettings($aArguments, &$mResult)
45: {
46: $mResult['AllowMultiAccounts'] = true;
47:
48: return false;
49: }
50: }
51: