const VFS_DRAFTS_PATH = '.horde/imp/drafts';
/**
+ * Mark as changed for purposes of storing in the session.
+ * Either empty, 'changed', or 'deleted'.
+ *
+ * @var string
+ */
+ public $changed = '';
+
+ /**
* The cached attachment data.
*
* @var array
protected $_cacheid;
/**
- * Mark as modified for purposes of storing in the session.
- *
- * @var boolean
- */
- protected $_modified = false;
-
- /**
* Constructor.
*
* @param string $cacheid The cache ID string.
public function __construct($cacheid)
{
$this->_cacheid = $cacheid;
- $this->__wakeup();
- }
-
- /**
- * Code to run on unserialize().
- */
- public function __wakeup()
- {
- register_shutdown_function(array($this, 'shutdown'));
- }
-
- /**
- * Store a serialized version of ourself in the current session on
- * shutdown.
- */
- public function shutdown()
- {
- if ($this->_modified) {
- $this->_modified = false;
- $obs = $GLOBALS['injector']->getInstance('Horde_SessionObjects');
- $obs->overwrite($this->_cacheid, $this, false);
- }
}
/**
$GLOBALS['injector']->getInstance('IMP_Message')->delete($uids, array('nuke' => true));
$this->deleteAllAttachments();
- $obs = $GLOBALS['injector']->getInstance('Horde_SessionObjects');
- $obs->prune($this->_cacheid);
+
+ $this->changed = 'deleted';
}
/**
}
$this->_metadata['draft_uid'] = new IMP_Indices($drafts_mbox, reset($ids));
- $this->_modified = true;
+ $this->changed = 'changed';
return sprintf(_("The draft has been saved to the \"%s\" folder."), IMP::displayFolder($drafts_mbox));
} catch (Horde_Imap_Client_Exception $e) {
return _("The draft was not successfully saved.");
}
$this->_metadata['draft_uid_resume'] = $indices;
- $this->_modified = true;
+ $this->changed = 'changed';
return array(
'header' => $header,
if (!$this->getMetadata('reply_type')) {
$this->_metadata['mailbox'] = $contents->getMailbox();
$this->_metadata['uid'] = $contents->getUid();
- $this->_modified = true;
+ $this->changed = 'changed';
/* Set the message-id related headers. */
if (($msg_id = $h->getValue('message-id'))) {
if (!isset($this->_metadata['reply_type']) ||
($reply_type != $this->_metadata['reply_type'])) {
$this->_metadata['reply_type'] = $reply_type;
- $this->_modified = true;
+ $this->changed = 'changed';
}
return array_merge(array(
$this->_metadata['in_reply_to'] = trim($h->getValue('message-id'));
$this->_metadata['reply_type'] = 'forward';
$this->_metadata['forward_type'] = $type;
- $this->_modified = true;
+ $this->changed = 'changed';
$header['subject'] = $h->getValue('subject');
if (!empty($header['subject'])) {
$this->_metadata['mailbox'] = $contents->getMailbox();
$this->_metadata['reply_type'] = 'redirect';
$this->_metadata['uid'] = $contents->getUid();
- $this->_modified = true;
+ $this->changed = 'changed';
}
/**
);
}
- $this->_modified = true;
+ $this->changed = 'changed';
/* Add the size information to the counter. */
$this->_size += $part->getBytes();
unset($this->_cache[$val]);
- $this->_modified = true;
+ $this->changed = 'changed';
}
return $names;
{
if (isset($this->_cache[$number])) {
$this->_cache[$number]['part']->setDescription($params['description']);
- $this->_modified = true;
+ $this->changed = 'changed';
}
}