From c9d09bbe43f268c11cadc9846652ff33521edf6c Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Wed, 25 Jan 2006 15:10:12 -0500 Subject: [PATCH] Updated localizations --- program/lib/imap.inc | 49 +++++++++++++++++++++++++++++++++++-------------- 1 files changed, 35 insertions(+), 14 deletions(-) diff --git a/program/lib/imap.inc b/program/lib/imap.inc index 3d37bed..e03abe4 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -23,8 +23,23 @@ Function containing "_C_" in name require connection handler to be passed as one of the parameters. To obtain connection handler, use iil_Connect() + VERSION: + IlohaMail-0.9-20050415 + CHANGES: + File altered by Thomas Bruederli <roundcube@gmail.com> + to fit enhanced equirements by the RoundCube Webmail: + - Added list of server capabilites and check these before invoking commands + - Added junk flag to iilBasicHeader + - Enhanced error reporting on fsockopen() + - Additional parameter for SORT command + - Removed Call-time pass-by-reference because deprecated + - Parse charset from content-type in iil_C_FetchHeaders() + - Enhanced heaer sorting + - Pass message as reference in iil_C_Append (to save memory) + - Removed some debuggers (echo ...) ********************************************************/ + // changed path to work within roundcube webmail include_once("lib/icl_commons.inc"); @@ -52,6 +67,7 @@ var $recent; var $rootdir; var $delimiter; + var $capability = array(); } class iilBasicHeader{ @@ -246,6 +262,9 @@ function iil_C_NameSpace(&$conn){ global $my_prefs; + if (!in_array('NAMESPACE', $conn->capability)) + return false; + if ($my_prefs["rootdir"]) return true; fputs($conn->fp, "ns1 NAMESPACE\r\n"); @@ -334,7 +353,7 @@ $iil_error.="Socket connection established\r\n"; $line=iil_ReadLine($conn->fp, 300); - + if (strcasecmp($auth_method, "check")==0){ //check for supported auth methods @@ -349,6 +368,8 @@ $a = explode(" ", $line); if ($line[0]=="*"){ while ( list($k, $w) = each($a) ){ + if ($w!='*' && $w!='CAPABILITY') + $conn->capability[] = $w; if ((strcasecmp($w, "AUTH=CRAM_MD5")==0)|| (strcasecmp($w, "AUTH=CRAM-MD5")==0)){ $auth_method = "auth"; @@ -601,7 +622,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; @@ -612,7 +633,7 @@ 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"; $line = $data = ''; if (!fputs($fp, $command)) return false; @@ -1188,8 +1209,6 @@ $key="fh".($c++); $request=$key." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID)])\r\n"; - // echo "// $request\n\n"; - if (!fputs($fp, $request)) return false; do{ $line=chop(iil_ReadLine($fp, 200)); @@ -1214,8 +1233,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)){ @@ -1250,6 +1271,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); @@ -1365,6 +1390,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){ @@ -1380,7 +1406,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; } @@ -1879,7 +1905,7 @@ } } -function iil_C_Append(&$conn, $folder, $message){ +function iil_C_Append(&$conn, $folder, &$message){ if (!$folder) return false; $fp = $conn->fp; @@ -1890,16 +1916,12 @@ if (!$len) return false; $request="A APPEND \"".$folder."\" (\\Seen) {".$len."}\r\n"; - // echo $request.'<br>'; if (fputs($fp, $request)){ - $line=iil_ReadLine($fp, 100); - // echo $line.'<br>'; - + $line=iil_ReadLine($fp, 100); $sent = fwrite($fp, $message."\r\n"); flush(); do{ $line=iil_ReadLine($fp, 1000); - //echo $line.'<br>'; }while($line[0]!="A"); $result = (iil_ParseResult($line)==0); @@ -1947,7 +1969,6 @@ //read response do{ $line=iil_ReadLine($fp, 1000); - //echo $line.'<br>'; }while($line[0]!="A"); $result = (iil_ParseResult($line)==0); -- Gitblit v1.9.1