Selaa lähdekoodia

If a message has attachments, it is shown in the message index by putting
a "+" in the flags area.

Luke Ehresman 25 vuotta sitten
vanhempi
commit
c1be332c49
4 muutettua tiedostoa jossa 30 lisäystä ja 5 poistoa
  1. 1 0
      ChangeLog
  2. 1 1
      config/config_default.php
  3. 10 1
      functions/imap_messages.php
  4. 18 3
      functions/mailbox_display.php

+ 1 - 0
ChangeLog

@@ -1,5 +1,6 @@
 Version 0.6pre1 -- DEVELOPMENT
 ------------------------------
+- Attachments are shown in message index (shown as a "+")
 - Updated attachment plugin support and passing values to hooks (see plugins.txt)
 - Added file and message size in many locations
 - Made message index order customizable (from, subject, date) can be (date, from, subject)

+ 1 - 1
config/config_default.php

@@ -9,7 +9,7 @@
 //
 
     // don't change
-    $config_version = "x53";
+    $config_version = "x61";
 
 //  Organization's logo picture (blank if none)
     $org_logo = "../images/sm_logo.jpg";

+ 10 - 1
functions/imap_messages.php

@@ -46,7 +46,7 @@
 	 
    function sqimap_get_small_header ($imap_stream, $id, $sent) {
 
-      fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority)]\r\n");
+      fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority Content-Type)]\r\n");
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
 
       $subject = _("(no subject)");
@@ -74,7 +74,14 @@
             $subject = htmlspecialchars(eregi_replace ("^subject: ", "", $read[$i]));
             if (trim($subject) == "")
                $subject = _("(no subject)");
+         } else if (eregi ("^content-type:", $read[$i])) {
+            $type = substr($read[$i], 14);
+            $type = strtolower(trim($type));
+            if ($pos = strpos($type, ";"))
+               $type = substr($type, 0, $pos);
+            $type = explode("/", $type);
          }
+         
       }
 
       // If there isn't a date, it takes the internal date and uses
@@ -110,6 +117,8 @@
       $header->message_id = $messageid;
       $header->cc = $cc;
       $header->size = $size;
+      $header->type0 = $type[0];
+      $header->type1 = $type[1];
 
       return $header;
    }

+ 18 - 3
functions/mailbox_display.php

@@ -66,9 +66,22 @@
                echo "   <td bgcolor=$hlt_color>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0$search_stuff\">$flag$subject$flag_end</a>$bold_end</td>\n";
                break;
             case 5: # flags
-               if ($msg["FLAG_ANSWERED"] == true) echo "   <td bgcolor=$hlt_color width=1%><b><small>A</small></b></td>\n";
-               elseif (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) echo "   <td bgcolor=$hlt_color width=1%><b><small><font color=$color[1]>!</font></small></b></td>\n";
-               else    echo "   <td bgcolor=$hlt_color width=1%>&nbsp;</td>\n";
+               $stuff = false;
+               echo "   <td bgcolor=$hlt_color width=1%><b><small>\n";
+               if ($msg["FLAG_ANSWERED"] == true) {
+                  echo "A\n";
+                  $stuff = true;
+               } 
+               if ($msg["TYPE0"] == "multipart") {
+                  echo "+\n";
+                  $stuff = true;
+               } 
+               if (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) {
+                  echo "<font color=$color[1]>!</font>\n";
+                  $stuff = true;
+               }
+               if (!$stuff) echo "&nbsp;\n";
+               echo "</small></b></td>\n";
                break;
             case 6: # size   
                echo "   <td bgcolor=$hlt_color width=1%>$bold".show_readable_size($msg['SIZE'])."$bold_end</td>\n";
@@ -109,6 +122,7 @@
                $priority[$q] = $hdr->priority;
                $cc[$q] = $hdr->cc;
                $size[$q] = $hdr->size;
+               $type[$q] = $hdr->type0;
 
                $flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
             }
@@ -130,6 +144,7 @@
 				$messages[$j]["PRIORITY"] = $priority[$j];
             $messages[$j]["CC"] = $cc[$j];
             $messages[$j]["SIZE"] = $size[$j];
+            $messages[$j]["TYPE0"] = $type[$j];
 
             # fix SUBJECT-SORT to remove Re:
             if (substr($messages[$j]["SUBJECT-SORT"], 0, 3) == "re:" ||