Example #1
0
 /**
  * Gets folder options from LIST response, e.g. \Noselect, \Noinferiors
  *
  * @param string $mbox_name Folder name
  * @param bool   $force     Set to True if options should be refreshed
  *                          Options are available after LIST command only
  *
  * @return array Options list
  */
 function mailbox_options($mbox_name, $force = false)
 {
     $mbox = $this->mod_mailbox($mbox_name);
     if ($mbox == 'INBOX') {
         return array();
     }
     if (!is_array($this->conn->data['LIST']) || !is_array($this->conn->data['LIST'][$mbox])) {
         if ($force) {
             $this->conn->listMailboxes('', $mbox_name);
         } else {
             return array();
         }
     }
     $opts = $this->conn->data['LIST'][$mbox];
     return is_array($opts) ? $opts : array();
 }
Example #2
0
 /**
  * Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors
  *
  * @param string $mailbox Folder name
  * @param bool   $force   Set to True if attributes should be refreshed
  *
  * @return array Options list
  */
 function mailbox_attributes($mailbox, $force = false)
 {
     // get attributes directly from LIST command
     if (!empty($this->conn->data['LIST']) && is_array($this->conn->data['LIST'][$mailbox])) {
         $opts = $this->conn->data['LIST'][$mailbox];
     } else {
         if (!$force) {
             $opts = $this->get_cache('mailboxes.attributes');
             $opts = $opts[$mailbox];
         }
     }
     if (!is_array($opts)) {
         $this->conn->listMailboxes('', $mailbox);
         $opts = $this->conn->data['LIST'][$mailbox];
     }
     return is_array($opts) ? $opts : array();
 }
Example #3
0
 /**
  * Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors
  *
  * @param string $folder Folder name
  * @param bool   $force   Set to True if attributes should be refreshed
  *
  * @return array Options list
  */
 public function folder_attributes($folder, $force = false)
 {
     // get attributes directly from LIST command
     if (!empty($this->conn->data['LIST']) && is_array($this->conn->data['LIST'][$folder])) {
         $opts = $this->conn->data['LIST'][$folder];
     } else {
         if (!$force) {
             $opts = $this->get_cache('mailboxes.attributes');
             $opts = $opts[$folder];
         }
     }
     if (!is_array($opts)) {
         if (!$this->check_connection()) {
             return array();
         }
         $this->conn->listMailboxes('', $folder);
         $opts = $this->conn->data['LIST'][$folder];
     }
     return is_array($opts) ? $opts : array();
 }