Remove unused getMailboxName() function.
* @license http://www.fsf.org/copyleft/gpl.html GPL
* @package IMP
*/
-class IMP_Mailbox
+class IMP_Mailbox implements Countable
{
/**
* The mailbox to work with.
}
/**
- * The mailbox this object works with.
- *
- * @return string A mailbox name.
- */
- public function getMailboxName()
- {
- return $this->_mailbox;
- }
-
- /**
* Build the array of message information.
*
* @param array $msgnum An array of message sequence numbers.
$this->_searchmbox &&
($type == 'unseen') &&
$GLOBALS['injector']->getInstance('IMP_Search')->isVINBOXFolder($this->_mailbox)) {
- return $this->getMessageCount();
+ return count($this);
}
return $count ? 0 : array();
}
/**
- * Returns the current message count of the mailbox.
- *
- * @return integer The mailbox message count.
- */
- public function getMessageCount()
- {
- $this->_buildMailbox();
- return count($this->_sorted);
- }
-
- /**
* Checks to see if the current index is valid.
* This function is only useful if an index was passed to the constructor.
*
return time() . mt_rand();
}
+ /* Countable methods. */
+
+ /**
+ * Returns the current message count of the mailbox.
+ *
+ * @return integer The mailbox message count.
+ */
+ public function count()
+ {
+ $this->_buildMailbox();
+ return count($this->_sorted);
+ }
+
}
/* Get the starting index for the current message and the message count. */
$msgindex = $imp_mailbox->getMessageIndex();
-$msgcount = $imp_mailbox->getMessageCount();
+$msgcount = count($imp_mailbox);
/* Generate the mailbox link. */
$mailbox_link = IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->add('s', $msgindex);
* message array, so we will return to mailbox.php if that is the
* case. */
if (!$imp_mailbox->isValidIndex()) {
- _returnToMailbox($imp_mailbox->getMessageCount());
+ _returnToMailbox(count($imp_mailbox));
require IMP_BASE . '/mailbox.php';
exit;
}
$t_template->set('start', htmlspecialchars($msgindex));
$t_template->set('uid', htmlspecialchars($uid));
$t_template->set('label', sprintf(_("%s: %s"), $header_label, $shortsub));
-$t_template->set('msg_count', sprintf(_("(%d of %d)"), $msgindex, $imp_mailbox->getMessageCount()));
+$t_template->set('msg_count', sprintf(_("(%d of %d)"), $msgindex, count($imp_mailbox)));
$t_template->set('status', $status);
$t_template->set('message_token', $message_token);
$imp_search = $injector->getInstance('IMP_Search');
/* Obtain some information describing the mailbox state. */
-$total_num = $imp_mailbox->getMessageCount();
+$total_num = count($imp_mailbox);
$unseen_num = ($imp_search->isVINBOXFolder($mailbox))
- ? $imp_mailbox->getMessageCount()
+ ? $total_num
: $imp_mailbox->unseenMessages(Horde_Imap_Client::SORT_RESULTS_COUNT);
$query = new Horde_Imap_Client_Search_Query();