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: use Aurora\Modules\Mail\Module as MailModule;
10:
11: /**
12: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
13: * @copyright Copyright (c) 2023, Afterlogic Corp.
14: *
15: * @property Settings $oModuleSettings
16: *
17: * @package Modules
18: */
19: class Module extends \Aurora\System\Module\AbstractLicensedModule
20: {
21: public function init()
22: {
23: $this->subscribeEvent('Mail::CreateAccount::before', array($this, 'onBeforeCreateAccount'));
24: $this->subscribeEvent('Mail::CreateAccount::after', array($this, 'onAfterCreateAccount'));
25:
26: $this->subscribeEvent('Mail::GetSettings::after', array($this, 'onAfterGetSettings'));
27: }
28:
29: /**
30: * @return Module
31: */
32: public static function getInstance()
33: {
34: return parent::getInstance();
35: }
36:
37: /**
38: * @return Module
39: */
40: public static function Decorator()
41: {
42: return parent::Decorator();
43: }
44:
45: /**
46: * @return Settings
47: */
48: public function getModuleSettings()
49: {
50: return $this->oModuleSettings;
51: }
52:
53: public function onBeforeCreateAccount($aArguments, &$mResult)
54: {
55: MailModule::getInstance()->setAccountsManager(new Manager($this));
56:
57: return false;
58: }
59:
60: public function onAfterCreateAccount($aArguments, &$mResult)
61: {
62: MailModule::getInstance()->setAccountsManager(new Manager($this));
63:
64: return false;
65: }
66:
67: /**
68: *
69: * @param array $aArguments
70: * @param mixed $mResult
71: */
72: public function onAfterGetSettings($aArguments, &$mResult)
73: {
74: $mResult['AllowMultiAccounts'] = true;
75:
76: return false;
77: }
78: }
79: