Add wildcard domain support in preconfig
Use '*' as a catch-all domain key in ident_switch.preconfig to provide default settings for any domain not explicitly listed.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
/*
|
/*
|
||||||
* Preconfigured settings for different mail domains.
|
* Preconfigured settings for different mail domains.
|
||||||
* Appropriate set of values is searched by mapping domain of email (from identity) to array key.
|
* Appropriate set of values is searched by mapping domain of email (from identity) to array key.
|
||||||
|
* Use '*' as a wildcard to match any domain not explicitly listed.
|
||||||
*/
|
*/
|
||||||
$config['ident_switch.preconfig'] = [
|
$config['ident_switch.preconfig'] = [
|
||||||
|
|
||||||
@@ -49,6 +50,13 @@ $config['ident_switch.preconfig'] = [
|
|||||||
'smtp_host' => 'tls://mail.another.tld:587',
|
'smtp_host' => 'tls://mail.another.tld:587',
|
||||||
'user' => 'mbox',
|
'user' => 'mbox',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Wildcard: default settings for any domain not listed above.
|
||||||
|
// '*' => [
|
||||||
|
// 'imap_host' => 'ssl://mail.example.com:993',
|
||||||
|
// 'smtp_host' => 'tls://mail.example.com:587',
|
||||||
|
// 'user' => 'email',
|
||||||
|
// ],
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class IdentSwitchPreconfig
|
|||||||
$this->plugin->load_config();
|
$this->plugin->load_config();
|
||||||
|
|
||||||
$cfg = rcmail::get_instance()->config->get('ident_switch.preconfig', []);
|
$cfg = rcmail::get_instance()->config->get('ident_switch.preconfig', []);
|
||||||
$cfg = $cfg[$dom] ?? null;
|
$cfg = $cfg[$dom] ?? $cfg['*'] ?? null;
|
||||||
|
|
||||||
if ($cfg) {
|
if ($cfg) {
|
||||||
if (empty($cfg['imap_host']) && empty($cfg['host'])) {
|
if (empty($cfg['imap_host']) && empty($cfg['host'])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user