Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ DEFAULT_SETTING_ENABLE_KEYBOARD_SHORTCUTS=false
DEFAULT_SETTING_ENABLE_SIEVE_FILTER=false
DEFAULT_SETTING_ENABLE_COLLECT_ADDRESS_ON_SEND=false

DEFAULT_SETTING_ENABLE_EXCLUDE_AUTO_BCC=true


APP_2FA_SECRET=""
APP_2FA_SIMPLE=false
Expand Down
6 changes: 6 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,12 @@
*/
'default_setting_enable_collect_address_on_send' => env('DEFAULT_SETTING_ENABLE_COLLECT_ADDRESS_ON_SEND', false),

/*
| This will not include auto-bcc'ed messages
| Defaults to true
*/
'default_setting_enable_exclude_auto_bcc' => env('DEFAULT_SETTING_ENABLE_EXCLUDE_AUTO_BCC', true),

/*
|
| Timezone for date displays
Expand Down
1 change: 1 addition & 0 deletions lib/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function define_default_constants($config) {
define('DEFAULT_ENABLE_SIEVE_FILTER', $config->get('default_setting_enable_sieve_filter', false));
define('DEFAULT_DEBUG_LOG', $config->get('debug_log', false));
define('DEFAULT_ENABLE_COLLECT_ADDRESS_ON_SEND', $config->get('default_setting_enable_collect_address_on_send', false));
define('DEFAULT_SETTING_ENABLE_EXCLUDE_AUTO_BCC', $config->get('default_setting_enable_exclude_auto_bcc', true));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion modules/imap/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,8 @@ public function process() {
if($this->get('list_path') == 'snoozed' && !$mailbox->folder_exists('Snoozed')) {
continue;
}
$uids = $mailbox->search(hex2bin($folders[$key]), $filter, $terms, $sort, $reverse);
$enable_exclude_auto_bcc = $this->user_config->get('enable_exclude_auto_bcc_setting', DEFAULT_SETTING_ENABLE_EXCLUDE_AUTO_BCC);
$uids = $mailbox->search(hex2bin($folders[$key]), $filter, $terms, $sort, $reverse, true, $enable_exclude_auto_bcc);

$total = count($uids);
$uids = array_slice($uids, 0, $limit);
Expand Down
31 changes: 31 additions & 0 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ function smtp_auto_bcc_callback($val) { return $val; }
}
}

/**
* @subpackage smtp/handler
*/
class Hm_Handler_process_enable_exclude_auto_bcc extends Hm_Handler_Module {
public function process() {
function enable_exclude_auto_bcc_callback($val) { return $val; }
process_site_setting('enable_exclude_auto_bcc', $this, 'enable_exclude_auto_bcc_callback', DEFAULT_SETTING_ENABLE_EXCLUDE_AUTO_BCC, true);
}
}

/**
* @subpackage smtp/handler
*/
Expand Down Expand Up @@ -1399,6 +1409,27 @@ protected function output() {
}
}

/**
* @subpackage smtp/output
*/
class Hm_Output_exclude_auto_bcc_setting extends Hm_Output_Module {
protected function output() {
$auto = DEFAULT_SETTING_ENABLE_EXCLUDE_AUTO_BCC;
$settings = $this->get('user_settings', array());
if (array_key_exists('enable_exclude_auto_bcc', $settings)) {
$auto = $settings['enable_exclude_auto_bcc'];
}
$res = '<tr class="general_setting"><td><label class="form-check-label" for="enable_exclude_auto_bcc">'.$this->trans('Enable exclude auto BCC').'</label></td><td><input class="form-check-input" value="0" type="checkbox" name="enable_exclude_auto_bcc" id="enable_exclude_auto_bcc" data-default-value="true"';
$reset = '';
if ($auto) {
$res .= ' checked="checked"';
$reset = '<span class="tooltip_restore" restore_aria_label="Restore default value"><i class="bi bi-arrow-counterclockwise refresh_list reset_default_value_checkbox"></i></span>';
}
$res .= '>'.$reset.'</td></tr>';
return $res;
}
}

/**
* @subpackage smtp/output
*/
Expand Down
3 changes: 3 additions & 0 deletions modules/smtp/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@

add_handler('settings', 'process_compose_type', true, 'smtp', 'save_user_settings', 'before');
add_handler('settings', 'process_auto_bcc', true, 'smtp', 'save_user_settings', 'before');
add_handler('settings', 'process_enable_exclude_auto_bcc', true, 'smtp', 'save_user_settings', 'before');
add_output('settings', 'compose_type_setting', true, 'smtp', 'start_general_settings', 'after');
add_output('settings', 'auto_bcc_setting', true, 'smtp', 'compose_type_setting', 'after');
add_output('settings', 'exclude_auto_bcc_setting', true, 'smtp', 'auto_bcc_setting', 'after');
add_handler('settings', 'attachment_dir', true, 'smtp', 'save_user_settings', 'after');
add_output('settings', 'attachment_setting', true, 'smtp', 'compose_type_setting', 'after');

Expand Down Expand Up @@ -204,6 +206,7 @@
'draft_in_reply_to' => FILTER_UNSAFE_RAW,
'draft_notice' => FILTER_VALIDATE_BOOLEAN,
'smtp_auto_bcc' => FILTER_VALIDATE_INT,
'enable_exclude_auto_bcc' => FILTER_VALIDATE_INT,
'profile_value' => FILTER_UNSAFE_RAW,
'uploaded_files' => FILTER_UNSAFE_RAW,
'send_uploaded_files' => FILTER_UNSAFE_RAW,
Expand Down
Loading