added 'References:' and 'In-Reply-To:' to sqimap_get_small_header_list in preperation...
[squirrelmail.git] / functions / imap_messages.php
index 031122c9ed48e812dbad76f85890fb058ed573fc..8a1e129b6f77ad3451631c39036c9aafc3c542fc 100755 (executable)
@@ -95,7 +95,7 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
         $id2index[$msg_list[$i]] = $i;
     }
 
-    $query = "$sid FETCH $msgs_str BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority Content-Type)]\r\n";
+    $query = "$sid FETCH $msgs_str BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority Content-Type References In-Reply-To)]\r\n";
     fputs ($imap_stream, $query);
     $readin_list = sqimap_read_data_list($imap_stream, $sid, true, $response, $message);
 
@@ -157,6 +157,8 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
         $date = "";
         $type[0] = "";
         $type[1] = "";
+        $ref = "";
+        $inreplyto = "";
         $read = $read_list[$msgi];
 
         foreach ($read as $read_part) {
@@ -186,6 +188,10 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
                 if (!isset($type[1])) {
                     $type[1] = '';
                 }
+            } else if (eregi ("^references:(.*)$", $read_part, $regs)) {
+                $ref = $regs[1];  
+            } else if (eregi ("^in-reply-to:(.*)$", $read_part, $regs)) {
+                $inreplyto = $regs[1];
             }
         }
         $internaldate = getPref($data_dir, $username, 'internal_date_sort');
@@ -217,6 +223,8 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
         $header->size = $size;
         $header->type0 = $type[0];
         $header->type1 = $type[1];
+        $header->references = $ref;
+        $header->inreplyto = $inreplyto;
 
         $result[] = $header;
     }