Skip to content

Commit

Permalink
Add option to reload the folder tree when fetching via API.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Nov 15, 2016
1 parent 9b461bb commit 2bf45c7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions imp/lib/Api.php
Expand Up @@ -83,6 +83,10 @@ public function batchCompose($args = array(), $extra = array())
/**
* Returns the list of mailboxes.
*
* @param array $opts Additional options:
* - reload: (boolean) If true, force reloading the folder tree from
* the IMAP server. DEFAULT: false
* @since 6.2.17
* @return array The list of IMAP mailboxes. A list of arrays with the
* following keys:
* - d: (string) The namespace delimiter.
Expand All @@ -91,13 +95,16 @@ public function batchCompose($args = array(), $extra = array())
* - ob: (Horde_Imap_Client_Mailbox) A mailbox object.
* - subscribed: (boolean) True if mailbox is subscribed (@since 6.2.0).
*/
public function mailboxList()
public function mailboxList($opts = array())
{
global $injector;

$iterator = new IMP_Ftree_IteratorFilter(
$injector->getInstance('IMP_Ftree')
);
$ftree = $injector->getInstance('IMP_Ftree');
if (!empty($opts['reload'])) {
$ftree->init();
}

$iterator = new IMP_Ftree_IteratorFilter($ftree);
$iterator->add(array(
$iterator::CONTAINERS,
$iterator::REMOTE,
Expand Down

0 comments on commit 2bf45c7

Please sign in to comment.