Changeset fc7a41f in github
- Timestamp:
- Oct 25, 2010 4:32:53 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 2b42838
- Parents:
- 781f0ca5
- File:
-
- 1 edited
-
program/include/rcube_imap_generic.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcube_imap_generic.php
r781f0ca5 rfc7a41f 535 535 } 536 536 537 function get Namespace()537 function getRootDir() 538 538 { 539 539 if (isset($this->prefs['rootdir']) && is_string($this->prefs['rootdir'])) { … … 542 542 } 543 543 544 if (!is_array($data = $this-> _namespace())) {544 if (!is_array($data = $this->getNamespace())) { 545 545 return false; 546 546 } 547 547 548 $user_space_data = $data[ 0];548 $user_space_data = $data['personal']; 549 549 if (!is_array($user_space_data)) { 550 550 return false; … … 552 552 553 553 $first_userspace = $user_space_data[0]; 554 if (count($first_userspace) !=2) {554 if (count($first_userspace) !=2 ) { 555 555 return false; 556 556 } … … 563 563 return true; 564 564 } 565 566 565 567 566 /** … … 599 598 // if that fails, try namespace extension 600 599 // try to fetch namespace data 601 if (!is_array($data = $this-> _namespace())) {600 if (!is_array($data = $this->getNamespace())) { 602 601 return false; 603 602 } 604 603 605 604 // extract user space data (opposed to global/shared space) 606 $user_space_data = $data[ 0];605 $user_space_data = $data['personal']; 607 606 if (!is_array($user_space_data)) { 608 607 return false; … … 619 618 } 620 619 621 function _namespace() 622 { 620 /** 621 * NAMESPACE handler (RFC 2342) 622 * 623 * @return array Namespace data hash (personal, other, shared) 624 */ 625 function getNamespace() 626 { 627 if (array_key_exists('namespace', $this->prefs)) { 628 return $this->prefs['namespace']; 629 } 630 623 631 if (!$this->getCapability('NAMESPACE')) { 624 return false;632 return self::ERROR_BAD; 625 633 } 626 634 … … 628 636 629 637 if ($code == self::ERROR_OK && preg_match('/^\* NAMESPACE /', $response)) { 630 $data = $this-> parseNamespace(substr($response, 11), $i, 0, 0);638 $data = $this->tokenizeResponse(substr($response, 11)); 631 639 } 632 640 633 641 if (!is_array($data)) { 634 return false; 635 } 636 637 return $data; 642 return $code; 643 } 644 645 $this->prefs['namespace'] = array( 646 'personal' => $data[0], 647 'other' => $data[1], 648 'shared' => $data[2], 649 ); 650 651 return $this->prefs['namespace']; 638 652 } 639 653 … … 790 804 $this->clearCapability(); 791 805 } 792 $this->get Namespace();806 $this->getRootDir(); 793 807 $this->logged = true; 794 808 … … 2954 2968 } 2955 2969 2956 private function parseNamespace($str, &$i, $len=0, $l)2957 {2958 if (!$l) {2959 $str = str_replace('NIL', '()', $str);2960 }2961 if (!$len) {2962 $len = strlen($str);2963 }2964 $data = array();2965 $in_quotes = false;2966 $elem = 0;2967 2968 for ($i; $i<$len; $i++) {2969 $c = (string)$str[$i];2970 if ($c == '(' && !$in_quotes) {2971 $i++;2972 $data[$elem] = $this->parseNamespace($str, $i, $len, $l++);2973 $elem++;2974 } else if ($c == ')' && !$in_quotes) {2975 return $data;2976 } else if ($c == '\\') {2977 $i++;2978 if ($in_quotes) {2979 $data[$elem] .= $str[$i];2980 }2981 } else if ($c == '"') {2982 $in_quotes = !$in_quotes;2983 if (!$in_quotes) {2984 $elem++;2985 }2986 } else if ($in_quotes) {2987 $data[$elem].=$c;2988 }2989 }2990 2991 return $data;2992 }2993 2994 2970 private function parseCapability($str) 2995 2971 {
Note: See TracChangeset
for help on using the changeset viewer.
