From d6043e29077a00c6d0b8e60058088c6de35e3732 Mon Sep 17 00:00:00 2001 From: fidian Date: Mon, 25 Jun 2001 16:00:54 +0000 Subject: [PATCH] Removed all of your own email addresses from the CC when replying to all. Kept the ones in the TO, since you theoretically could reply to yourself and you'd want something always in the TO field anyway. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1418 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/read_body.php | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/read_body.php b/src/read_body.php index d4105209..78cf9ba5 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -101,6 +101,17 @@ return -1; } + // Removes just one address from the list of addresses + function RemoveAddress(&$addr_list, $addr) { + if ($addr == '') + return; + foreach (array_keys($addr_list, $addr) as $key_to_delete) + { + unset($addr_list[$key_to_delete]); + } + } + + // returns the index of the previous message from the array function findPreviousMessage() { global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection, $mailbox; @@ -174,16 +185,27 @@ $url_replytoall_avoid_addrs = parseAddrs($message->header->replyto); foreach ($url_replytoall_avoid_addrs as $addr) { - foreach (array_keys($url_replytoall_extra_addrs, $addr) as $key_to_delete) + RemoveAddress($url_replytoall_extra_addrs, $addr); + } + + // 6) Remove our identities from the CC list (they still can be in the + // TO list) + RemoveAddress($url_replytoall_extra_addrs, getPref($data_dir, $username, + 'email_address')); + $idents = getPref($data_dir, $username, 'identities'); + if ($idents != '' && $idents > 1) + { + for ($i = 1; $i < $idents; $i ++) { - unset($url_replytoall_extra_addrs[$key_to_delete]); + RemoveAddress($url_replytoall_extra_addrs, + getPref($data_dir, $username, 'email_address' . $i)); } } - // 6) Smoosh back into one nice line + // 7) Smoosh back into one nice line $url_replytoallcc = getLineOfAddrs($url_replytoall_extra_addrs); - // 7) urlencode() it + // 8) urlencode() it $url_replytoallcc = urlencode($url_replytoallcc); $dateString = getLongDateString($message->header->date); -- 2.25.1