Return the list of special mailboxes.
public static getSpecialMailboxes ( ) : array | ||
return | array | A list of mailboxes, with the self::SPECIAL_* constants as keys and values containing the IMP_Mailbox objects or null if the mailbox doesn't exist (self::SPECIAL_SENT contains an array of objects). |
/** * Autocreate special mailboxes on login. */ public function execute() { foreach (IMP_Mailbox::getSpecialMailboxes() as $key => $val) { if (is_null($val)) { continue; } switch ($key) { case IMP_Mailbox::SPECIAL_COMPOSETEMPLATES: $val->create(); break; case IMP_Mailbox::SPECIAL_DRAFTS: $val->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_DRAFTS))); break; case IMP_Mailbox::SPECIAL_SENT: foreach ($val as $mbox) { $mbox->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_SENT))); } break; case IMP_Mailbox::SPECIAL_SPAM: $val->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_JUNK))); break; case IMP_Mailbox::SPECIAL_TRASH: $val->create(array('special_use' => array(Horde_Imap_Client::SPECIALUSE_TRASH))); break; } } }
/** * Return the mailboxes that can be searched to find the sent message. * * @return array Array of mailboxes to search in order of priority. */ public function searchMailboxes() { $special = IMP_Mailbox::getSpecialMailboxes(); /* Check for sent-mail mailbox(es) first. */ $out = $special[IMP_Mailbox::SPECIAL_SENT]; /* Add trash mailbox as backup. */ if (!empty($special[IMP_Mailbox::SPECIAL_TRASH]) && !$special[IMP_Mailbox::SPECIAL_TRASH]->vtrash) { $out[] = $special[IMP_Mailbox::SPECIAL_TRASH]; } return $out; }
/** * Update the list of mailboxes to ignore when caching FETCH data in the * IMAP client object. */ public function updateFetchIgnore() { if ($this->isImap()) { $special = IMP_Mailbox::getSpecialMailboxes(); $cache = $this->_ob->getParam('cache'); $cache['fetch_ignore'] = array_filter(array(strval($special[IMP_Mailbox::SPECIAL_SPAM]), strval($special[IMP_Mailbox::SPECIAL_TRASH]))); $this->_ob->setParam('cache', $cache); } }
/** * Return the list of special mailboxes. * * @return @see IMP_Mailbox::getSpecialMailboxes() */ public function getSpecialMailboxes() { return IMP_Mailbox::getSpecialMailboxes(); }
/** * Return the mailboxes that can be searched to find the sent message. * * @return array Array of mailboxes to search in order of priority. */ public function searchMailboxes() { $special = IMP_Mailbox::getSpecialMailboxes(); /* Check for sent-mail mailbox(es) first. */ $out = array(); if ($this->folder) { $out[] = new IMP_Mailbox($this->folder); } $out = array_unique(array_merge($out, $special[IMP_Mailbox::SPECIAL_SENT])); /* Add trash mailbox as backup. */ if (!empty($special[IMP_Mailbox::SPECIAL_TRASH]) && !$special[IMP_Mailbox::SPECIAL_TRASH]->vtrash) { $out[] = $special[IMP_Mailbox::SPECIAL_TRASH]; } return $out; }