From 3e69e88b2bd4d8ed662ff6443aa4567bf1c26be2 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Wed, 21 Jun 2000 17:28:05 +0000 Subject: [PATCH] made message highlighting be more flexible. You can now highlight messages based upon "from", "to", or "subject". git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@552 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_messages.php | 24 ++++++++++++------------ functions/mailbox_display.php | 4 +++- src/load_prefs.php | 1 + src/msg_highlight.php | 17 ++++++++++++++--- src/options.php | 2 +- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 8e4be59f..9e428d66 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -41,7 +41,7 @@ ** Returns some general header information -- FROM, DATE, and SUBJECT ******************************************************************************/ class small_header { - var $from, $subject, $date; + var $from, $subject, $date, $to; } function sqimap_get_small_header ($imap_stream, $id, $sent) { @@ -52,16 +52,12 @@ $from = _("Unknown Sender"); $g = 0; for ($i = 0; $i < count($read); $i++) { - if ($sent == true) { - if (eregi ("^to:", $read[$i])) { - $from = sqimap_find_displayable_name(substr($read[$i], 3)); - } - } else { - if (eregi ("^from:", $read[$i])) { - $from = sqimap_find_displayable_name(substr($read[$i], 5)); - } - } - + if (eregi ("^to:", $read[$i])) { + $to = sqimap_find_displayable_name(substr($read[$i], 3)); + } + if (eregi ("^from:", $read[$i])) { + $from = sqimap_find_displayable_name(substr($read[$i], 5)); + } if (eregi ("^date:", $read[$i])) { $date = substr($read[$i], 5); } else if (eregi ("^subject:", $read[$i])) { @@ -72,9 +68,13 @@ } $header = new small_header; - $header->from = $from; + if ($sent == true) + $header->from = $to; + else + $header->from = $from; $header->date = $date; $header->subject = $subject; + $header->to = $to; return $header; } diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index afdbdb5c..5d95cdfe 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -27,7 +27,7 @@ if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } for ($i=0; $i < count($message_highlight_list); $i++) { - if (eregi($message_highlight_list[$i]["value"],$msg["FROM"])) { + if (eregi($message_highlight_list[$i]["value"],$msg[strtoupper($message_highlight_list[$i]["match_type"])])) { $hlt_color = $message_highlight_list[$i]["color"]; continue; } @@ -64,6 +64,7 @@ $from[$q] = $hdr->from; $date[$q] = $hdr->date; $subject[$q] = $hdr->subject; + $to[$q] = $hdr->to; $flags[$q] = sqimap_get_flags ($imapConnection, $q+1); } @@ -79,6 +80,7 @@ $messages[$j]["ID"] = $j+1; $messages[$j]["FROM"] = decodeHeader($from[$j]); $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]); + $messages[$j]["TO"] = decodeHeader($to[$j]); $num = 0; while ($num < count($flags[$j])) { diff --git a/src/load_prefs.php b/src/load_prefs.php index 2a24938c..b30859c9 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -107,5 +107,6 @@ $message_highlight_list[$i]["name"] = $ary[0]; $message_highlight_list[$i]["color"] = $ary[1]; $message_highlight_list[$i]["value"] = $ary[2]; + $message_highlight_list[$i]["match_type"] = $ary[3]; } ?> diff --git a/src/msg_highlight.php b/src/msg_highlight.php index a92bca57..7fbca45b 100644 --- a/src/msg_highlight.php +++ b/src/msg_highlight.php @@ -23,10 +23,11 @@ $newcolor = ereg_replace("#", "", $newcolor); $newcolor = "$newcolor"; $value = ereg_replace(",", " ", $value); - setPref($data_dir, $username, "highlight$id", $name.",".$newcolor.",".$value); + setPref($data_dir, $username, "highlight$id", $name.",".$newcolor.",".$value.",".$match_type); $message_highlight_list[$id]["name"] = $name; $message_highlight_list[$id]["color"] = $newcolor; $message_highlight_list[$id]["value"] = $value; + $message_highlight_list[$id]["match_type"] = $match_type; } include("../src/load_prefs.php"); displayPageHeader($color, "None"); @@ -42,7 +43,7 @@ echo " " . $message_highlight_list[$i]["name"]; echo " \n"; echo " \n"; - echo " " . $message_highlight_list[$i]["value"]; + echo " ".$message_highlight_list[$i]["match_type"]." = " . $message_highlight_list[$i]["value"]; echo " \n"; echo "\n"; } @@ -77,7 +78,9 @@ continue; } } - if (!$selected_choose) + if (!$message_highlight_list[$id]["color"]) + $selected_choose = " checked"; + else if (!$selected_choose) $selected_input = " checked"; echo "
\n"; @@ -125,6 +128,14 @@ echo _("Match") . ":"; echo " \n"; echo " \n"; + echo " \n"; echo " "; echo " \n"; echo " \n"; diff --git a/src/options.php b/src/options.php index 6e7c9aee..83a6fd31 100644 --- a/src/options.php +++ b/src/options.php @@ -414,7 +414,7 @@ echo " " . $message_highlight_list[$i]["name"]; echo " \n"; echo " \n"; - echo " " . $message_highlight_list[$i]["value"]; + echo " ".$message_highlight_list[$i]["match_type"]." = " . $message_highlight_list[$i]["value"]; echo " \n"; echo "\n"; } -- 2.25.1