Add managesieve (Sieve) support for remote accounts

When switching identities, the managesieve plugin still connected to
the default sieve server. Hook into managesieve_connect to redirect
the sieve connection to the remote account's server.

Adds sieve_host, sieve_port and sieve_auth columns to the database,
a Sieve section to the identity settings form, preconfig support for
sieve_host, and localized labels for all 7 languages.
This commit is contained in:
Laurent Dinclaux
2026-02-10 11:05:01 +11:00
parent 546e9ba882
commit 6ea4aee0a7
19 changed files with 346 additions and 3 deletions

View File

@@ -41,6 +41,12 @@ class ident_switch extends rcube_plugin
/** @var int SMTP authentication: no authentication required. */
public const SMTP_AUTH_NONE = 2;
/** @var int Sieve authentication: use same credentials as IMAP. */
public const SIEVE_AUTH_IMAP = 1;
/** @var int Sieve authentication: no authentication required. */
public const SIEVE_AUTH_NONE = 2;
private IdentSwitchForm $form;
private IdentSwitchSwitcher $switcher;
private IdentSwitchPreconfig $preconfig;
@@ -57,6 +63,7 @@ class ident_switch extends rcube_plugin
$this->add_hook('startup', [$this, 'on_startup']);
$this->add_hook('render_page', [$this, 'on_render_page']);
$this->add_hook('smtp_connect', [$this, 'on_smtp_connect']);
$this->add_hook('managesieve_connect', [$this, 'on_managesieve_connect']);
$this->add_hook('identity_form', [$this, 'on_identity_form']);
$this->add_hook('identity_update', [$this, 'on_identity_update']);
$this->add_hook('identity_create', [$this, 'on_identity_create']);
@@ -205,6 +212,17 @@ class ident_switch extends rcube_plugin
return $this->switcher->configure_smtp($args);
}
/**
* Handle managesieve_connect hook: configure Sieve settings for the active account.
*
* @param array $args Hook arguments containing Sieve connection parameters.
* @return array Modified hook arguments with updated Sieve settings.
*/
public function on_managesieve_connect(array $args): array
{
return $this->switcher->configure_managesieve($args);
}
/**
* Handle identity_form hook: add plugin-specific fields to the identity editor.
*