Changeset 5054 in subversion
- Timestamp:
- Aug 12, 2011 5:21:21 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-mcache/roundcubemail/program/include/rcube_imap_generic.php
r5053 r5054 870 870 * Executes SELECT command (if mailbox is already not in selected state) 871 871 * 872 * @param string $mailbox Mailbox name 872 * @param string $mailbox Mailbox name 873 * @param array $qresync_data QRESYNC data (RFC5162) 873 874 * 874 875 * @return boolean True on success, false on error 875 876 * @access public 876 877 */ 877 function select($mailbox )878 function select($mailbox, $qresync_data = null) 878 879 { 879 880 if (!strlen($mailbox)) { … … 894 895 } 895 896 */ 896 list($code, $response) = $this->execute('SELECT', array($this->escape($mailbox))); 897 $params = array($this->escape($mailbox)); 898 899 // QRESYNC data items 900 // 0. the last known UIDVALIDITY, 901 // 1. the last known modification sequence, 902 // 2. the optional set of known UIDs, and 903 // 3. an optional parenthesized list of known sequence ranges and their 904 // corresponding UIDs. 905 if (!empty($qresync_data)) { 906 if (!empty($qresync_data[2])) 907 $qresync_data[2] = self::compressMessageSet($qresync_data[2]); 908 $params[] = array('QRESYNC', $qresync_data); 909 } 910 911 list($code, $response) = $this->execute('SELECT', $params); 897 912 898 913 if ($code == self::ERROR_OK) { … … 916 931 $this->data['PERMANENTFLAGS'] = explode(' ', $match[1]); 917 932 } 933 } 934 // QRESYNC FETCH response (RFC5162) 935 else if (preg_match('/^\* ([0-9+]) FETCH/i', $line, $match)) { 936 $line = substr($line, strlen($match[0])); 937 $fetch_data = $this->tokenizeResponse($line, 1); 938 $data = array('id' => $match[1]); 939 940 for ($i=0, $size=count($fetch_data); $i<$size; $i+=2) { 941 $data[strtolower($fetch_data[$i])] = $fetch_data[$i+1]; 942 } 943 944 $this->data['QRESYNC'][$data['uid']] = $data; 945 } 946 // QRESYNC VANISHED response (RFC5162) 947 else if (preg_match('/^\* VANISHED [EARLIER]*/i', $line, $match)) { 948 $line = substr($line, strlen($match[0])); 949 $v_data = $this->tokenizeResponse($line, 1); 950 951 $this->data['VANISHED'] = $v_data; 918 952 } 919 953 } … … 1531 1565 * @param array $query_items FETCH command data items 1532 1566 * @param string $mod_seq Modification sequence for CHANGEDSINCE (RFC4551) query 1567 * @param bool $vanished Enables VANISHED parameter (RFC5162) for CHANGEDSINCE query 1533 1568 * 1534 1569 * @return array List of rcube_mail_header elements, False on error … … 1536 1571 * @since 0.6 1537 1572 */ 1538 function fetch($mailbox, $message_set, $is_uid = false, $query_items = array(), $mod_seq = null) 1573 function fetch($mailbox, $message_set, $is_uid = false, $query_items = array(), 1574 $mod_seq = null, $vanished = false) 1539 1575 { 1540 1576 if (!$this->select($mailbox)) { … … 1550 1586 1551 1587 if ($mod_seq !== null && $this->hasCapability('CONDSTORE')) { 1552 $request .= " (CHANGEDSINCE $mod_seq )";1588 $request .= " (CHANGEDSINCE $mod_seq" . ($vanished ? " VANISHED" : '') .")"; 1553 1589 } 1554 1590 … … 1751 1787 } 1752 1788 } 1789 1790 // VANISHED response (QRESYNC RFC5162) 1791 // Sample: * VANISHED (EARLIER) 300:310,405,411 1792 1793 else if (preg_match('/^\* VANISHED [EARLIER]*/i', $line, $match)) { 1794 $line = substr($line, strlen($match[0])); 1795 $v_data = $this->tokenizeResponse($line, 1); 1796 1797 $this->data['VANISHED'] = $v_data; 1798 } 1799 1753 1800 } while (!$this->startsWith($line, $key, true)); 1754 1801 … … 3211 3258 3212 3259 if (!empty($arguments)) { 3213 $query .= ' ' . implode(' ', $arguments); 3260 foreach ($arguments as $arg) { 3261 $query .= ' ' . self::r_implode($arg); 3262 } 3214 3263 } 3215 3264 … … 3342 3391 } 3343 3392 3393 static function r_implode($element) 3394 { 3395 $string = ''; 3396 3397 if (is_array($element)) { 3398 reset($element); 3399 while (list($key, $value) = each($element)) { 3400 $string .= ' ' . self::r_implode($value); 3401 } 3402 } 3403 else { 3404 return $element; 3405 } 3406 3407 return '(' . trim($string) . ')'; 3408 } 3409 3344 3410 private function _xor($string, $string2) 3345 3411 {
Note: See TracChangeset
for help on using the changeset viewer.
