From be2380fb47b05a222ec5b22deff36d5156a8c943 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Fri, 13 Jan 2006 13:08:41 -0500 Subject: [PATCH] Added labels for LDAP search --- program/lib/imap.inc | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/program/lib/imap.inc b/program/lib/imap.inc index fc5ff09..daacb03 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -607,7 +607,7 @@ return $time2; } -function iil_C_Sort(&$conn, $mailbox, $field){ +function iil_C_Sort(&$conn, $mailbox, $field, $add=''){ /* Do "SELECT" command */ if (!iil_C_Select($conn, $mailbox)) return false; @@ -618,7 +618,8 @@ if (!$fields[$field]) return false; $fp = $conn->fp; - $command = 's SORT ('.$field.') US-ASCII ALL'."\r\n"; + $command = 's SORT ('.$field.') US-ASCII ALL '."$add\r\n"; + //$command = 's SORT ('.$field.') US-ASCII ALL UNDELETED'."\r\n"; $line = $data = ''; if (!fputs($fp, $command)) return false; @@ -1220,8 +1221,10 @@ $i++; $lines[$i] = trim(chop($line)); } - }while($line[0]!=")"); + }while($line[0]!=")" && strncmp($line, $key, strlen($key))); // patch from "Maksim Rubis" <siburny@hotmail.com> + if(strncmp($line, $key, strlen($key))) + { //process header, fill iilBasicHeader obj. // initialize if (is_array($headers)){ @@ -1256,6 +1259,10 @@ if ($messageID) $messageID = substr(substr($messageID, 1), 0, strlen($messageID)-2); else $messageID = "mid:".$id; $result[$id]->messageID = $messageID; + } + else { + $a=explode(" ", $line); + } } }while(strcmp($a[0], $key)!=0); @@ -1371,6 +1378,7 @@ if ($field=="date"||$field=='internaldate') $field="timestamp"; if (empty($flag)) $flag="ASC"; $flag=strtoupper($flag); + $stripArr = ($field=='subject') ? array('Re: ','Fwd: ','Fw: ',"\"") : array("\""); $c=count($a); if ($c>0){ @@ -1386,7 +1394,7 @@ reset($a); while (list($key, $val)=each($a)){ $data=$a[$key]->$field; - if (is_string($data)) $data=strtoupper(str_replace("\"", "", $data)); + if (is_string($data)) $data=strtoupper(str_replace($stripArr, "", $data)); $index[$key]=$data; } @@ -1885,7 +1893,7 @@ } } -function iil_C_Append(&$conn, $folder, $message){ +function iil_C_Append(&$conn, $folder, &$message){ if (!$folder) return false; $fp = $conn->fp; -- Gitblit v1.9.1