Changeset 4187 in subversion for trunk/roundcubemail/program/include/rcube_imap_generic.php
- Timestamp:
- Nov 5, 2010 8:24:52 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_imap_generic.php
r4173 r4187 322 322 } 323 323 324 private function set _error($code, $msg='')324 private function setError($code, $msg='') 325 325 { 326 326 $this->errornum = $code; … … 399 399 if ($type == 'CRAM-MD5' || $type == 'DIGEST-MD5') { 400 400 if ($type == 'DIGEST-MD5' && !class_exists('Auth_SASL')) { 401 $this->set _error(self::ERROR_BYE,401 $this->setError(self::ERROR_BYE, 402 402 "The Auth_SASL package is required for DIGEST-MD5 authentication"); 403 403 return self::ERROR_BAD; 404 404 } 405 405 406 $this->putLine($this->next _tag() . " AUTHENTICATE $type");406 $this->putLine($this->nextTag() . " AUTHENTICATE $type"); 407 407 $line = trim($this->readLine(1024)); 408 408 … … 467 467 $challenge = base64_decode($challenge); 468 468 if (strpos($challenge, 'rspauth=') === false) { 469 $this->set _error(self::ERROR_BAD,469 $this->setError(self::ERROR_BAD, 470 470 "Unexpected response from server to DIGEST-MD5 response"); 471 471 return self::ERROR_BAD; … … 496 496 } 497 497 else { 498 $this->putLine($this->next _tag() . " AUTHENTICATE PLAIN");498 $this->putLine($this->nextTag() . " AUTHENTICATE PLAIN"); 499 499 $line = trim($this->readLine(1024)); 500 500 … … 518 518 } 519 519 else { 520 $this->set _error($result, "Unable to authenticate user ($type): $line");520 $this->setError($result, "Unable to authenticate user ($type): $line"); 521 521 } 522 522 … … 693 693 // check input 694 694 if (empty($host)) { 695 $this->set _error(self::ERROR_BAD, "Empty host");695 $this->setError(self::ERROR_BAD, "Empty host"); 696 696 return false; 697 697 } 698 698 if (empty($user)) { 699 $this->set _error(self::ERROR_NO, "Empty user");699 $this->setError(self::ERROR_NO, "Empty user"); 700 700 return false; 701 701 } 702 702 if (empty($password)) { 703 $this->set _error(self::ERROR_NO, "Empty password");703 $this->setError(self::ERROR_NO, "Empty password"); 704 704 return false; 705 705 } … … 720 720 721 721 if (!$this->fp) { 722 $this->set _error(self::ERROR_BAD, sprintf("Could not connect to %s:%d: %s", $host, $this->prefs['port'], $errstr));722 $this->setError(self::ERROR_BAD, sprintf("Could not connect to %s:%d: %s", $host, $this->prefs['port'], $errstr)); 723 723 return false; 724 724 } … … 740 740 $error = sprintf("Empty startup greeting (%s:%d)", $host, $this->prefs['port']); 741 741 742 $this->set _error(self::ERROR_BAD, $error);742 $this->setError(self::ERROR_BAD, $error); 743 743 $this->close(); 744 744 return false; … … 763 763 764 764 if (!stream_socket_enable_crypto($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { 765 $this->set _error(self::ERROR_BAD, "Unable to negotiate TLS");765 $this->setError(self::ERROR_BAD, "Unable to negotiate TLS"); 766 766 $this->close(); 767 767 return false; … … 795 795 // Prevent from sending credentials in plain text when connection is not secure 796 796 if ($auth_method == 'LOGIN' && $this->getCapability('LOGINDISABLED')) { 797 $this->set _error(self::ERROR_BAD, "Login disabled by IMAP server");797 $this->setError(self::ERROR_BAD, "Login disabled by IMAP server"); 798 798 $this->close(); 799 799 return false; … … 818 818 break; 819 819 default: 820 $this->set _error(self::ERROR_BAD, "Configuration error. Unknown auth method: $method");820 $this->setError(self::ERROR_BAD, "Configuration error. Unknown auth method: $method"); 821 821 } 822 822 … … 850 850 function close() 851 851 { 852 if ($this->putLine($this->next _tag() . ' LOGOUT')) {852 if ($this->putLine($this->nextTag() . ' LOGOUT')) { 853 853 $this->readReply(); 854 854 } … … 1087 1087 1088 1088 // build FETCH command string 1089 $key = $this->next _tag();1089 $key = $this->nextTag(); 1090 1090 $cmd = $uidfetch ? 'UID FETCH' : 'FETCH'; 1091 1091 $deleted = $skip_deleted ? ' FLAGS' : ''; … … 1108 1108 1109 1109 if (!$this->putLine($request)) { 1110 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $request");1110 $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 1111 1111 return false; 1112 1112 } … … 1312 1312 1313 1313 /* FETCH uid, size, flags and headers */ 1314 $key = $this->next _tag();1314 $key = $this->nextTag(); 1315 1315 $request = $key . ($uidfetch ? ' UID' : '') . " FETCH $message_set "; 1316 1316 $request .= "(UID RFC822.SIZE FLAGS INTERNALDATE "; … … 1321 1321 1322 1322 if (!$this->putLine($request)) { 1323 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $request");1323 $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 1324 1324 return false; 1325 1325 } … … 1706 1706 // Clear internal status cache 1707 1707 unset($this->data['STATUS:'.$from]); 1708 1708 1709 1709 return $this->delete($from, $messages); 1710 1710 } … … 1849 1849 1850 1850 if ($esearch) { 1851 // Skip prefix: ... (TAG "A285") UID ... 1851 // Skip prefix: ... (TAG "A285") UID ... 1852 1852 $this->tokenizeResponse($response, $return_uid ? 2 : 1); 1853 1853 … … 1878 1878 $result['ALL'] = $this->compressMessageSet($response, true); 1879 1879 1880 return $result; 1880 return $result; 1881 1881 } 1882 1882 else { … … 2018 2018 $result = false; 2019 2019 $parts = (array) $parts; 2020 $key = $this->next _tag();2020 $key = $this->nextTag(); 2021 2021 $peeks = ''; 2022 2022 $idx = 0; … … 2031 2031 // send request 2032 2032 if (!$this->putLine($request)) { 2033 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $request");2033 $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 2034 2034 return false; 2035 2035 } … … 2082 2082 // format request 2083 2083 $reply_key = '* ' . $id; 2084 $key = $this->next _tag();2084 $key = $this->nextTag(); 2085 2085 $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])"; 2086 2086 2087 2087 // send request 2088 2088 if (!$this->putLine($request)) { 2089 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $request");2089 $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 2090 2090 return false; 2091 2091 } … … 2274 2274 } 2275 2275 2276 $key = $this->next _tag();2276 $key = $this->nextTag(); 2277 2277 $request = sprintf("$key APPEND %s (\\Seen) {%d%s}", $this->escape($mailbox), 2278 2278 $len, ($this->prefs['literal+'] ? '+' : '')); … … 2303 2303 } 2304 2304 else { 2305 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $request");2305 $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 2306 2306 } 2307 2307 … … 2321 2321 } 2322 2322 if (!$in_fp) { 2323 $this->set _error(self::ERROR_UNKNOWN, "Couldn't open $path for reading");2323 $this->setError(self::ERROR_UNKNOWN, "Couldn't open $path for reading"); 2324 2324 return false; 2325 2325 } … … 2338 2338 2339 2339 // send APPEND command 2340 $key = $this->next _tag();2340 $key = $this->nextTag(); 2341 2341 $request = sprintf("$key APPEND %s (\\Seen) {%d%s}", $this->escape($mailbox), 2342 2342 $len, ($this->prefs['literal+'] ? '+' : '')); … … 2380 2380 } 2381 2381 else { 2382 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $request");2382 $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 2383 2383 } 2384 2384 … … 2392 2392 } 2393 2393 2394 $key = $this->next _tag();2394 $key = $this->nextTag(); 2395 2395 $result = false; 2396 2396 $command = $key . ($is_uid ? ' UID' : '') ." FETCH $id (BODYSTRUCTURE)"; … … 2407 2407 } 2408 2408 else { 2409 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $command");2409 $this->setError(self::ERROR_COMMAND, "Unable to send command: $command"); 2410 2410 } 2411 2411 … … 2423 2423 $result = false; 2424 2424 $quota_lines = array(); 2425 $key = $this->next _tag();2425 $key = $this->nextTag(); 2426 2426 $command = $key . ' GETQUOTAROOT INBOX'; 2427 2427 … … 2436 2436 } 2437 2437 else { 2438 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $command");2438 $this->setError(self::ERROR_COMMAND, "Unable to send command: $command"); 2439 2439 } 2440 2440 … … 2544 2544 } 2545 2545 2546 $this->set _error(self::ERROR_COMMAND, "Incomplete ACL response");2546 $this->setError(self::ERROR_COMMAND, "Incomplete ACL response"); 2547 2547 return NULL; 2548 2548 } … … 2623 2623 { 2624 2624 if (!is_array($entries) || empty($entries)) { 2625 $this->set _error(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command");2625 $this->setError(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command"); 2626 2626 return false; 2627 2627 } … … 2661 2661 2662 2662 if (empty($entries)) { 2663 $this->set _error(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command");2663 $this->setError(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command"); 2664 2664 return false; 2665 2665 } … … 2766 2766 { 2767 2767 if (!is_array($data) || empty($data)) { 2768 $this->set _error(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command");2768 $this->setError(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command"); 2769 2769 return false; 2770 2770 } … … 2806 2806 { 2807 2807 if (!is_array($data) || empty($data)) { 2808 $this->set _error(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command");2808 $this->setError(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command"); 2809 2809 return false; 2810 2810 } … … 2895 2895 * @since 0.5-beta 2896 2896 */ 2897 function next _tag()2897 function nextTag() 2898 2898 { 2899 2899 $this->cmd_num++; … … 2916 2916 function execute($command, $arguments=array(), $options=0) 2917 2917 { 2918 $tag = $this->next _tag();2918 $tag = $this->nextTag(); 2919 2919 $query = $tag . ' ' . $command; 2920 2920 $noresp = ($options & self::COMMAND_NORESPONSE); … … 2926 2926 // Send command 2927 2927 if (!$this->putLineC($query)) { 2928 $this->set _error(self::ERROR_COMMAND, "Unable to send command: $query");2928 $this->setError(self::ERROR_COMMAND, "Unable to send command: $query"); 2929 2929 return $noresp ? self::ERROR_COMMAND : array(self::ERROR_COMMAND, ''); 2930 2930 } … … 3079 3079 } 3080 3080 3081 private function SplitHeaderLine($string)3081 private function splitHeaderLine($string) 3082 3082 { 3083 3083 $pos = strpos($string, ':');
Note: See TracChangeset
for help on using the changeset viewer.
