IMP_Compose::destroy PHP Method

destroy() public method

Destroys an IMP_Compose instance.
public destroy ( string $action )
$action string The action performed to cause the end of this instance. Either 'cancel', 'discard', 'save_draft', or 'send'.
    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';
    }