/** * Count messages all messages in current box * * @return int number of messages * @throws Zend_Mail_Storage_Exception * @throws Zend_Mail_Protocol_Exception */ public function countMessages($flags = null) { if (!$this->_currentFolder) { /** * @see Zend_Mail_Storage_Exception */ require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('No selected folder to count'); } if ($flags === null) { return count($this->_protocol->search(array('ALL'))); } $params = array(); foreach ((array)$flags as $flag) { if (isset(self::$_searchFlags[$flag])) { $params[] = self::$_searchFlags[$flag]; } else { $params[] = 'KEYWORD'; $params[] = $this->_protocol->escapeString($flag); } } return count($this->_protocol->search($params)); }
/** * return the status message id * @param array $flag * */ public function getStatusMessage($flag) { return $this->_protocol->search($flag); }