Changeset 4360 in subversion


Ignore:
Timestamp:
Dec 22, 2010 1:11:29 PM (2 years ago)
Author:
alec
Message:
  • Fix handling (skipping) of unilateral untagged server responses (in THREAD/SORT/SEARCH commands)
File:
1 edited

Legend:

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

    r4327 r4360  
    11511151 
    11521152        if ($code == self::ERROR_OK) { 
    1153             // remove prefix and \r\n from raw response 
    1154             $response = str_replace("\r\n", '', substr($response, 7)); 
    1155             return preg_split('/\s+/', $response, -1, PREG_SPLIT_NO_EMPTY); 
     1153            // remove prefix and unilateral untagged server responses 
     1154            $response = substr($response, stripos($response, '* SORT') + 7); 
     1155            if ($pos = strpos($response, '*')) { 
     1156                $response = substr($response, 0, $pos); 
     1157            } 
     1158            return preg_split('/[\s\r\n]+/', $response, -1, PREG_SPLIT_NO_EMPTY); 
    11561159        } 
    11571160 
     
    18901893            $algorithm, $encoding, $criteria)); 
    18911894 
    1892         if ($code == self::ERROR_OK && preg_match('/^\* THREAD /i', $response)) { 
    1893             // remove prefix and \r\n from raw response 
    1894             $response    = str_replace("\r\n", '', substr($response, 9)); 
     1895        if ($code == self::ERROR_OK) { 
     1896            // remove prefix... 
     1897            $response = substr($response, stripos($response, '* THREAD') + 9); 
     1898            // ...unilateral untagged server responses 
     1899            if ($pos = strpos($response, '*')) { 
     1900                $response = substr($response, 0, $pos); 
     1901            } 
     1902 
     1903            $response    = str_replace("\r\n", '', $response); 
    18951904            $depthmap    = array(); 
    18961905            $haschildren = array(); 
     
    19501959 
    19511960        if ($code == self::ERROR_OK) { 
    1952             // remove prefix and \r\n from raw response 
    1953             $response = substr($response, $esearch ? 10 : 9); 
    1954             $response = str_replace("\r\n", '', $response); 
     1961            // remove prefix... 
     1962            $response = substr($response, stripos($response,  
     1963                $esearch ? '* ESEARCH' : '* SEARCH') + ($esearch ? 10 : 9)); 
     1964            // ...and unilateral untagged server responses 
     1965            if ($pos = strpos($response, '*')) { 
     1966                $response = rtrim(substr($response, 0, $pos)); 
     1967            } 
    19551968 
    19561969            if ($esearch) { 
     
    19711984            } 
    19721985            else { 
    1973                 $response = preg_split('/\s+/', $response, -1, PREG_SPLIT_NO_EMPTY); 
     1986                $response = preg_split('/[\s\r\n]+/', $response, -1, PREG_SPLIT_NO_EMPTY); 
    19741987 
    19751988                if (!empty($items)) { 
Note: See TracChangeset for help on using the changeset viewer.