Changeset 3882 in subversion


Ignore:
Timestamp:
Aug 8, 2010 7:39:19 AM (3 years ago)
Author:
alec
Message:
  • Small improvement in SELECT response parsing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_imap_generic.php

    r3881 r3882  
    750750            if ($this->putLine("sel1 SELECT \"".$this->escape($mailbox).'"')) { 
    751751                    do { 
    752                             $line = rtrim($this->readLine(300)); 
    753                             $a = explode(' ', $line); 
    754                             if (count($a) == 3) { 
    755                                     $token = strtoupper($a[2]); 
    756                                     if ($token == 'EXISTS') { 
    757                                             $this->exists = (int) $a[1]; 
    758                                     } 
    759                                     else if ($token == 'RECENT') { 
    760                                             $this->recent = (int) $a[1]; 
    761                                     } 
     752                            $line = rtrim($this->readLine(512)); 
     753 
     754                            if (preg_match('/^\* ([0-9]+) (EXISTS|RECENT)$/', $line, $m)) { 
     755                                $token = strtolower($m[2]); 
     756                                $this->$token = (int) $m[1]; 
    762757                            } 
    763758                            else if (preg_match('/\[?PERMANENTFLAGS\s+\(([^\)]+)\)\]/U', $line, $match)) { 
     
    766761                    } while (!$this->startsWith($line, 'sel1', true, true)); 
    767762 
    768                     if (strcasecmp($a[1], 'OK') == 0) { 
     763            if ($this->parseResult($line) == 0) { 
    769764                            $this->selected = $mailbox; 
    770765                            return true; 
    771766                    } 
    772             else { 
    773                 $this->error = "Couldn't select $mailbox"; 
    774             } 
    775             } 
    776  
     767            } 
     768 
     769        $this->error = "Couldn't select $mailbox"; 
    777770        return false; 
    778771    } 
Note: See TracChangeset for help on using the changeset viewer.