Browse Source

Added X-Priority Detection Now puts a "!" in the coloum after Date if the message has an X-Priority value of "1" Highest.

oricn 25 years ago
parent
commit
43feb145b7
2 changed files with 12 additions and 4 deletions
  1. 7 3
      functions/imap_messages.php
  2. 5 1
      functions/mailbox_display.php

+ 7 - 3
functions/imap_messages.php

@@ -41,15 +41,16 @@
     **  Returns some general header information -- FROM, DATE, and SUBJECT
     ******************************************************************************/
 	class small_header {
-		var $from, $subject, $date, $to;
+		var $from, $subject, $date, $to, $priority;
 	}
 	 
    function sqimap_get_small_header ($imap_stream, $id, $sent) {
-      fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Subject)]\r\n");
+      fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Subject X-Priority)]\r\n");
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
 
       $subject = _("(no subject)");
       $from = _("Unknown Sender");
+      $priority = "0";
 		$g = 0;
       for ($i = 0; $i < count($read); $i++) {
          if (eregi ("^to:", $read[$i])) {
@@ -58,6 +59,9 @@
          if (eregi ("^from:", $read[$i])) {
             $from = sqimap_find_displayable_name(substr($read[$i], 5));
 			}	
+         if (eregi ("^x-priority:", $read[$i])) {
+            $priority = trim(substr($read[$i], 11));
+         }
          if (eregi ("^date:", $read[$i])) {
             $date = substr($read[$i], 5);
          } else if (eregi ("^subject:", $read[$i])) {
@@ -75,7 +79,7 @@
 		$header->date = $date;
 		$header->subject = $subject;
       $header->to = $to;
-
+      $header->priority = $priority;
 		return $header;
    }
 

+ 5 - 1
functions/mailbox_display.php

@@ -8,7 +8,7 @@
     **
     **/
 
-   $mailbox_info = true;
+   $mailbox_display_php = true;
 
    function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) {
       global $color, $msgs, $msort;
@@ -39,6 +39,7 @@
       echo "   <td width=30% bgcolor=$hlt_color>$italic$bold$flag$senderName$flag_end$bold_end$italic_end</td>\n";
       echo "   <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
 		if ($msg["FLAG_ANSWERED"] == true) echo "   <td bgcolor=$hlt_color width=1%><b><small>A</small></b></td>";
+		elseif ($msg["PRIORITY"] == 1) echo "   <td bgcolor=$hlt_color width=1%><b><small>!</small></b></td>";
 		else	echo "   <td bgcolor=$hlt_color width=1%>&nbsp;</td>";
       echo "   <td bgcolor=$hlt_color width=%>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0\">$flag$subject$flag_end</a>$bold_end</td>\n";
 
@@ -65,6 +66,7 @@
 					$date[$q] = $hdr->date;
 					$subject[$q] = $hdr->subject;
                $to[$q] = $hdr->to;
+               $priority[$q] = $hdr->priority;
 
                $flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
             }
@@ -81,6 +83,7 @@
             $messages[$j]["FROM"] = decodeHeader($from[$j]);
             $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]);
             $messages[$j]["TO"] = decodeHeader($to[$j]);
+				$messages[$j]["PRIORITY"] = $priority[$j];
    
             $num = 0;
             while ($num < count($flags[$j])) {
@@ -275,6 +278,7 @@
             next($msort);
             $k++;
          } while (isset ($key) && ($k < $i));
+	echo $key;
          printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage);
       } else {
          $i = $startMessage;