Skip to content

Commit

Permalink
Add IMP_Api::addFlags()
Browse files Browse the repository at this point in the history
Allow for adding/ensuring a set of custom msgflags are added to prefs.
  • Loading branch information
mrubinsk committed Aug 7, 2014
1 parent fd725c2 commit dabc03a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions imp/lib/Api.php
Expand Up @@ -221,6 +221,24 @@ public function flagMessages($mailbox, $indices, $flags, $set)
), new IMP_Indices($mailbox, $indices));
}

/**
* Ensures a list of user-defined IMAP flag(s) for the current user exist.
* Silently ignores any flags that are already defined.
*
* @param array $flags An array of user-defined flag names.
* @since 6.3.0
*/
public function addFlags(array $flags)
{
$imp_flags = $GLOBALS['injector']->getInstance('IMP_Flags');
foreach ($flags as $flag) {
try {
$imp_flags->addFlag($flag);
} catch (IMP_Exception $e) {
}
}
}

/**
* Perform a search query on the remote IMAP server.
*
Expand Down

0 comments on commit dabc03a

Please sign in to comment.