update mailbox cache if new folders are created (first time login when
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 5 Feb 2006 11:01:35 +0000 (11:01 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 5 Feb 2006 11:01:35 +0000 (11:01 +0000)
special folders are created)

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

src/left_main.php

index 1cab8cd057a3e0f6f457a76931418b4fbd2af8ee..79e41ede31a7b4ba724527171d4dc99809b08ceb 100644 (file)
@@ -646,11 +646,13 @@ 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);
+    $folders_created = false;
     foreach( $autocreate as $folder ) {
         if (($folder != '') && ($folder != 'none')) {
             // use $mailboxes array for checking if mailbox exists
             if ( !sqimap_mailbox_exists($imapConnection, $folder, $mailboxes)) {
                 sqimap_mailbox_create($imapConnection, $folder, '');
+                $folders_created = true;
             } else {
                 // check for subscription is useless and expensive, just
                 // surpress the NO response. Unless we're on Mecury, which
@@ -659,6 +661,7 @@ if ($auto_create_special && !isset($auto_create_done)) {
                 if ( strtolower($imap_server_type) != 'mercury32' ||
                     !sqimap_mailbox_is_subscribed($imapConnection, $folder) ) {
                     sqimap_subscribe($imapConnection, $folder, false);
+                    $folders_created = true;
                 }
             }
         }
@@ -667,6 +670,9 @@ if ($auto_create_special && !isset($auto_create_done)) {
     /* Let the world know that autocreation is complete! Hurrah! */
     $auto_create_done = TRUE;
     sqsession_register($auto_create_done, 'auto_create_done');
+    // reload mailbox list
+    if ($folders_created)
+        $mailboxes=sqimap_get_mailboxes($imapConnection,true,$show_only_subscribed_folders);
 }
 
 if ($advanced_tree) {