Add comment to parsePriority function. I had to duplicate this function in
[squirrelmail.git] / functions / imap_messages.php
index c17f10825d9bff880ab2e96d50fc29636cb13a15..7f4614872f8ba91b1f77810e6df169ec4dae7fca 100755 (executable)
@@ -204,7 +204,7 @@ function get_squirrel_sort($imap_stream, $sSortField, $reverse = false, $aUid =
                  $sPersonal = (isset($addr[SQM_ADDR_PERSONAL]) && $addr[SQM_ADDR_PERSONAL]) ?
                    $addr[SQM_ADDR_PERSONAL] : "";
                  $sEmail = ($addr[SQM_ADDR_HOST]) ?
-                      $addr[SQM_ADDR_HOST] . "@".$addr[SQM_ADDR_HOST] :
+                      $addr[SQM_ADDR_MAILBOX] . "@".$addr[SQM_ADDR_HOST] :
                       $addr[SQM_ADDR_HOST];
                  $v[$f] = ($sPersonal) ? decodeHeader($sPersonal):$sEmail;'),$sSortField);
             $walk = true;
@@ -242,7 +242,7 @@ function get_squirrel_sort($imap_stream, $sSortField, $reverse = false, $aUid =
       case 'RFC822.SIZE':
         if(!$walk) {
             // redefine $sSortField to maintain the same namespace between
-            // server-side sorting and squirrelmail sorting
+            // server-side sorting and SquirrelMail sorting
             $sSortField = 'SIZE';
         }
         foreach ($msgs as $item) {
@@ -479,6 +479,17 @@ function elapsedTime($start) {
 }
 
 
+/**
+ * Normalise the different Priority headers into a uniform value,
+ * namely that of the X-Priority header (1, 3, 5). Supports:
+ * Prioirty, X-Priority, Importance.
+ * X-MS-Mail-Priority is not parsed because it always coincides
+ * with one of the other headers.
+ *
+ * DUPLICATE CODE ALERT:
+ * NOTE: this is actually a duplicate from the function in
+ * class/mime/Rfc822Header.php.
+ */
 function parsePriority($value) {
     $value = strtolower(array_shift(split('/\w/',trim($value))));
     if ( is_numeric($value) ) {