Fix capability retrieval for "double" cases in server capability response, for instan...
authoravel <avel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 26 May 2006 12:53:18 +0000 (12:53 +0000)
committeravel <avel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 26 May 2006 12:53:18 +0000 (12:53 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11162 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/imap_general.php

index f64500b..f713329 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,8 @@ Version 1.5.2 - CVS
   - Take X-Forwarded-Host HTTP header in consideration when constructing
     base_uri for redirects; reduces problems with transparent proxies
     (#1488590).
+  - Fixed server capability retrieval for "double" cases in capability
+    response, like "FOO FOO=bar".
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
index 01d51f3..a482049 100755 (executable)
@@ -954,9 +954,18 @@ function sqimap_capability($imap_stream, $capability='', $bUseCache=true) {
         for ($i=2; $i < count($c); $i++) {
             $cap_list = explode('=', $c[$i]);
             if (isset($cap_list[1])) {
+                if(isset($sqimap_capabilities[trim($cap_list[0])]) &&
+                 !is_array($sqimap_capabilities[trim($cap_list[0])])) {
+                    // Remove array key that was added in 'else' block below
+                    // This is to accomodate for capabilities like:
+                    // SORT SORT=MODSEQ
+                    unset($sqimap_capabilities[trim($cap_list[0])]);
+                }
                 $sqimap_capabilities[trim($cap_list[0])][] = $cap_list[1];
             } else {
-                $sqimap_capabilities[trim($cap_list[0])] = TRUE;
+                if(!isset($sqimap_capabilities[trim($cap_list[0])])) {
+                    $sqimap_capabilities[trim($cap_list[0])] = TRUE;
+                }
             }
         }
     }