fixed bug in mailbox_exists for shane
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 4 May 2000 21:12:14 +0000 (21:12 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 4 May 2000 21:12:14 +0000 (21:12 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@490 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php

index 39e17d968ffe50a799dfebff12ea2c26e0212573..169633c818262feca6ab2a3ed910a051537a1187 100755 (executable)
     **  Checks whether or not the specified mailbox exists 
     ******************************************************************************/
    function sqimap_mailbox_exists ($imap_stream, $mailbox) {
-      $boxes = sqimap_mailbox_list ($imap_stream);
-      $found = false;
-      for ($i = 0; $i < count ($boxes); $i++) {
-         if ($boxes[$i]["unformatted"] == $mailbox)
-            $found = true;
+      fputs ($imap_stream, "a001 LIST \"\" \"$mailbox\"\r\n");
+      $mbx = sqimap_read_data($imap_stream, "a001", true, $response, $message);
+      if (ereg ("$mailbox", $mbx[0])) {
+         return true;
+      } else {
+         return false;
       }
-      return $found;
    }