diff --git a/plugins/managesieve/config.inc.php.dist b/plugins/managesieve/config.inc.php.dist index 9efb82713..1d016b9e4 100644 --- a/plugins/managesieve/config.inc.php.dist +++ b/plugins/managesieve/config.inc.php.dist @@ -121,3 +121,10 @@ $config['managesieve_raw_editor'] = true; // list_sets, enable_disable_set, delete_set, new_set, download_set, new_rule, delete_rule // Note: disabling list_sets removes the Filter sets widget from the UI and means the set defined in managesieve_script_name will always be used (and activated) $config['managesieve_disabled_actions'] = array(); + +// Allowed hosts +// Only activate managesieve for selected hosts +// If this is not set, existing behaviour is maintained. +// If set, managesieve will work only for hosts contained in the managesieve_allowed_hosts array +// $config['managesieve_allowed_hosts'] = array('host1.mydomain.com','host2.mydomain.com'); + diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index 0012d0ba6..f42ca2683 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -101,7 +101,13 @@ class managesieve extends rcube_plugin function settings_actions($args) { $this->load_config(); - + + if( $this->rc->config->get('managesieve_allowed_hosts') !== null && + ! in_array( $this->rc->user->data['mail_host'], + $this->rc->config->get('managesieve_allowed_hosts') ) ){ + return; + } + $vacation_mode = (int) $this->rc->config->get('managesieve_vacation'); $forward_mode = (int) $this->rc->config->get('managesieve_forward');