fix for broken drafts. Patch from Ryan O'Neill
[squirrelmail.git] / functions / imap_messages.php
index d95531576f997564ba082115f4eaa3af44de3ab4..345221425e4823226b728df32e8ea32de9df7e68 100755 (executable)
@@ -245,7 +245,7 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
 function sqimap_get_flags ($imap_stream, $i) {
     $read = sqimap_run_command ($imap_stream, "FETCH $i:$i FLAGS", true, $response, $message);
     if (ereg("FLAGS(.*)", $read[0], $regs)) {
-        return explode(" ", trim(ereg_replace('[\\(\\)\\\\]', '', $regs[1])));
+        return explode(' ', trim(ereg_replace('[\\(\\)\\\\]', '', $regs[1])));
     }
     return Array('None');
 }
@@ -264,11 +264,11 @@ function sqimap_get_flags_list ($imap_stream, $msg_list) {
             $result_flags[$id2index[$regs[1]]] = explode(" ", trim(ereg_replace('[\\(\\)\\\\]', '', $regs[2])));
         } else {
             set_up_language($squirrelmail_language);
-            echo "<br><b><font color=$color[2]>\n";
-            echo _("ERROR : Could not complete request.");
-            echo "</b><br>\n";
-            echo _("Unknown response from IMAP server: ");
-            echo $result_list[$i][0] . "</font><br>\n";
+            echo "<br><b><font color=$color[2]>\n" .
+                 _("ERROR : Could not complete request.") .
+                 "</b><br>\n" .
+                 _("Unknown response from IMAP server: ") .
+                 $result_list[$i][0] . "</font><br>\n";
             exit;
         }
     }
@@ -298,6 +298,18 @@ function sqimap_get_message_header ($imap_stream, $id, $mailbox) {
     return $header;
 }
 
+/****************************************************************************
+ **  Wrapper function that reformats the entity header information.
+ ****************************************************************************/
+function sqimap_get_ent_header ($imap_stream, $id, $mailbox, $ent) {
+    $read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.HEADER]", true, $response, $message);
+    $header = sqimap_get_header($imap_stream, $read); 
+    $header->id = $id;
+    $header->mailbox = $mailbox;
+    return $header;
+}
+
+
 /****************************************************************************
  **  Wrapper function that returns entity headers for use by decodeMime
  ****************************************************************************/