/**
+ * Dynamically alter a mailbox display label.
+ *
+ * @param string $mbox The mailbox name.
+ * @param string $label The current label.
+ *
+ * @return string The display label for $mbox.
+ */
+// function mbox_label($mbox, $label)
+// {
+// // Example #1: Show 'foo' as 'bar'
+// return ($mbox == 'foo')
+// ? 'bar'
+// : $label;
+// }
+
+ /**
* Mark a mailbox as read-only.
*
* @param string $mailbox The mailbox name.
v5.0-git
--------
+[mms] Add hook to dynamically change mailbox label (Request #6734).
[mms] Improved address expansion in MIMP.
[mms] Load folders on-demand in sidebar (DIMP).
[mms] Add priority setting to DIMP.
/**
* Returns the plain text label that is displayed for the current mailbox,
- * replacing virtual search mailboxes with an appropriate description and
+ * replacing virtual search mailboxes with an appropriate description,
* removing namespace and mailbox prefix information from what is shown to
- * the user.
+ * the user, and passing the label through a user-defined hook.
*
* @param string $mbox The mailbox to use for the label.
*
*/
static public function getLabel($mbox)
{
- return IMP_Search::isSearchMbox($mbox)
+ $label = IMP_Search::isSearchMbox($mbox)
? $GLOBALS['imp_search']->getLabel($mbox)
: self::displayFolder($mbox);
+
+ try {
+ return Horde::callHook('mbox_label', array($mbox, $label), 'imp');
+ } catch (Horde_Exception_HookNotSet $e) {
+ return $label;
+ }
}
/**