| | |
| | | $a_msg_headers, $this->sort_field, $this->sort_order); |
| | | |
| | | // only return the requested part of the set |
| | | $a_msg_headers = array_slice(array_values($a_msg_headers), |
| | | $from, min($cnt-$to, $this->page_size)); |
| | | $slice_length = min($this->page_size, $cnt - ($to > $cnt ? $from : $to)); |
| | | $a_msg_headers = array_slice(array_values($a_msg_headers), $from, $slice_length); |
| | | |
| | | if ($slice) { |
| | | $a_msg_headers = array_slice($a_msg_headers, -$slice, $slice); |
| | |
| | | |
| | | /** |
| | | * Sends the whole message source to stdout |
| | | * |
| | | * @param int $uid Message UID |
| | | * @param bool $formatted Enables line-ending formatting |
| | | */ |
| | | public function print_raw_body($uid) |
| | | public function print_raw_body($uid, $formatted = true) |
| | | { |
| | | if (!$this->check_connection()) { |
| | | return; |
| | | } |
| | | |
| | | $this->conn->handlePartBody($this->folder, $uid, true, NULL, NULL, true); |
| | | $this->conn->handlePartBody($this->folder, $uid, true, null, null, true, null, $formatted); |
| | | } |
| | | |
| | | |
| | |
| | | $result = $this->conn->flag($folder, $uids, $flag); |
| | | } |
| | | |
| | | if ($result) { |
| | | if ($result && !$skip_cache) { |
| | | // reload message headers if cached |
| | | // @TODO: update flags instead removing from cache |
| | | if (!$skip_cache && ($mcache = $this->get_mcache_engine())) { |
| | | // update flags instead removing from cache |
| | | if ($mcache = $this->get_mcache_engine()) { |
| | | $status = strpos($flag, 'UN') !== 0; |
| | | $mflag = preg_replace('/^UN/', '', $flag); |
| | | $mcache->change_flag($folder, $all_mode ? null : explode(',', $uids), |
| | |
| | | $this->clear_messagecount($folder, 'SEEN'); |
| | | $this->clear_messagecount($folder, 'UNSEEN'); |
| | | } |
| | | else if ($flag == 'DELETED') { |
| | | else if ($flag == 'DELETED' || $flag == 'UNDELETED') { |
| | | $this->clear_messagecount($folder, 'DELETED'); |
| | | // remove cached messages |
| | | if ($this->options['skip_deleted']) { |
| | | $this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (!strlen($folder)) { |
| | | $folder = $this->folder; |
| | | } |
| | | |
| | | if (!$this->check_connection()) { |
| | | return false; |
| | | } |
| | | |
| | | // make sure folder exists |
| | |
| | | return $this->delete_folder($folder); |
| | | } |
| | | |
| | | function clear_mailbox($folder = null) |
| | | { |
| | | return $this->clear_folder($folder); |
| | | } |
| | | |
| | | public function mailbox_exists($folder, $subscription=false) |
| | | { |
| | | return $this->folder_exists($folder, $subscription); |