Skip to content

Commit

Permalink
Honor keeplog option
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Apr 15, 2014
1 parent 7d51562 commit eeb5eff
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions imp/lib/Message.php
Expand Up @@ -160,9 +160,9 @@ public function delete(IMP_Indices $indices, array $opts = array())
}

$ajax_queue = $injector->getInstance('IMP_Ajax_Queue');
$maillog = $injector->getInstance('IMP_Maillog');

$maillog_update = empty($opts['keeplog']);
$maillog = empty($opts['keeplog'])
? $injector->getInstance('IMP_Maillog')
: null;
$return_value = 0;

/* Check for Trash mailbox. */
Expand Down Expand Up @@ -250,13 +250,15 @@ public function delete(IMP_Indices $indices, array $opts = array())
* an error occurs. But 1) the user has already indicated they
* don't care about this data and 2) message IDs (used by some
* maillog backends) won't be available after deletion. */
$delete_ids = array();
foreach ($ids_ob as $val) {
$delete_ids[] = new IMP_Maillog_Message(
new IMP_Indices($ob->mbox, $val)
);
if ($maillog) {
$delete_ids = array();
foreach ($ids_ob as $val) {
$delete_ids[] = new IMP_Maillog_Message(
new IMP_Indices($ob->mbox, $val)
);
}
$maillog->deleteLog($delete_ids);
}
$maillog->deleteLog($delete_ids);

/* Delete the messages. */
$expunge_now = false;
Expand Down

0 comments on commit eeb5eff

Please sign in to comment.