submitted a patch from Andreas Dahl to make folder deleting work with
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 10 Aug 2000 16:35:06 +0000 (16:35 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 10 Aug 2000 16:35:06 +0000 (16:35 +0000)
courier IMAP server.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@699 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/folders.php
src/folders_delete.php

index 66d62164c8c8fd0abb0732c26ff7bf410fa3c865..bdb1bb55e830415ac5ae808bdf19e25979fa8549 100644 (file)
    echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>";
 
    $count_special_folders = 0;
-       $num_max = 1;
-       if ($move_to_trash)
-               $num_max++;
-       if ($move_to_sent)
-               $num_max++;
+       $num_max = 1;
+       if (strtolower($imap_server_type) == "courier" || $move_to_trash)
+               $num_max++;
+       if ($move_to_sent)
+               $num_max++;
 
-   for ($p = 0; $p < count($boxes) && $count_special_folders < $num_max; $p++) {
+   for ($p = 0; $p < count($boxes) && $count_special_folders < $num_max; $p++) {                                                                                 
       if (strtolower($boxes[$p]["unformatted"]) == "inbox")
          $count_special_folders++;
-      else if ($boxes[$p]["unformatted"] == $trash_folder && $trash_folder)
+      else if (strtolower($imap_server_type) == "courier" &&
+               strtolower($boxes[$p]["unformatted"]) == "inbox.trash")                                                               
          $count_special_folders++;
-      else if ($boxes[$p]["unformatted"] == $sent_folder && $sent_folder)
+      else if ($boxes[$p]["unformatted"] == $trash_folder && $trash_folder)                                                                  
          $count_special_folders++;
    }   
 
       echo "<TT><SELECT NAME=mailbox>\n";
       for ($i = 0; $i < count($boxes); $i++) {
          $use_folder = true;
-                       if ((strtolower($boxes[$i]["unformatted"]) != "inbox") && 
-                           ($boxes[$i]["unformatted"] != $trash_folder) && 
-                           ($boxes[$i]["unformatted"] != $sent_folder)) 
-                       {       
+        if ((strtolower($boxes[$i]["unformatted"]) != "inbox") &&                                                                             
+            ($boxes[$i]["unformatted"] != $trash_folder) && 
+            ($boxes[$i]["unformatted"] != $sent_folder) &&
+            (strtolower($imap_server_type) != "courier" ||
+             strtolower($boxes[$i]["unformatted"]) != "inbox.trash"))                                                              
+          {
             $box = $boxes[$i]["unformatted-dm"];
             $box2 = replace_spaces($boxes[$i]["formatted"]);
             echo "         <OPTION VALUE=\"$box\">$box2\n";
    echo _("as a subfolder of");
    echo "<BR>";
    echo "<TT><SELECT NAME=subfolder>\n";
-   if ($default_sub_of_inbox == false)
-      echo "<OPTION SELECTED>[ None ]\n";
-   else
-      echo "<OPTION>[ None ]\n";
+   if (strtolower($imap_server_type) != "courier"){
+     if ($default_sub_of_inbox == false)
+       echo "<OPTION SELECTED>[ None ]\n";
+     else
+       echo "<OPTION>[ None ]\n";
+   }
 
    for ($i = 0; $i < count($boxes); $i++) {
       if (count($boxes[$i]["flags"]) > 0) {
             } else {
                $box = $boxes[$i]["unformatted"];
                $box2 = replace_spaces($boxes[$i]["formatted"]);
-               echo "<OPTION VALUE=\"$box\">$box2\n";
+               if (strtolower($imap_server_type) != "courier" ||
+                  strtolower($box) != "inbox.trash")
+                echo "<OPTION VALUE=\"$box\">$box2\n";
             }
          }
       } else {
          } else {
             $box = $boxes[$i]["unformatted"];
             $box2 = replace_spaces($boxes[$i]["formatted"]);
-            echo "<OPTION VALUE=\"$box\">$box2\n";
+           if (strtolower($imap_server_type) != "courier" ||
+               strtolower($box) != "inbox.trash")
+             echo "<OPTION VALUE=\"$box\">$box2\n";
          }
       }
    }
index e6d945effd541aecad07ee57060a692412a445ad..1e76b406134604247f208093c17fcec36ec5c060 100644 (file)
    else
       $mailbox_no_dm = $mailbox;
 
-   /** lets see if we CAN move folders to the trash.. otherwise, just delete them **/
-   for ($i = 0; $i < count($boxes); $i++) {
-      if ($boxes[$i]["unformatted"] == $trash_folder) {
-         $can_move_to_trash = true;
-         for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
-            if (strtolower($boxes[$i]["flags"][$j]) == "noinferiors")
+   /** lets see if we CAN move folders to the trash.. otherwise, 
+    ** just delete them **/
+   if (strtolower($imap_server_type) == "courier") {
+      // Courier IMAP doesn't like subfolders of Trash
+      $can_move_to_trash = false;
+   } else {
+      for ($i = 0; $i < count($boxes); $i++) {
+         if ($boxes[$i]["unformatted"] == $trash_folder) {
+            $can_move_to_trash = true;
+            for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
+               if (strtolower($boxes[$i]["flags"][$j]) == "noinferiors")                                                               
                $can_move_to_trash = false;
+            }
          }
       }
    }
 
-
    /** First create the top node in the tree **/
    for ($i = 0;$i < count($boxes);$i++) {
       if (($boxes[$i]["unformatted-dm"] == $mailbox) && (strlen($boxes[$i]["unformatted-dm"]) == strlen($mailbox))) {