Thread: [Hastymail-cvs] SF.net SVN: hastymail:[555] trunk/hastymail2/lib/imap_class.php
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2008-09-02 00:22:07
|
Revision: 555 http://hastymail.svn.sourceforge.net/hastymail/?rev=555&view=rev Author: sailfrog Date: 2008-09-02 00:22:03 +0000 (Tue, 02 Sep 2008) Log Message: ----------- remove charset lookup in imap class (should not be needed here anyway) Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-08-27 22:45:08 UTC (rev 554) +++ trunk/hastymail2/lib/imap_class.php 2008-09-02 00:22:03 UTC (rev 555) @@ -1122,7 +1122,6 @@ /* get the headers for a mailbox page display. Saved in the session for re-use, controled by the $imap->use_header_cache setting */ function get_mailbox_page($mailbox, $uids, $page) { - global $charset_codes; if ($page) { if ($this->use_header_cache) { if (isset($_SESSION['header_cache'][$mailbox][$page])) { @@ -1199,10 +1198,7 @@ $cset = ''; if (stristr($content_type, 'charset=')) { if (preg_match("/charset\=([^\s]+)/", $content_type, $matches)) { - $charset = trim(strtolower(str_replace(array('"', "'", ';'), '', $matches[1]))); - if ($charset == 'us-ascii' || in_array($charset, $charset_codes)) { - $cset = $charset; - } + $cset = trim(strtolower(str_replace(array('"', "'", ';'), '', $matches[1]))); } } $headers[$uid] = array('uid' => $uid, 'flags' => $flags, 'internal_date' => $internal_date, 'size' => $size, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2008-09-03 04:39:52
|
Revision: 557 http://hastymail.svn.sourceforge.net/hastymail/?rev=557&view=rev Author: sailfrog Date: 2008-09-03 04:39:48 +0000 (Wed, 03 Sep 2008) Log Message: ----------- fix a bug that made folders with only numbers in the name unselectable Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-09-02 00:47:31 UTC (rev 556) +++ trunk/hastymail2/lib/imap_class.php 2008-09-03 04:39:48 UTC (rev 557) @@ -264,9 +264,6 @@ } /* check the cache size and reduce stored data if its bloated */ function bust_cache($mailbox) { - - - $data = array(); $max = 12000; $min = 9000; @@ -882,7 +879,12 @@ $new_folders[$index] = $vals; } } - $folders = array_merge($index_vals, $special_folders, $new_folders); + $folders = array(); + foreach (array('index_vals', 'special_folders', 'new_folders') as $folder_type) { + foreach ($$folder_type as $i => $v) { + $folders[$i] = $v; + } + } if (!isset($folders['INBOX']) && $this->max_read) { $folders = array_merge(array('INBOX' => array( 'name' => 'INBOX', 'basename' => 'INBOX', 'realname' => 'INBOX', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2008-09-07 18:37:26
|
Revision: 561 http://hastymail.svn.sourceforge.net/hastymail/?rev=561&view=rev Author: sailfrog Date: 2008-09-07 18:37:24 +0000 (Sun, 07 Sep 2008) Log Message: ----------- very nice sort parsing speed up. Added a special case that skips the parse_line routine since it handles things like literals and quoted strings. SORT responses are simply space delimited lists of UIDs so instead we simply explode() the line. This cuts down the time to open large mailboxes (before the sort order is cached) significantly. I was unabe to open a folder with 90K messages within the 30 second script timeout but with this it opens in < 2 seconds. Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-09-07 18:13:06 UTC (rev 560) +++ trunk/hastymail2/lib/imap_class.php 2008-09-07 18:37:24 UTC (rev 561) @@ -152,7 +152,7 @@ did something stupid like list a loaded unix homedir in UW */ - function get_response($max=false, $chunked=false, $line_length=8192) { + function get_response($max=false, $chunked=false, $line_length=8192, $sort=false) { $result = array(); $current_size = 0; $chunked_result = array(); @@ -189,7 +189,13 @@ $pchunk = $c; } } - list($line_cont, $chunks) = $this->parse_line($result[$n], $current_size, $max, $line_length); + if ($sort) { + $line_cont = false; + $chunks = explode(' ', trim($result[$n])); + } + else { + list($line_cont, $chunks) = $this->parse_line($result[$n], $current_size, $max, $line_length); + } if ($chunks && !$last_line_cont) { $c++; } @@ -1293,7 +1299,7 @@ function server_side_sort($mailbox, $sort, $reverse, $filter) { $command = 'UID SORT ('.$sort.') US-ASCII '.$filter."\r\n"; $this->send_command($command); - $res = $this->get_response(false, true); + $res = $this->get_response(false, true, 8192, true); $status = $this->check_response($res, true); $uids = array(); foreach ($res as $vals) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2008-11-24 05:23:12
|
Revision: 609 http://hastymail.svn.sourceforge.net/hastymail/?rev=609&view=rev Author: sailfrog Date: 2008-11-24 05:23:08 +0000 (Mon, 24 Nov 2008) Log Message: ----------- fix a bug causing folders within excluded folders to be displayed Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-11-24 05:10:49 UTC (rev 608) +++ trunk/hastymail2/lib/imap_class.php 2008-11-24 05:23:08 UTC (rev 609) @@ -742,6 +742,7 @@ $this->folder_list = $_SESSION['folders']; return; } + $excluded = array(); array_unshift($this->folder_namespace, $this->folder_prefix); foreach ($this->folder_namespace as $namespace) { if (strtoupper($namespace) == 'INBOX') { @@ -817,8 +818,28 @@ if (strtolower(substr($folder, 0, 14)) == 'public folders') { continue; } - if (substr($base_name, 0, 1) == '.' && $this->folder_exclude_hidden) { - continue; + if ($this->folder_exclude_hidden) { + if (substr($base_name, 0, 1) == '.') { + if (!in_array($base_name, $excluded)) { + $excluded[] = $base_name; + } + continue; + } + else { + $excl = false; + foreach ($folder_parts as $v) { + if (substr($v, 0, 1) == '.') { + $excl = true; + if (!in_array($v, $excluded)) { + $excluded[] = $v; + } + break; + } + } + if ($excl) { + continue; + } + } } if (isset($folder_parts[(count($folder_parts) - 2)]) && strtoupper($folder_parts[(count($folder_parts) - 2)]) != 'INBOX') { $parent = $folder_parts[(count($folder_parts) - 2)]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2008-11-24 15:26:19
|
Revision: 613 http://hastymail.svn.sourceforge.net/hastymail/?rev=613&view=rev Author: sailfrog Date: 2008-11-24 15:26:15 +0000 (Mon, 24 Nov 2008) Log Message: ----------- oops, remove forced hack from testing against exchange Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-11-24 06:12:19 UTC (rev 612) +++ trunk/hastymail2/lib/imap_class.php 2008-11-24 15:26:15 UTC (rev 613) @@ -815,9 +815,6 @@ else { $base_name = $folder; } - if (strtolower(substr($folder, 0, 14)) == 'public folders') { - continue; - } if ($this->folder_exclude_hidden) { if (substr($base_name, 0, 1) == '.') { if (!in_array($base_name, $excluded)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2008-12-14 23:55:57
|
Revision: 643 http://hastymail.svn.sourceforge.net/hastymail/?rev=643&view=rev Author: sailfrog Date: 2008-12-14 23:55:46 +0000 (Sun, 14 Dec 2008) Log Message: ----------- add support to the folder list to handle parent folder references that are missing by simulating no-select folders to complete the hierarchy. Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-12-10 16:39:22 UTC (rev 642) +++ trunk/hastymail2/lib/imap_class.php 2008-12-14 23:55:46 UTC (rev 643) @@ -743,6 +743,7 @@ return; } $excluded = array(); + $parents = array(); array_unshift($this->folder_namespace, $this->folder_prefix); foreach ($this->folder_namespace as $namespace) { if (strtoupper($namespace) == 'INBOX') { @@ -888,8 +889,40 @@ 'has_kids' => $has_kids, 'special' => $special, 'hidden' => $hidden, 'check_for_new' => $check_for_new, 'sort_by' => $folder_sort_by); } + if ($parent && !in_array($parent, $parents)) { + $parents[$parent] = $folders[$folder]; + } } } + foreach ($parents as $val => $parent) { + $found = false; + foreach ($folders as $vals) { + if ($vals['basename'] == $val) { + $found = true; + break; + } + } + if (!$found) { + if (count($parent['name_parts']) > 1) { + $sub = array_pop($parent['name_parts']); + $fname = array_pop($parent['name_parts']); + if (count($parent['name_parts']) > 0) { + $fparent = join($delim, $parent['name_parts']); + $freal = $fparent.$delim.$fname; + } + else { + $fparent = false; + $freal = $fname; + } + $folders[$fname] = array('parent' => $fparent, 'delim' => $delim, 'name' => $freal, + 'name_parts' => $parent['name_parts'], 'basename' => $fname, + 'realname' => $freal, 'namespace' => $namespace, 'marked' => false, + 'noselect' => true, 'can_have_kids' => true, + 'has_kids' => true, 'special' => false, 'hidden' => false, + 'check_for_new' => false, 'sort_by' => false); + } + } + } uksort($folders, 'folder_sort'); if (isset($_SESSION['folder_state'])) { unset($_SESSION['folder_state']); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-09-13 23:30:53
|
Revision: 1032 http://hastymail.svn.sourceforge.net/hastymail/?rev=1032&view=rev Author: sailfrog Date: 2009-09-13 23:30:44 +0000 (Sun, 13 Sep 2009) Log Message: ----------- folder list fixes for uw Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-09-13 23:29:39 UTC (rev 1031) +++ trunk/hastymail2/lib/imap_class.php 2009-09-13 23:30:44 UTC (rev 1032) @@ -910,6 +910,9 @@ } if (isset($folder_parts[(count($folder_parts) - 2)]) && strtoupper($folder_parts[(count($folder_parts) - 2)]) != 'INBOX') { $parent = join($delim, array_slice($folder_parts, 0, -1)); + if ($parent.$delim == $namespace) { + $parent = ''; + } } if (stristr($flags, 'marked')) { $marked = true; @@ -1011,6 +1014,9 @@ foreach ($folders as $index => $vals) { if (strtoupper($index) == 'INBOX' || $index == $namespace) { $index_vals['INBOX'] = $vals; + if ($index == $namespace) { + $index_vals['INBOX']['has_kids'] = 0; + } $index_vals['INBOX']['realname'] = 'INBOX'; } elseif ($vals['special']) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-11-18 02:32:27
|
Revision: 1199 http://hastymail.svn.sourceforge.net/hastymail/?rev=1199&view=rev Author: sailfrog Date: 2009-11-18 02:32:18 +0000 (Wed, 18 Nov 2009) Log Message: ----------- fix for search charset validation Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-11-16 04:23:48 UTC (rev 1198) +++ trunk/hastymail2/lib/imap_class.php 2009-11-18 02:32:18 UTC (rev 1199) @@ -1981,7 +1981,7 @@ $this->clean($this->search_charset, 'charset'); $this->clean($terms, 'search_str'); if ($this->search_charset) { - $charset = 'CHARSET '.$this->search_charset.' '; + $charset = 'CHARSET '.strtoupper($this->search_charset).' '; } else { $charset = ''; @@ -2037,7 +2037,7 @@ $uids = 'ALL'; } if ($this->search_charset) { - $charset = 'CHARSET '.$this->search_charset.' '; + $charset = 'CHARSET '.strtoupper($this->search_charset).' '; } else { $charset = ''; @@ -2119,7 +2119,7 @@ } break; case 'charset': - if (!$val || in_array($val, $imap_search_charsets)) { + if (!$val || in_array(strtoupper($val), $imap_search_charsets)) { $valid = true; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-12-07 20:52:11
|
Revision: 1249 http://hastymail.svn.sourceforge.net/hastymail/?rev=1249&view=rev Author: sailfrog Date: 2009-12-07 20:52:00 +0000 (Mon, 07 Dec 2009) Log Message: ----------- fix validation layer check that is too strict Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-12-06 21:40:34 UTC (rev 1248) +++ trunk/hastymail2/lib/imap_class.php 2009-12-07 20:52:00 UTC (rev 1249) @@ -2117,7 +2117,7 @@ } break; case 'msg_part': - if (preg_match("/^\d+\.*\d*$/", $val)) { + if (preg_match("/^[\d\.]+$/", $val)) { $valid = true; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-05-12 13:05:17
|
Revision: 1510 http://hastymail.svn.sourceforge.net/hastymail/?rev=1510&view=rev Author: sailfrog Date: 2010-05-12 13:05:11 +0000 (Wed, 12 May 2010) Log Message: ----------- more special folder handling Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-05-11 13:55:48 UTC (rev 1509) +++ trunk/hastymail2/lib/imap_class.php 2010-05-12 13:05:11 UTC (rev 1510) @@ -939,8 +939,14 @@ } $temp_name = ''; if (!empty($folder_parts)) { + $temp_name = ''; foreach ($folder_parts as $name) { - $temp_name = $this->prep_folder_name($name, false, false, false); + if ($temp_name) { + $temp_name = $delim.$this->prep_folder_name($name, false, false, false); + } + else { + $temp_name = $this->prep_folder_name($name, false, false, false); + } if (in_array($temp_name, $this->folder_special)) { $special = true; break; @@ -1028,6 +1034,7 @@ $new_folders[$index] = $vals; } } +echo_r(array_keys($special_folders)); foreach ($special_folders as $i => $vals) { if (!empty($vals['name_parts'])) { $special_parent = ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-05-20 03:10:00
|
Revision: 1538 http://hastymail.svn.sourceforge.net/hastymail/?rev=1538&view=rev Author: sailfrog Date: 2010-05-20 03:09:53 +0000 (Thu, 20 May 2010) Log Message: ----------- start of some work on better namespace support Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-05-19 19:09:26 UTC (rev 1537) +++ trunk/hastymail2/lib/imap_class.php 2010-05-20 03:09:53 UTC (rev 1538) @@ -664,6 +664,7 @@ var $folder_prefix; var $folder_max; var $folder_namespace; + var $namespaces; var $folder_special; var $folder_exclude_hidden; var $folder_delimiter_override; @@ -703,6 +704,7 @@ $this->folder_prefix = ''; $this->folder_max = 350000; $this->folder_namespace = array(); + $this->namespaces = array(); $this->folder_exclude_hidden = false; $this->folder_delimiter_override = false; $this->use_folder_cache = 0; @@ -769,6 +771,7 @@ break; } $res = $this->get_response(); + //$this->get_namespaces(); $authed = false; if (is_array($res) && !empty($res)) { $response = array_pop($res); @@ -1955,6 +1958,24 @@ } return $new_box_name; } + function get_namespaces() { + $data = array(); + $this->send_command("NAMESPACE\r\n"); + $res = $this->get_response(); + if ($this->check_response($res)) { + if (preg_match("/\* namespace (\(.+\)|NIL) (\(.+\)|NIL) (\(.+\)|NIL)/i", $res[0], $matches)) { + /* $matches[1] = personal namespaces + $matches[2] = other users namespaces + $matches[3] = shared namespaces + format for each class is (prefix delim) (prefix.. + vals could be double quoted ... + */ + //echo_r($matches); + } + //echo_r($res); + } + return $data; + } function delete_folder($mailbox) { $this->clean($mailbox, 'mailbox'); if ($this->read_only) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-05-25 13:40:42
|
Revision: 1551 http://hastymail.svn.sourceforge.net/hastymail/?rev=1551&view=rev Author: sailfrog Date: 2010-05-25 13:40:36 +0000 (Tue, 25 May 2010) Log Message: ----------- small folder list related update Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-05-25 13:33:16 UTC (rev 1550) +++ trunk/hastymail2/lib/imap_class.php 2010-05-25 13:40:36 UTC (rev 1551) @@ -1086,7 +1086,7 @@ $folders[$i] = $v; } } - if (!isset($folders['INBOX']) && $this->max_read) { + if (!isset($folders['INBOX'])) { $folders = array_merge(array('INBOX' => array( 'name' => 'INBOX', 'basename' => 'INBOX', 'realname' => 'INBOX', 'parent' => false, 'hidden' => false, 'has_kids' => false, 'special' => false)), $folders); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-07-06 16:40:19
|
Revision: 1592 http://hastymail.svn.sourceforge.net/hastymail/?rev=1592&view=rev Author: sailfrog Date: 2010-07-06 16:40:13 +0000 (Tue, 06 Jul 2010) Log Message: ----------- work around for client side sorting problems Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-07-06 15:36:14 UTC (rev 1591) +++ trunk/hastymail2/lib/imap_class.php 2010-07-06 16:40:13 UTC (rev 1592) @@ -1629,8 +1629,13 @@ } } if (count($sort_keys) != count($uids)) { - echo 'BUG: Client side sort array mismatch'; - exit; + if (count($sort_keys) < count($uids)) { + foreach ($uids as $v) { + if (!isset($sort_keys[$v])) { + $sort_keys[$uid] = false; + } + } + } } unset($res); natcasesort($sort_keys); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-07-12 17:56:25
|
Revision: 1605 http://hastymail.svn.sourceforge.net/hastymail/?rev=1605&view=rev Author: sailfrog Date: 2010-07-12 17:56:19 +0000 (Mon, 12 Jul 2010) Log Message: ----------- client side sorting typo fix Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-07-12 17:21:05 UTC (rev 1604) +++ trunk/hastymail2/lib/imap_class.php 2010-07-12 17:56:19 UTC (rev 1605) @@ -1632,7 +1632,7 @@ if (count($sort_keys) < count($uids)) { foreach ($uids as $v) { if (!isset($sort_keys[$v])) { - $sort_keys[$uid] = false; + $sort_keys[$v] = false; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-10-12 20:44:06
|
Revision: 1682 http://hastymail.svn.sourceforge.net/hastymail/?rev=1682&view=rev Author: sailfrog Date: 2010-10-12 20:44:00 +0000 (Tue, 12 Oct 2010) Log Message: ----------- fix for the max_length cutoff setting Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-10-12 18:52:14 UTC (rev 1681) +++ trunk/hastymail2/lib/imap_class.php 2010-10-12 20:44:00 UTC (rev 1682) @@ -127,16 +127,25 @@ $left_over = false; $literal_data = fgets($this->handle, $line_length); $current += strlen($literal_data); - while (strlen($literal_data) < $size) { + $lit_size = strlen($literal_data); + while ($lit_size < $size) { $chunk = fgets($this->handle, $line_length); - $current += strlen($chunk); + $chunk_size = strlen($chunk); + $lit_size += $chunk_size; + $current += $chunk_size; $literal_data .= $chunk; if ($max && $current > $max) { $this->max_read = true; break; } } - if ($size < strlen($literal_data)) { + if ($this->max_read) { + while ($lit_size < $size) { + $temp = fgets($this->handle, $line_length); + $lit_size += strlen($temp); + } + } + elseif ($size < strlen($literal_data)) { $left_over = substr($literal_data, $size); $literal_data = substr($literal_data, 0, $size); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-11-01 14:49:55
|
Revision: 1684 http://hastymail.svn.sourceforge.net/hastymail/?rev=1684&view=rev Author: sailfrog Date: 2010-11-01 14:49:49 +0000 (Mon, 01 Nov 2010) Log Message: ----------- message header parsing bug fix Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-10-13 21:02:49 UTC (rev 1683) +++ trunk/hastymail2/lib/imap_class.php 2010-11-01 14:49:49 UTC (rev 1684) @@ -1397,17 +1397,17 @@ while(isset($vals[$i]) && in_array($vals[$i], $junk)) { $i++; } + $last_header = false; $lines = explode("\r\n", $vals[$i]); foreach ($lines as $line) { $header = strtolower(substr($line, 0, strpos($line, ':'))); - if (!$header) { + if (!$header || (!isset($flds[$header]) && $last_header)) { ${$flds[$last_header]} .= "\r\n".$line; } elseif (isset($flds[$header])) { ${$flds[$header]} = substr($line, (strpos($line, ':') + 1)); $last_header = $header; } - } } elseif (isset($tags[strtoupper($vals[$i])])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2010-11-27 19:04:58
|
Revision: 1716 http://hastymail.svn.sourceforge.net/hastymail/?rev=1716&view=rev Author: sailfrog Date: 2010-11-27 19:04:52 +0000 (Sat, 27 Nov 2010) Log Message: ----------- message list parsing fix Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2010-11-27 18:30:18 UTC (rev 1715) +++ trunk/hastymail2/lib/imap_class.php 2010-11-27 19:04:52 UTC (rev 1716) @@ -1394,7 +1394,7 @@ for ($i=0;$i<$count;$i++) { if ($vals[$i] == 'BODY[HEADER.FIELDS') { $i++; - while(isset($vals[$i]) && in_array($vals[$i], $junk)) { + while(isset($vals[$i]) && in_array(strtoupper($vals[$i]), $junk)) { $i++; } $last_header = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2011-07-19 20:33:04
|
Revision: 1922 http://hastymail.svn.sourceforge.net/hastymail/?rev=1922&view=rev Author: sailfrog Date: 2011-07-19 20:32:56 +0000 (Tue, 19 Jul 2011) Log Message: ----------- be sure and sanitize any invalid IMAP input we detect before sending it to the display code Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2011-07-14 17:36:01 UTC (rev 1921) +++ trunk/hastymail2/lib/imap_class.php 2011-07-19 20:32:56 UTC (rev 1922) @@ -2428,7 +2428,7 @@ function clean($val, $type) { global $user; if (!$this->input_validate($val, $type)) { - $user->notices[] = 'INVALID IMAP INPUT DETECTED: '.$type.' : '.$val; + $user->notices[] = 'INVALID IMAP INPUT DETECTED: '.$type.' : '.$user->htmlsafe($val); return false; } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2011-08-16 02:45:29
|
Revision: 1958 http://hastymail.svn.sourceforge.net/hastymail/?rev=1958&view=rev Author: sailfrog Date: 2011-08-16 02:45:23 +0000 (Tue, 16 Aug 2011) Log Message: ----------- folder rename fix when using a mailbox prefix, thanks to Augie from the forums Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2011-08-12 20:19:36 UTC (rev 1957) +++ trunk/hastymail2/lib/imap_class.php 2011-08-16 02:45:23 UTC (rev 1958) @@ -2195,8 +2195,8 @@ if ($this->read_only) { return 'Operation not permitted in read only mode'; } - $command = 'RENAME "'.$this->prep_folder_name($this->utf7_encode($mailbox, $prefix)).'" "'. - $this->prep_folder_name($this->utf7_encode($new_mailbox, $prefix)).'"'."\r\n"; + $command = 'RENAME "'.$this->prep_folder_name($this->utf7_encode($mailbox), $prefix).'" "'. + $this->prep_folder_name($this->utf7_encode($new_mailbox), $prefix).'"'."\r\n"; $this->send_command($command); $result = $this->get_response(false); $status = $this->check_response($result, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-08-30 17:02:14
|
Revision: 1017 http://hastymail.svn.sourceforge.net/hastymail/?rev=1017&view=rev Author: sailfrog Date: 2009-08-30 17:01:43 +0000 (Sun, 30 Aug 2009) Log Message: ----------- fix for folder hierarchy problems in Citadel (maybe others?) Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-08-27 21:00:30 UTC (rev 1016) +++ trunk/hastymail2/lib/imap_class.php 2009-08-30 17:01:43 UTC (rev 1017) @@ -959,40 +959,42 @@ 'check_for_new' => $check_for_new, 'sort_by' => $folder_sort_by); } if ($parent && !in_array($parent, $parents)) { - $parents[$parent] = $folders[$folder]; + $parents[$parent][] = $folders[$folder]; } } } $place_holders = array(); - foreach ($parents as $val => $parent) { - $found = false; - foreach ($folders as $i => $vals) { - if ($vals['name'] == $parent['name'].$val) { - $folders[$i]['has_kids'] = 1; - $found = true; - break; + foreach ($parents as $val => $parent_list) { + foreach ($parent_list as $parent) { + $found = false; + foreach ($folders as $i => $vals) { + if ($vals['name'] == $val) { + $folders[$i]['has_kids'] = 1; + $found = true; + break; + } } - } - if (!$found) { - if (count($parent['name_parts']) > 1) { - foreach ($parent['name_parts'] as $i => $v) { - $fname = join($delim, array_slice($parent['name_parts'], 0, ($i + 1))); - $name_parts = array_slice($parent['name_parts'], 0, ($i + 1)); - if (!isset($folders[$fname])) { - $freal = $v; - if ($i > 0) { - $fparent = join($delim, array_slice($parent['name_parts'], 0, $i)); + if (!$found) { + if (count($parent['name_parts']) > 1) { + foreach ($parent['name_parts'] as $i => $v) { + $fname = join($delim, array_slice($parent['name_parts'], 0, ($i + 1))); + $name_parts = array_slice($parent['name_parts'], 0, ($i + 1)); + if (!isset($folders[$fname])) { + $freal = $v; + if ($i > 0) { + $fparent = join($delim, array_slice($parent['name_parts'], 0, $i)); + } + else { + $fparent = false; + } + $place_holders[] = $fname; + $folders[$fname] = array('parent' => $fparent, 'delim' => $delim, 'name' => $freal, + 'name_parts' => $name_parts, 'basename' => $freal, + 'realname' => $fname, 'namespace' => $namespace, 'marked' => false, + 'noselect' => true, 'can_have_kids' => true, + 'has_kids' => true, 'special' => false, 'hidden' => false, + 'check_for_new' => false, 'sort_by' => false); } - else { - $fparent = false; - } - $place_holders[] = $fname; - $folders[$fname] = array('parent' => $fparent, 'delim' => $delim, 'name' => $freal, - 'name_parts' => $name_parts, 'basename' => $freal, - 'realname' => $fname, 'namespace' => $namespace, 'marked' => false, - 'noselect' => true, 'can_have_kids' => true, - 'has_kids' => true, 'special' => false, 'hidden' => false, - 'check_for_new' => false, 'sort_by' => false); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-08-31 14:55:34
|
Revision: 1026 http://hastymail.svn.sourceforge.net/hastymail/?rev=1026&view=rev Author: sailfrog Date: 2009-08-31 14:55:26 +0000 (Mon, 31 Aug 2009) Log Message: ----------- make it possible to perform message actions on larger sets of message uids by chopping them up into groups of 1K Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-08-31 13:05:33 UTC (rev 1025) +++ trunk/hastymail2/lib/imap_class.php 2009-08-31 14:55:26 UTC (rev 1026) @@ -1802,59 +1802,78 @@ return $res; } /* perform message action */ - function message_action($uids, $action, $mailbox=false, $uid_string='') { + function message_action($uids, $action, $mailbox=false, $uid_str='') { $keepers = array(); + $uid_strings = array(); if (!empty($uids)) { - $uid_string = implode(',', $uids); + if (count($uids) > 1000) { + while (count($uids) > 1000) { + $uid_strings[] = implode(',', array_splice($uids, 0, 1000)); + } + if (count($uids)) { + $uid_strings[] = implode(',', $uids); + } + } + else { + $uid_strings[] = implode(',', $uids); + } } - switch ($action) { - case 'READ': - $command = "UID STORE $uid_string +FLAGS (\Seen)\r\n"; - break; - case 'FLAG': - $command = "UID STORE $uid_string +FLAGS (\Flagged)\r\n"; - break; - case 'UNFLAG': - $command = "UID STORE $uid_string -FLAGS (\Flagged)\r\n"; - break; - case 'ANSWERED': - $command = "UID STORE $uid_string +FLAGS (\Answered)\r\n"; - break; - case 'UNREAD': - $command = "UID STORE $uid_string -FLAGS (\Seen)\r\n"; - break; - case 'DELETE': - $command = "UID STORE $uid_string +FLAGS (\Deleted)\r\n"; - break; - case 'UNDELETE': - $command = "UID STORE $uid_string -FLAGS (\Deleted)\r\n"; - break; - case 'EXPUNGE': - if (is_array($uids) && !empty($uids)) { - $res = $this->full_search('DELETED'); - if (!empty($res)) { - foreach ($res as $val) { - if (!in_array($val, $uids)) { - $keepers[] = $val; + else { + $uid_strings[] = $uid_str; + } + foreach ($uid_strings as $uid_string) { + switch ($action) { + case 'READ': + $command = "UID STORE $uid_string +FLAGS (\Seen)\r\n"; + break; + case 'FLAG': + $command = "UID STORE $uid_string +FLAGS (\Flagged)\r\n"; + break; + case 'UNFLAG': + $command = "UID STORE $uid_string -FLAGS (\Flagged)\r\n"; + break; + case 'ANSWERED': + $command = "UID STORE $uid_string +FLAGS (\Answered)\r\n"; + break; + case 'UNREAD': + $command = "UID STORE $uid_string -FLAGS (\Seen)\r\n"; + break; + case 'DELETE': + $command = "UID STORE $uid_string +FLAGS (\Deleted)\r\n"; + break; + case 'UNDELETE': + $command = "UID STORE $uid_string -FLAGS (\Deleted)\r\n"; + break; + case 'EXPUNGE': + if (is_array($uids) && !empty($uids)) { + $res = $this->full_search('DELETED'); + if (!empty($res)) { + foreach ($res as $val) { + if (!in_array($val, $uids)) { + $keepers[] = $val; + } } + if (!empty($keepers)) { + $this->message_action($keepers, 'UNDELETE'); + } } - if (!empty($keepers)) { - $this->message_action($keepers, 'UNDELETE'); - } } - } - $command = "EXPUNGE\r\n"; - break; - default: - $command = "UID COPY $uid_string \"".$this->utf7_encode($mailbox)."\"\r\n"; - break; + $command = "EXPUNGE\r\n"; + break; + default: + $command = "UID COPY $uid_string \"".$this->utf7_encode($mailbox)."\"\r\n"; + break; + } + $this->send_command($command); + $res = $this->get_response(); + $status = $this->check_response($res); + if ($status && !empty($keepers)) { + $this->message_action($keepers, 'DELETE'); + } + if (!$status) { + return $status; + } } - $this->send_command($command); - $res = $this->get_response(); - $status = $this->check_response($res); - if ($status && !empty($keepers)) { - $this->message_action($keepers, 'DELETE'); - } return $status; } function prep_folder_name($mailbox, $prefix='', $parent=false, $subs=false) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-11-04 21:00:22
|
Revision: 1148 http://hastymail.svn.sourceforge.net/hastymail/?rev=1148&view=rev Author: sailfrog Date: 2009-11-04 21:00:15 +0000 (Wed, 04 Nov 2009) Log Message: ----------- fix INBOX handling with Courier when set to noselect Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-11-04 14:30:12 UTC (rev 1147) +++ trunk/hastymail2/lib/imap_class.php 2009-11-04 21:00:15 UTC (rev 1148) @@ -924,7 +924,7 @@ if (($folder == $namespace && $namespace) || stristr($flags, 'haschildren')) { $has_kids = true; } - if ($folder != $namespace && stristr($flags, 'noselect')) { + if ($folder != 'INBOX' && $folder != $namespace && stristr($flags, 'noselect')) { $no_select = true; } if (isset($_SESSION['user_settings']['hidden_folders']) && in_array($folder, $_SESSION['user_settings']['hidden_folders'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-11-10 12:47:34
|
Revision: 1164 http://hastymail.svn.sourceforge.net/hastymail/?rev=1164&view=rev Author: sailfrog Date: 2009-11-10 12:47:28 +0000 (Tue, 10 Nov 2009) Log Message: ----------- remove temp debugging hack Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-11-10 12:33:56 UTC (rev 1163) +++ trunk/hastymail2/lib/imap_class.php 2009-11-10 12:47:28 UTC (rev 1164) @@ -833,9 +833,6 @@ $flags = false; $count = count($vals); $folder = $this->utf7_decode($vals[($count - 1)]); - if (strstr($folder, 'Public Folders')) { - continue; - } $flag = false; $delim_flag = false; $parent = ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-11-10 14:34:45
|
Revision: 1167 http://hastymail.svn.sourceforge.net/hastymail/?rev=1167&view=rev Author: sailfrog Date: 2009-11-10 14:34:38 +0000 (Tue, 10 Nov 2009) Log Message: ----------- validation fix Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-11-10 13:37:30 UTC (rev 1166) +++ trunk/hastymail2/lib/imap_class.php 2009-11-10 14:34:38 UTC (rev 1167) @@ -1844,7 +1844,9 @@ $uid_strings[] = $uid_str; } foreach ($uid_strings as $uid_string) { - $this->clean($uid_string, 'uid_list'); + if ($uid_string) { + $this->clean($uid_string, 'uid_list'); + } switch ($action) { case 'READ': $command = "UID STORE $uid_string +FLAGS (\Seen)\r\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sai...@us...> - 2009-11-23 02:58:35
|
Revision: 1225 http://hastymail.svn.sourceforge.net/hastymail/?rev=1225&view=rev Author: sailfrog Date: 2009-11-23 02:58:26 +0000 (Mon, 23 Nov 2009) Log Message: ----------- fix problem with uid list validation regex Modified Paths: -------------- trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2009-11-22 20:59:50 UTC (rev 1224) +++ trunk/hastymail2/lib/imap_class.php 2009-11-23 02:58:26 UTC (rev 1225) @@ -2132,7 +2132,7 @@ } break; case 'uid_list'; - if (preg_match("/^(\d+\s*,*\s*)+$/", $val)) { + if (preg_match("/^(\d+\s*,*\s*|(\d+|\*):(\d+|\*))+$/", $val)) { $valid = true; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |