Changeset 4471 in subversion
- Timestamp:
- Jan 30, 2011 2:43:26 PM (2 years ago)
- File:
-
- 1 edited
-
trunk/plugins/managesieve/lib/Net/Sieve.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/managesieve/lib/Net/Sieve.php
r3801 r4471 764 764 } 765 765 766 return preg_replace('/ {[0-9]+}\r\n/', '', $res);766 return preg_replace('/^{[0-9]+}\r\n/', '', $res); 767 767 } 768 768 … … 982 982 983 983 /** 984 * Receives x bytes from the server. 985 * 986 * @param int $length Number of bytes to read 987 * 988 * @return string The server response. 989 */ 990 function _recvBytes($length) 991 { 992 $response = ''; 993 $response_length = 0; 994 995 while ($response_length < $length) { 996 $response .= $this->_sock->read($length - $response_length); 997 $response_length = $this->_getLineLength($response); 998 } 999 1000 $this->_debug("S: " . rtrim($response)); 1001 1002 return $response; 1003 } 1004 1005 /** 984 1006 * Send a command and retrieves a response from the server. 985 1007 * … … 1014 1036 if ('NO' == substr($uc_line, 0, 2)) { 1015 1037 // Check for string literal error message. 1016 if (preg_match('/ ^no {([0-9]+)\+?}/i', $line, $matches)) {1017 $line .= str_replace(1018 "\r\n", ' ', $this->_sock->read($matches[1] + 2)1019 );1020 $this->_debug("S: $line");1038 if (preg_match('/{([0-9]+)}$/i', $line, $matches)) { 1039 $line = substr($line, 0, -(strlen($matches[1])+2)) 1040 . str_replace( 1041 "\r\n", ' ', $this->_recvBytes($matches[1] + 2) 1042 ); 1021 1043 } 1022 1044 return PEAR::raiseError(trim($response . substr($line, 2)), 3); … … 1053 1075 } 1054 1076 1055 if (preg_match('/^{([0-9]+)\+?}/i', $line, $matches)) { 1056 // Matches String Responses. 1057 $str_size = $matches[1] + 2; 1058 $line = ''; 1059 $line_length = 0; 1060 while ($line_length < $str_size) { 1061 $line .= $this->_sock->read($str_size - $line_length); 1062 $line_length = $this->_getLineLength($line); 1063 } 1064 $this->_debug("S: $line"); 1077 if (preg_match('/^{([0-9]+)}/i', $line, $matches)) { 1078 // Matches literal string responses. 1079 $line = $this->_recvBytes($matches[1] + 2); 1065 1080 1066 1081 if (!$auth) {
Note: See TracChangeset
for help on using the changeset viewer.
