From 52c72853a67d6000d91b561928ba7f786bbe52f2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 12 Nov 2008 22:58:10 -0700 Subject: [PATCH] Deal with the funky message/rfc822 naming. --- framework/Mime/lib/Horde/Mime.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/framework/Mime/lib/Horde/Mime.php b/framework/Mime/lib/Horde/Mime.php index e0e3e75e3..77618373f 100644 --- a/framework/Mime/lib/Horde/Mime.php +++ b/framework/Mime/lib/Horde/Mime.php @@ -447,10 +447,14 @@ class Horde_Mime * @param string $id The MIME ID string. * @param string $action One of the following: *
-     * 'down' - ID of child.
+     * 'down' - ID of child. Note: down will first traverse to "$id.0" if
+     *          given an ID *NOT* of the form "$id.0". If given an ID of the
+     *          form "$id.0", down will traverse to "$id.1".
      * 'next' - ID of next sibling.
      * 'prev' - ID of previous sibling.
-     * 'up' - ID of parent.
+     * 'up' - ID of parent. Note: up will first traverse to "$id.0" if
+     *        given an ID *NOT* of the form "$id.0". If given an ID of the
+     *        form "$id.0", down will traverse to "$id".
      * 
* @param integer $count How many levels to traverse. * @@ -468,7 +472,9 @@ class Horde_Mime switch ($action) { case 'down': - $id .= '.1'; + $id = (substr($id, $pos + 1) == '0') + ? substr_replace($id, '1', $pos + 1) + : $id . '.0'; break; case 'next': @@ -479,9 +485,12 @@ class Horde_Mime break; case 'up': - $id = ($pos === false) - ? 0 - : substr($id, 0, $pos); + if ($pos === false) { + $id = 0; + } else { + $id = (substr($id, $pos + 1) == '0') + ? substr($id, 0, $pos); + : substr_replace($id, '0', $pos + 1); break; } -- 2.11.0