From 2710203652da94eece28e0d0f02a1bec826bdcfe Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 10 Nov 2009 09:46:54 -0700 Subject: [PATCH] Re-add a metadata store to Horde_Mime_Part --- framework/Mime/lib/Horde/Mime/Part.php | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/framework/Mime/lib/Horde/Mime/Part.php b/framework/Mime/lib/Horde/Mime/Part.php index 682a33d81..4fe99a140 100644 --- a/framework/Mime/lib/Horde/Mime/Part.php +++ b/framework/Mime/lib/Horde/Mime/Part.php @@ -159,6 +159,13 @@ class Horde_Mime_Part protected $_temp = array(); /** + * Metadata. + * + * @var array + */ + protected $_metadata = array(); + + /** * Unique Horde_Mime_Part boundary string. * * @var string @@ -1357,6 +1364,35 @@ class Horde_Mime_Part } /** + * Set a piece of metadata on this object. + * + * @param string $key The metadata key. + * @param mixed $data The metadata. If null, clears the key. + */ + public function setMetadata($key, $data = null) + { + if (is_null($data)) { + unset($this->_metadata[$key]); + } else { + $this->_metadata[$key] = $data; + } + } + + /** + * Retrieves metadata from this object. + * + * @param string $key The metadata key. + * + * @return mixed The metadata, or null if it doesn't exist. + */ + public function getMetadata($key) + { + return isset($this->_metadata[$key]) + ? $this->_metadata[$key] + : null; + } + + /** * Sends this message. * * @param string $email The address list to send to. -- 2.11.0