From: Michael M Slusarz Date: Tue, 22 Dec 2009 20:48:44 +0000 (-0700) Subject: Ticket #5822: Provide API to get list of user-defined flags in IMP X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=804e0e0b1516d94d909424699b6d2ce6ef7bc377;p=horde.git Ticket #5822: Provide API to get list of user-defined flags in IMP --- diff --git a/imp/lib/Api.php b/imp/lib/Api.php index d5ab7b289..6ee4bfbbe 100644 --- a/imp/lib/Api.php +++ b/imp/lib/Api.php @@ -213,4 +213,32 @@ class IMP_Api extends Horde_Registry_Api return $GLOBALS['imp_imap']->ob(); } + /** + * Return the list of user-settable IMAP flags. + * + * @param string $mailbox If set, returns the list of flags filtered by + * what the mailbox allows. + * + * @return array See IMP_Imap_Flags::getList() for the output. The + * 'f' key will be set. + */ + public function flagList($mailbox = null) + { + if ($_SESSION['imp']['protocol'] == 'pop') { + return array(); + } + + $opts = array( + 'fgcolor' => true, + 'imap' => true, + ); + + if (!is_null($mailbox)) { + $opts['mailbox'] = $mailbox; + } + + $imp_flags = IMP_Imap_Flags::singleton(); + return $imp_flags->getList($opts); + } + }