* Fix for the UW/mh problem with deleting messages.
[squirrelmail.git] / functions / imap_mailbox.php
index fe1baee55e4ae43cdcd735b0b571c1672ed9694f..371648fdd9ddb9e8e121229f6301d568c5992cce 100755 (executable)
@@ -15,7 +15,6 @@
     **  Expunges a mailbox 
     ******************************************************************************/
    function sqimap_mailbox_expunge ($imap_stream, $mailbox,$handle_errors = true) {
-      sqimap_mailbox_select ($imap_stream, $mailbox);
       fputs ($imap_stream, "a001 EXPUNGE\r\n");
       $read = sqimap_read_data($imap_stream, "a001", $handle_errors, $response, $message);
    }
          if (substr($mailbox, -1) == $dm)
             $mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
          $boxes[$g]['unformatted'] = $mailbox;
-         //$boxes[$g]['unformatted-disp'] = ereg_replace('^' . $folder_prefix, '', $mailbox);
-         if (substr($mailbox,0,strlen($folder_prefix))==$folder_prefix) { 
-            $boxes[$g]['unformatted-disp'] = substr($mailbox, strlen($folder_prefix));
-         } else if (strtolower($mailbox) == "inbox") {
-            $boxes[$g]['unformatted-disp'] = $mailbox;
-         }
+         if (substr($mailbox,0,strlen($folder_prefix))==$folder_prefix)
+            $mailbox = substr($mailbox, strlen($folder_prefix));
+         $boxes[$g]['unformatted-disp'] = $mailbox;
          $boxes[$g]['id'] = $g;
 
          if (isset($line[$g]))
          $flags = trim(strtolower(str_replace('\\', '',$regs[1])));
          if ($flags) {
             $boxes[$g]['flags'] = explode(' ', $flags);
-         }
-        else
-            $boxes[$g]['flags'] = array();
+         } else
+            $boxes[$g]['flags'] = array();
       }
 
       return $boxes;
 
       /** LSUB array **/
       $inbox_subscribed = false;
-      fputs ($imap_stream, "a001 LSUB \"\" \"*\"\r\n");
+      fputs ($imap_stream, "a001 LSUB \"\" \"*%\"\r\n");
       $lsub_ary = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
 
       /** OS: we don't want to parse last element of array, 'cause it is OK command, so we unset it **/
             if ($flags) {
                $boxes[$g]['flags'] = explode(" ", $flags);
             }
-           else
-           {
-              $boxes[$g]['flags'] = array();
-           }
+            else
+            {
+               $boxes[$g]['flags'] = array();
+            }
          }
          $g++;
       }