Changeset 1713 in subversion
- Timestamp:
- Sep 2, 2008 8:29:31 AM (5 years ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 2 edited
-
include/rcube_imap.php (modified) (4 diffs)
-
lib/imap.inc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_imap.php
r1664 r1713 60 60 var $uid_id_map = array(); 61 61 var $msg_headers = array(); 62 var $capabilities = array();63 62 var $skip_deleted = FALSE; 64 63 var $search_set = NULL; … … 132 131 if ($this->conn) 133 132 { 134 $this->_parse_capability($this->conn->capability);135 136 133 if (!empty($this->conn->delimiter)) 137 134 $this->delimiter = $this->conn->delimiter; … … 330 327 function get_capability($cap) 331 328 { 332 $cap = strtoupper($cap); 333 return $this->capabilities[$cap]; 329 return iil_C_GetCapability($this->conn, strtoupper($cap)); 334 330 } 335 331 … … 2579 2575 2580 2576 return $uid; 2581 }2582 2583 2584 /**2585 * Parse string or array of server capabilities and put them in internal array2586 * @access private2587 */2588 function _parse_capability($caps)2589 {2590 if (!is_array($caps))2591 $cap_arr = explode(' ', $caps);2592 else2593 $cap_arr = $caps;2594 2595 foreach ($cap_arr as $cap)2596 {2597 if ($cap=='CAPABILITY')2598 continue;2599 2600 if (strpos($cap, '=')>0)2601 {2602 list($key, $value) = explode('=', $cap);2603 if (!is_array($this->capabilities[$key]))2604 $this->capabilities[$key] = array();2605 2606 $this->capabilities[$key][] = $value;2607 }2608 else2609 $this->capabilities[$cap] = TRUE;2610 }2611 2577 } 2612 2578 -
trunk/roundcubemail/program/lib/imap.inc
r1691 r1713 53 53 - Removed some debuggers (echo ...) 54 54 File altered by Aleksander Machniak <alec@alec.pl> 55 - RFC3501 [7.1] don't call CAPABILITY if was returned in server56 optional resposne in iil_Connect()57 55 - trim(chop()) replaced by trim() 58 56 - added iil_Escape() with support for " and \ in folder names … … 65 63 - removed flush() calls in iil_C_HandlePartBody() to prevent from memory leak (#1485187) 66 64 - don't return "??" from iil_C_GetQuota() 65 - RFC3501 [7.1] don't call CAPABILITY if was returned in server 66 optional resposne in iil_Connect(), added iil_C_GetCapability() 67 67 68 68 ********************************************************/ … … 127 127 var $capability = array(); 128 128 var $permanentflags = array(); 129 var $capability_readed = false; 129 130 } 130 131 … … 295 296 } 296 297 298 function iil_C_GetCapability(&$conn, $name) 299 { 300 if (in_array($name, $conn->capability)) { 301 return $conn->capability[$name]; 302 } 303 else if ($conn->capability_readed) { 304 return false; 305 } 306 307 // get capabilities (only once) because initial 308 // optional CAPABILITY response may differ 309 $conn->capability = array(); 310 311 iil_PutLine($conn->fp, "cp01 CAPABILITY"); 312 do { 313 $line = trim(iil_ReadLine($conn->fp, 1024)); 314 $a = explode(' ', $line); 315 if ($line[0] == '*') { 316 while (list($k, $w) = each($a)) { 317 if ($w != '*' && $w != 'CAPABILITY') 318 $conn->capability[] = strtoupper($w); 319 } 320 } 321 } while ($a[0] != 'cp01'); 322 323 $conn->capability_readed = true; 324 325 if (in_array($name, $conn->capability)) { 326 return $conn->capability[$name]; 327 } 328 329 return false; 330 } 331 297 332 function iil_C_Authenticate(&$conn, $user, $pass, $encChallenge) { 298 333 … … 399 434 global $my_prefs; 400 435 401 if (!i n_array('NAMESPACE', $conn->capability)) {436 if (!iil_C_GetCapability($conn, 'NAMESPACE')) { 402 437 return false; 403 438 } … … 517 552 518 553 // RFC3501 [7.1] optional CAPABILITY response 519 // commented out, because it's not working always as should 520 // if (preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)) { 521 // $conn->capability = explode(' ', $matches[1]); 522 // } else { 523 iil_PutLine($conn->fp, "cp01 CAPABILITY"); 524 do { 525 $line = trim(iil_ReadLine($conn->fp, 1024)); 526 527 $conn->message .= "$line\n"; 528 529 $a = explode(' ', $line); 530 if ($line[0] == '*') { 531 while (list($k, $w) = each($a)) { 532 if ($w != '*' && $w != 'CAPABILITY') 533 $conn->capability[] = $w; 534 } 535 } 536 } while ($a[0] != 'cp01'); 537 // } 554 if (preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)) { 555 $conn->capability = explode(' ', strtoupper($matches[1])); 556 } 538 557 539 558 if (strcasecmp($auth_method, "check") == 0) { 540 559 //check for supported auth methods 541 542 //default to plain text auth 543 $auth_method = 'plain'; 544 545 //check for CRAM-MD5 546 foreach ($conn->capability as $c) 547 if (strcasecmp($c, 'AUTH=CRAM_MD5') == 0 || 548 strcasecmp($c, 'AUTH=CRAM-MD5') == 0) { 549 $auth_method = 'auth'; 550 break; 551 } 560 if (iil_C_GetCapability($conn, 'AUTH=CRAM-MD5') || iil_C_GetCapability($conn, 'AUTH=CRAM_MD5')) { 561 $auth_method = 'auth'; 562 } 563 else { 564 //default to plain text auth 565 $auth_method = 'plain'; 566 } 552 567 } 553 568
Note: See TracChangeset
for help on using the changeset viewer.
