Add alias SMTP/Sieve resolution, debug logging, and exclude aliases from switcher

SMTP and Sieve hooks follow parent_id to resolve alias config from parent
account. Aliases excluded from account switcher dropdown and background
mail checker. Debug logging behind ident_switch.debug config flag.
Fix double ssl:// prefix in switch_account host parsing.
This commit is contained in:
Laurent Dinclaux
2026-02-10 22:28:56 +11:00
parent e4bd92ca63
commit 08673a4399
4 changed files with 75 additions and 13 deletions

View File

@@ -190,7 +190,7 @@ class ident_switch extends rcube_plugin
. " FROM"
. " {$rc->db->table_name(self::TABLE)} isw"
. " INNER JOIN {$rc->db->table_name('identities')} ii ON isw.iid=ii.identity_id"
. " WHERE isw.user_id = ? AND isw.flags & ? > 0";
. " WHERE isw.user_id = ? AND isw.flags & ? > 0 AND isw.parent_id IS NULL";
$qRec = $rc->db->query($sql, $rc->user->data['user_id'], self::DB_ENABLED);
while ($r = $rc->db->fetch_assoc($qRec)) {
$accValues[] = $r['id'];
@@ -419,4 +419,16 @@ class ident_switch extends rcube_plugin
{
rcmail::get_instance()->write_log('ident_switch', $txt);
}
/**
* Write a debug message (only when ident_switch.debug is enabled).
*
* @param string $txt Log message.
*/
public static function debug_log(string $txt): void
{
if (rcmail::get_instance()->config->get('ident_switch.debug', false)) {
rcmail::get_instance()->write_log('ident_switch', '[DEBUG] ' . $txt);
}
}
}