Changeset 4041 in subversion for trunk/roundcubemail/program/include/rcube_imap_generic.php
- Timestamp:
- Oct 5, 2010 3:14:57 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_imap_generic.php
r4035 r4041 424 424 } 425 425 426 if (!$this->getCapability('NAMESPACE')) { 427 return false; 428 } 429 430 if (!$this->putLine("ns1 NAMESPACE")) { 431 return false; 432 } 433 do { 434 $line = $this->readLine(1024); 435 if (preg_match('/^\* NAMESPACE/', $line)) { 436 $i = 0; 437 $line = $this->unEscape($line); 438 $data = $this->parseNamespace(substr($line,11), $i, 0, 0); 439 } 440 } while (!$this->startsWith($line, 'ns1', true, true)); 441 442 if (!is_array($data)) { 426 if (!is_array($data = $this->_namespace())) { 443 427 return false; 444 428 } … … 489 473 490 474 do { 491 $line = $this->readLine(500); 492 if ($line[0] == '*') { 493 $line = rtrim($line); 494 $a = rcube_explode_quoted_string(' ', $this->unEscape($line)); 495 if ($a[0] == '*') { 496 $delimiter = str_replace('"', '', $a[count($a)-2]); 497 } 475 $line = $this->readLine(1024); 476 if (preg_match('/^\* LIST \([^\)]*\) "*([^"]+)"* ""/', $line, $m)) { 477 $delimiter = $this->unEscape($m[1]); 498 478 } 499 479 } while (!$this->startsWith($line, 'ghd', true, true)); … … 505 485 // if that fails, try namespace extension 506 486 // try to fetch namespace data 487 if (!is_array($data = $this->_namespace())) { 488 return false; 489 } 490 491 // extract user space data (opposed to global/shared space) 492 $user_space_data = $data[0]; 493 if (!is_array($user_space_data)) { 494 return false; 495 } 496 497 // get first element 498 $first_userspace = $user_space_data[0]; 499 if (!is_array($first_userspace)) { 500 return false; 501 } 502 503 // extract delimiter 504 $delimiter = $first_userspace[1]; 505 506 return $delimiter; 507 } 508 509 function _namespace() 510 { 511 if (!$this->getCapability('NAMESPACE')) { 512 return false; 513 } 514 507 515 if (!$this->putLine("ns1 NAMESPACE")) { 508 516 return false; … … 513 521 if (preg_match('/^\* NAMESPACE/', $line)) { 514 522 $i = 0; 515 $line = $this->unEscape($line);516 523 $data = $this->parseNamespace(substr($line,11), $i, 0, 0); 517 524 } … … 522 529 } 523 530 524 // extract user space data (opposed to global/shared space) 525 $user_space_data = $data[0]; 526 if (!is_array($user_space_data)) { 527 return false; 528 } 529 530 // get first element 531 $first_userspace = $user_space_data[0]; 532 if (!is_array($first_userspace)) { 533 return false; 534 } 535 536 // extract delimiter 537 $delimiter = $first_userspace[1]; 538 539 return $delimiter; 531 return $data; 540 532 } 541 533 … … 1658 1650 $folders[] = preg_replace(array('/^"/', '/"$/'), '', $this->unEscape($m[3])); 1659 1651 // attributes 1660 // $attrib = explode(' ', $ m[1]);1652 // $attrib = explode(' ', $this->unEscape($m[1])); 1661 1653 // delimiter 1662 // $delim = $ m[2];1654 // $delim = $this->unEscape($m[2]); 1663 1655 } 1664 1656 } while (!$this->startsWith($line, $key, true)); … … 2171 2163 $elem = 0; 2172 2164 2173 for ($i; $i<$len;$i++) {2165 for ($i; $i<$len; $i++) { 2174 2166 $c = (string)$str[$i]; 2175 2167 if ($c == '(' && !$in_quotes) { … … 2182 2174 $i++; 2183 2175 if ($in_quotes) { 2184 $data[$elem] .= $ c.$str[$i];2176 $data[$elem] .= $str[$i]; 2185 2177 } 2186 2178 } else if ($c == '"') {
Note: See TracChangeset
for help on using the changeset viewer.
