From 90180eff2f9e7dcf4112c815a94dce774deeda21 Mon Sep 17 00:00:00 2001
From: till <till@php.net>
Date: Mon, 11 Feb 2008 19:03:43 -0500
Subject: [PATCH] * added bad_date_display.patch from #1484577

---
 program/lib/imap.inc |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index a2a63d9..39a4cb4 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1520,7 +1520,7 @@
     $request .= " FETCH $message_set (BODY.PEEK[HEADER.FIELDS ";
     $request .= "(DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC ";
     $request .= "CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID ";
-    $request .= "REFERENCES DISPOSITION-NOTIFICATION-TO X-PRIORITY)])\r\n";
+    $request .= "REFERENCES RECEIVED DISPOSITION-NOTIFICATION-TO X-PRIORITY)])\r\n";
 
 	if (!fputs($fp, $request)) {
 	    return false;
@@ -1547,7 +1547,7 @@
 				$line = chop(iil_ReadLine($fp, 300), "\r\n");
 				if (ord($line[0])<=32) {
 				    $lines[$i] .= (empty($lines[$i])?'':"\n").trim(chop($line));
-				} else{
+				} else {
 					$i++;
 					$lines[$i] = trim(chop($line));
 				}
@@ -1564,14 +1564,17 @@
 				if (preg_match("/^\s*UID [0-9]+\)$/",$line)) {
 				    break;
                 }
-			} while (trim($line[0]) != ')' && strncmp($line, $key, strlen($key)));  // patch from "Maksim Rubis" <siburny@hotmail.com>
+            // patch from "Maksim Rubis" <siburny@hotmail.com>
+			} while (trim($line[0]) != ')' && strncmp($line, $key, strlen($key)));
 			
             if (strncmp($line, $key, strlen($key))) { 
     			//process header, fill iilBasicHeader obj.
     			//	initialize
     			if (is_array($headers)) {
     				reset($headers);
-    				while ( list($k, $bar) = each($headers) ) $headers[$k] = '';
+    				while (list($k, $bar) = each($headers)) {
+                        $headers[$k] = '';
+                    }
     			}
     
     			//	create array with header field:data
@@ -1585,6 +1588,15 @@
 						$result[$id]->date      = $string;
 						$result[$id]->timestamp = iil_StrToTime($string);
 						break;
+                    case 'received':
+                        if (!isset($result[$id]->date)) {
+                            $_received = substr(strstr(str_replace("\n",
+                                '', $string), '; '), 2);
+    
+                            $result[$id]->date      = str_replace("\n", '', $_received);
+                            $result[$id]->timestamp = iil_StrToTime($_received);
+                        }
+                        break;
 					case 'from':
 						$result[$id]->from = $string;
 						break;

--
Gitblit v1.9.1