* first unsubscribe before we delete
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 10 Nov 2003 17:46:37 +0000 (17:46 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 10 Nov 2003 17:46:37 +0000 (17:46 +0000)
* fail silently on unsubscribe

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

functions/imap_mailbox.php

index 191c6b944166b1b9650f56f77005e09e49d4c80a..d256c549ae65112a2951a5a6999cf0dbb700d4e4 100755 (executable)
@@ -328,7 +328,7 @@ function sqimap_subscribe ($imap_stream, $mailbox) {
 function sqimap_unsubscribe ($imap_stream, $mailbox) {
     $read_ary = sqimap_run_command($imap_stream, 'UNSUBSCRIBE ' .
                                    sqimap_encode_mailbox_name($mailbox),
-                                   true, $response, $message);
+                                   false, $response, $message);
 }
 
 /**
@@ -336,12 +336,17 @@ function sqimap_unsubscribe ($imap_stream, $mailbox) {
  */
 function sqimap_mailbox_delete ($imap_stream, $mailbox) {
     global $data_dir, $username;
+    sqimap_unsubscribe ($imap_stream, $mailbox);
     $read_ary = sqimap_run_command($imap_stream, 'DELETE ' .
                                    sqimap_encode_mailbox_name($mailbox),
                                    true, $response, $message);
-    sqimap_unsubscribe ($imap_stream, $mailbox);
-    do_hook_function('rename_or_delete_folder', $args = array($mailbox, 'delete', ''));
-    removePref($data_dir, $username, "thread_$mailbox");
+    if ($response !== 'OK') {
+        // subscribe again
+        sqimap_subscribe ($imap_stream, $mailbox);
+    } else {
+        do_hook_function('rename_or_delete_folder', $args = array($mailbox, 'delete', ''));
+        removePref($data_dir, $username, "thread_$mailbox");
+    }
 }
 
 /**