Quellcode durchsuchen

Removed kind of insane check. The check mailbox is subscribed call retrieved
the whole subscription list and looked up if the requested mailbox was part
of it. It's better to subscribe and surpress the NO response if already
subscribed.

stekkel vor 21 Jahren
Ursprung
Commit
85bee15f35
2 geänderte Dateien mit 9 neuen und 5 gelöschten Zeilen
  1. 3 2
      functions/imap_mailbox.php
  2. 6 3
      src/left_main.php

+ 3 - 2
functions/imap_mailbox.php

@@ -367,10 +367,10 @@ function sqimap_mailbox_create ($imap_stream, $mailbox, $type) {
 /**
  * Subscribes to an existing folder.
  */
-function sqimap_subscribe ($imap_stream, $mailbox) {
+function sqimap_subscribe ($imap_stream, $mailbox,$debug=true) {
     $read_ary = sqimap_run_command($imap_stream, 'SUBSCRIBE ' .
                                    sqimap_encode_mailbox_name($mailbox),
-                                   true, $response, $message);
+                                   $debug, $response, $message);
 }
 
 /**
@@ -609,6 +609,7 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk
  * See comment on sqimap_mailbox_parse() for info about the returned array.
  */
 function sqimap_mailbox_list($imap_stream) {
+    echo "TEST<BR>";
     global $default_folder_prefix;
 
     if (!isset($boxesnew)) {

+ 6 - 3
src/left_main.php

@@ -924,7 +924,7 @@ ECHO;
 }
 
 displayHtmlHeader( 'SquirrelMail', $xtra );
-
+sqgetGlobalVar('auto_create_done',$auto_create_done,SQ_SESSION);
 /* If requested and not yet complete, attempt to autocreate folders. */
 if ($auto_create_special && !isset($auto_create_done)) {
     $autocreate = array($sent_folder, $trash_folder, $draft_folder);
@@ -932,8 +932,11 @@ if ($auto_create_special && !isset($auto_create_done)) {
         if (($folder != '') && ($folder != 'none')) {
             if ( !sqimap_mailbox_exists($imapConnection, $folder)) {
                 sqimap_mailbox_create($imapConnection, $folder, '');
-            } else if (!sqimap_mailbox_is_subscribed($imapConnection, $folder)) {
-                sqimap_subscribe($imapConnection, $folder);
+            } else {
+                //if (!sqimap_mailbox_is_subscribed($imapConnection, $folder)) {
+                // check for subscription is useless and expensive  just 
+                // surpress the NO response
+                sqimap_subscribe($imapConnection, $folder, false);
             }
         }
     }