diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-08-08 11:39:19 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-08-08 11:39:19 +0000 |
| commit | f40b6d4e998cfebaf3076b90aecddd3a768f854b (patch) | |
| tree | a28594a1794efbc329e64115b566255eec70a7c2 /roundcubemail/program/include | |
| parent | 667538e7873fdc0ddd63ead2068a45be91400bdb (diff) | |
- Small improvement in SELECT response parsing
git-svn-id: https://svn.roundcube.net/trunk@3882 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap_generic.php | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/roundcubemail/program/include/rcube_imap_generic.php b/roundcubemail/program/include/rcube_imap_generic.php index 3a44b3b8a..de57671d4 100644 --- a/roundcubemail/program/include/rcube_imap_generic.php +++ b/roundcubemail/program/include/rcube_imap_generic.php @@ -749,31 +749,24 @@ class rcube_imap_generic if ($this->putLine("sel1 SELECT \"".$this->escape($mailbox).'"')) { do { - $line = rtrim($this->readLine(300)); - $a = explode(' ', $line); - if (count($a) == 3) { - $token = strtoupper($a[2]); - if ($token == 'EXISTS') { - $this->exists = (int) $a[1]; - } - else if ($token == 'RECENT') { - $this->recent = (int) $a[1]; - } + $line = rtrim($this->readLine(512)); + + if (preg_match('/^\* ([0-9]+) (EXISTS|RECENT)$/', $line, $m)) { + $token = strtolower($m[2]); + $this->$token = (int) $m[1]; } else if (preg_match('/\[?PERMANENTFLAGS\s+\(([^\)]+)\)\]/U', $line, $match)) { $this->permanentflags = explode(' ', $match[1]); } } while (!$this->startsWith($line, 'sel1', true, true)); - if (strcasecmp($a[1], 'OK') == 0) { + if ($this->parseResult($line) == 0) { $this->selected = $mailbox; return true; } - else { - $this->error = "Couldn't select $mailbox"; - } } + $this->error = "Couldn't select $mailbox"; return false; } |
