diff --git a/modules/smtp/functions.php b/modules/smtp/functions.php index d159ed8d93..a484fa65c4 100644 --- a/modules/smtp/functions.php +++ b/modules/smtp/functions.php @@ -33,3 +33,16 @@ function delete_smtp_server($smtp_server_id) { Hm_SMTP_List::del($smtp_server_id); } } + +if (!hm_exists('get_reply_type')) { + function get_reply_type($request) { + if (array_key_exists('reply', $request) && $request['reply']) { + return 'reply'; + } elseif (array_key_exists('reply_all', $request) && $request['reply_all']) { + return 'reply_all'; + } elseif (array_key_exists('forward', $request) && $request['forward']) { + return 'forward'; + } + return false; + } +} diff --git a/modules/smtp/modules.php b/modules/smtp/modules.php index 352a18a28b..ffb2938c4f 100644 --- a/modules/smtp/modules.php +++ b/modules/smtp/modules.php @@ -28,8 +28,12 @@ public function process() { $this->request->get['uid'] ); $reply_details = $this->session->get($cache_name, false); + if ($reply_details) { - recip_count_check($reply_details['msg_headers'], $this); + $reply_type = get_reply_type($this->request->get); + if ($reply_type == 'reply_all') { + recip_count_check($reply_details['msg_headers'], $this); + } $this->out('reply_details', $reply_details); } } @@ -310,21 +314,13 @@ public function process() { } $draft = array(); $draft_id = next_draft_key($this->session); - $reply_type = false; - if (array_key_exists('reply', $this->request->get) && $this->request->get['reply']) { - $reply_type = 'reply'; - } - elseif (array_key_exists('reply_all', $this->request->get) && $this->request->get['reply_all']) { - $reply_type = 'reply_all'; - } - elseif (array_key_exists('forward', $this->request->get) && $this->request->get['forward']) { - $reply_type = 'forward'; + $reply_type = get_reply_type($this->request->get); + if ($reply_type == 'forward') { $draft_id = $this->get('compose_draft_id', -1); if ($draft_id >= 0) { $draft = get_draft($draft_id, $this->session); } - } - elseif (array_key_exists('draft_id', $this->request->get)) { + } elseif (array_key_exists('draft_id', $this->request->get)) { $draft = get_draft($this->request->get['draft_id'], $this->session); $draft_id = $this->request->get['draft_id']; } @@ -2160,9 +2156,11 @@ function default_smtp_server($user_config, $session, $request, $config, $user, $ function recip_count_check($headers, $omod) { $headers = lc_headers($headers); $recip_count = 0; + if (array_key_exists('to', $headers) && $headers['to']) { $recip_count += count(process_address_fld($headers['to'])); } + if (array_key_exists('cc', $headers) && $headers['cc']) { $recip_count += count(process_address_fld($headers['cc'])); }