public function destroy($action)
{
switch ($action) {
case 'discard':
case 'send':
/* Delete the draft. */
$i = new IMP_Indices($this->getMetadata('draft_uid'));
$i->delete(array('nuke' => true));
break;
case 'save_draft':
/* Don't delete any drafts. */
$this->changed = 'deleted';
return;
case 'cancel':
if ($this->getMetadata('draft_auto')) {
$this->destroy('discard');
return;
}
// Fall-through
// Fall-through
default:
// No-op
break;
}
$this->deleteAllAttachments();
$this->changed = 'deleted';
}