| | |
| | | */ |
| | | function messagecount($mbox_name='', $mode='ALL', $force=false, $status=true) |
| | | { |
| | | $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | return $this->_messagecount($mailbox, $mode, $force, $status); |
| | | } |
| | | |
| | |
| | | { |
| | | $mode = strtoupper($mode); |
| | | |
| | | if (empty($mailbox)) |
| | | if (!strlen($mailbox)) |
| | | $mailbox = $this->mailbox; |
| | | |
| | | // count search set |
| | |
| | | $fbox = $from_mbox; |
| | | $tbox = $to_mbox; |
| | | $to_mbox = $this->mod_mailbox($to_mbox); |
| | | $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; |
| | | $from_mbox = strlen($from_mbox) ? $this->mod_mailbox($from_mbox) : $this->mailbox; |
| | | |
| | | list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox); |
| | | |
| | |
| | | */ |
| | | function clear_mailbox($mbox_name=NULL) |
| | | { |
| | | $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | |
| | | // SELECT will set messages count for clearFolder() |
| | | if ($this->conn->select($mailbox)) { |
| | |
| | | $a_mboxes = $this->_list_mailboxes($root, $filter); |
| | | |
| | | foreach ($a_mboxes as $idx => $mbox_row) { |
| | | if ($name = $this->mod_mailbox($mbox_row, 'out')) |
| | | if (strlen($name = $this->mod_mailbox($mbox_row, 'out'))) |
| | | $a_out[] = $name; |
| | | unset($a_mboxes[$idx]); |
| | | } |
| | |
| | | |
| | | // modify names with root dir |
| | | foreach ($a_mboxes as $idx => $mbox_name) { |
| | | if ($name = $this->mod_mailbox($mbox_name, 'out')) |
| | | if (strlen($name = $this->mod_mailbox($mbox_name, 'out'))) |
| | | $a_folders[] = $name; |
| | | unset($a_mboxes[$idx]); |
| | | } |
| | |
| | | */ |
| | | function mailbox_exists($mbox_name, $subscription=false) |
| | | { |
| | | if ($mbox_name) { |
| | | if ($mbox_name == 'INBOX') |
| | | return true; |
| | | if ($mbox_name == 'INBOX') |
| | | return true; |
| | | |
| | | $key = $subscription ? 'subscribed' : 'existing'; |
| | | $mbox = $this->mod_mailbox($mbox_name); |
| | | $key = $subscription ? 'subscribed' : 'existing'; |
| | | $mbox = $this->mod_mailbox($mbox_name); |
| | | |
| | | if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key])) |
| | | return true; |
| | | if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key])) |
| | | return true; |
| | | |
| | | if ($subscription) { |
| | | $a_folders = $this->conn->listSubscribed('', $mbox); |
| | | } |
| | | else { |
| | | $a_folders = $this->conn->listMailboxes('', $mbox); |
| | | } |
| | | if ($subscription) { |
| | | $a_folders = $this->conn->listSubscribed('', $mbox); |
| | | } |
| | | else { |
| | | $a_folders = $this->conn->listMailboxes('', $mbox); |
| | | } |
| | | |
| | | if (is_array($a_folders) && in_array($mbox, $a_folders)) { |
| | | $this->icache[$key][] = $mbox; |
| | | return true; |
| | | } |
| | | if (is_array($a_folders) && in_array($mbox, $a_folders)) { |
| | | $this->icache[$key][] = $mbox; |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | |
| | | */ |
| | | function mod_mailbox($mbox_name, $mode='in') |
| | | { |
| | | if (empty($mbox_name)) |
| | | if (!strlen($mbox_name)) |
| | | return ''; |
| | | |
| | | if ($mode == 'in') { |
| | |
| | | if ($mailbox) |
| | | $mailbox = $this->mod_mailbox($mailbox); |
| | | |
| | | if ($this->get_capability('METADATA') || |
| | | empty($mailbox) && $this->get_capability('METADATA-SERVER') |
| | | if ($this->get_capability('METADATA') || |
| | | (!strlen($mailbox) && $this->get_capability('METADATA-SERVER')) |
| | | ) { |
| | | return $this->conn->setMetadata($mailbox, $entries); |
| | | } |
| | |
| | | $mailbox = $this->mod_mailbox($mailbox); |
| | | |
| | | if ($this->get_capability('METADATA') || |
| | | empty($mailbox) && $this->get_capability('METADATA-SERVER') |
| | | (!strlen($mailbox) && $this->get_capability('METADATA-SERVER')) |
| | | ) { |
| | | return $this->conn->deleteMetadata($mailbox, $entries); |
| | | } |
| | |
| | | $mailbox = $this->mod_mailbox($mailbox); |
| | | |
| | | if ($this->get_capability('METADATA') || |
| | | empty($mailbox) && $this->get_capability('METADATA-SERVER') |
| | | !strlen(($mailbox) && $this->get_capability('METADATA-SERVER')) |
| | | ) { |
| | | return $this->conn->getMetadata($mailbox, $entries, $options); |
| | | } |