Changeset 2331 in subversion
- Timestamp:
- Mar 6, 2009 4:12:41 AM (4 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/lib/imap.inc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r2330 r2331 5 5 ---------- 6 6 - Fix errors handling in IMAP command continuations (#1485762) 7 - Fix FETCH result parsing for servers returning flags at the end of result (#1485763) 7 8 8 9 2009/03/04 (alec) -
trunk/roundcubemail/program/lib/imap.inc
r2330 r2331 1691 1691 $line = iil_ReadLine($fp, 1024); 1692 1692 $line = iil_MultLine($fp, $line); 1693 1693 1694 1694 $a = explode(' ', $line); 1695 1695 if (($line[0] == '*') && ($a[2] == 'FETCH')) { … … 1719 1719 // did we get the right number of replies? 1720 1720 $parts_count = count($a); 1721 if ($parts_count>= 8) {1721 if ($parts_count>=6) { 1722 1722 for ($i=0; $i<$parts_count; $i=$i+2) { 1723 1723 if (strcasecmp($a[$i],'UID') == 0) … … 1729 1729 else if (strcasecmp($a[$i],'FLAGS') == 0) 1730 1730 $flags_str = $a[$i+1]; 1731 }1732 1733 // process flags1734 $flags_str = eregi_replace('[\\\"]', '', $flags_str);1735 $flags_a = explode(' ', $flags_str);1736 1737 if (is_array($flags_a)) {1738 reset($flags_a);1739 while (list(,$val)=each($flags_a)) {1740 if (strcasecmp($val,'Seen') == 0) {1741 $result[$id]->seen = true;1742 } else if (strcasecmp($val, 'Deleted') == 0) {1743 $result[$id]->deleted=true;1744 } else if (strcasecmp($val, 'Recent') == 0) {1745 $result[$id]->recent = true;1746 } else if (strcasecmp($val, 'Answered') == 0) {1747 $result[$id]->answered = true;1748 } else if (strcasecmp($val, '$Forwarded') == 0) {1749 $result[$id]->forwarded = true;1750 } else if (strcasecmp($val, 'Draft') == 0) {1751 $result[$id]->is_draft = true;1752 } else if (strcasecmp($val, '$MDNSent') == 0) {1753 $result[$id]->mdn_sent = true;1754 } else if (strcasecmp($val, 'Flagged') == 0) {1755 $result[$id]->flagged = true;1756 }1757 }1758 $result[$id]->flags = $flags_a;1759 1731 } 1760 1732 … … 1801 1773 foreach ($reslines as $line) { 1802 1774 if (ord($line[0])<=32) { 1803 $lines[$ln] .= (empty($lines[$ln])?'':"\n").trim($line);1775 $lines[$ln] .= (empty($lines[$ln])?'':"\n").trim($line); 1804 1776 } else { 1805 1777 $lines[++$ln] = trim($line); … … 1818 1790 $line = chop(iil_ReadLine($fp, 300), "\r\n"); 1819 1791 1792 // The preg_match below works around communigate imap, which outputs " UID <number>)". 1793 // Without this, the while statement continues on and gets the "FH0 OK completed" message. 1794 // If this loop gets the ending message, then the outer loop does not receive it from radline on line 1249. 1795 // This in causes the if statement on line 1278 to never be true, which causes the headers to end up missing 1796 // If the if statement was changed to pick up the fh0 from this loop, then it causes the outer loop to spin 1797 // An alternative might be: 1798 // if (!preg_match("/:/",$line) && preg_match("/\)$/",$line)) break; 1799 // however, unsure how well this would work with all imap clients. 1800 if (preg_match("/^\s*UID [0-9]+\)$/", $line)) { 1801 break; 1802 } 1803 1804 // handle FLAGS reply after headers (AOL, Zimbra?) 1805 if (preg_match('/\s+FLAGS \((.*)\)\)$/', $line, $matches)) { 1806 $flags_str = $matches[1]; 1807 break; 1808 } 1809 1820 1810 if (ord($line[0])<=32) { 1821 $lines[$ln] .= (empty($lines[$ln])?'':"\n").trim($line);1811 $lines[$ln] .= (empty($lines[$ln])?'':"\n").trim($line); 1822 1812 } else { 1823 1813 $lines[++$ln] = trim($line); 1824 }1825 /*1826 The preg_match below works around communigate imap, which outputs " UID <number>)".1827 Without this, the while statement continues on and gets the "FH0 OK completed" message.1828 If this loop gets the ending message, then the outer loop does not receive it from radline on line 1249.1829 This in causes the if statement on line 1278 to never be true, which causes the headers to end up missing1830 If the if statement was changed to pick up the fh0 from this loop, then it causes the outer loop to spin1831 An alternative might be:1832 if (!preg_match("/:/",$line) && preg_match("/\)$/",$line)) break;1833 however, unsure how well this would work with all imap clients.1834 */1835 if (preg_match("/^\s*UID [0-9]+\)$/", $line)) {1836 break;1837 1814 } 1838 1815 // patch from "Maksim Rubis" <siburny@hotmail.com> … … 1923 1900 $a = explode(' ', $line); 1924 1901 } 1902 1903 // process flags 1904 if (!empty($flags_str)) { 1905 $flags_str = eregi_replace('[\\\"]', '', $flags_str); 1906 $flags_a = explode(' ', $flags_str); 1907 1908 if (is_array($flags_a)) { 1909 reset($flags_a); 1910 while (list(,$val)=each($flags_a)) { 1911 if (strcasecmp($val,'Seen') == 0) { 1912 $result[$id]->seen = true; 1913 } else if (strcasecmp($val, 'Deleted') == 0) { 1914 $result[$id]->deleted=true; 1915 } else if (strcasecmp($val, 'Recent') == 0) { 1916 $result[$id]->recent = true; 1917 } else if (strcasecmp($val, 'Answered') == 0) { 1918 $result[$id]->answered = true; 1919 } else if (strcasecmp($val, '$Forwarded') == 0) { 1920 $result[$id]->forwarded = true; 1921 } else if (strcasecmp($val, 'Draft') == 0) { 1922 $result[$id]->is_draft = true; 1923 } else if (strcasecmp($val, '$MDNSent') == 0) { 1924 $result[$id]->mdn_sent = true; 1925 } else if (strcasecmp($val, 'Flagged') == 0) { 1926 $result[$id]->flagged = true; 1927 } 1928 } 1929 $result[$id]->flags = $flags_a; 1930 } 1931 } 1925 1932 } 1926 1933 } while (strcmp($a[0], $key) != 0);
Note: See TracChangeset
for help on using the changeset viewer.
