X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Flistcommands%2Ffunctions.php;h=8b64d60df10cfc2cfd285096936243e3defb519f;hb=c997cbe6f5a46d432d7733acb207dfcdfd00e49e;hp=5e71da5c7a1d818f69d217ce303369eed212de09;hpb=57f170c8a33fd7d45768c71b27f0b3e9dbee0aa9;p=squirrelmail.git diff --git a/plugins/listcommands/functions.php b/plugins/listcommands/functions.php index 5e71da5c..8b64d60d 100644 --- a/plugins/listcommands/functions.php +++ b/plugins/listcommands/functions.php @@ -8,7 +8,7 @@ * this plugin displays a menu which gives the user a choice of mailinglist * commands such as (un)subscribe, help and list archives. * - * @copyright 1999-2015 The SquirrelMail Project Team + * @copyright 1999-2021 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package plugins @@ -84,18 +84,48 @@ function plugin_listcommands_menu_do() { /* proto = {mailto,href} */ $aActions = array_keys($actions); + // note that we only use the first cmd/action, ignore the rest $proto = array_shift($aActions); $act = array_shift($actions); if ($proto == 'mailto') { + $identity = ''; + if (($cmd == 'post') || ($cmd == 'owner')) { $url = 'src/compose.php?'. (isset($startMessage)?'startMessage='.$startMessage.'&':''); } else { $url = "plugins/listcommands/mailout.php?action=$cmd&"; + + // try to find which identity the mail should come from + include_once(SM_PATH . 'functions/identity.php'); + $idents = get_identities(); + // ripped from src/compose.php + $identities = array(); + if (count($idents) > 1) { + foreach($idents as $nr=>$data) { + $enc_from_name = '"'.$data['full_name'].'" <'. $data['email_address'].'>'; + $identities[] = $enc_from_name; + } + + $identity_match = $message->rfc822_header->findAddress($identities); + if ($identity_match !== FALSE) { + $identity = $identity_match; + } + } } - $url .= 'send_to=' . urlencode($act); + + // if things like subject are given, peel them off and give + // them to src/compose.php as is (not encoded) + if (strpos($act, '?') > 0) { + list($act, $parameters) = explode('?', $act, 2); + $parameters = '&identity=' . $identity . '&' . $parameters; + } else { + $parameters = '&identity=' . $identity; + } + + $url .= 'send_to=' . urlencode($act) . $parameters; $links[$cmd] = makeComposeLink($url, $fieldsdescr[$cmd]);