Happy New Year
[squirrelmail.git] / plugins / sent_subfolders / functions.php
index 2c75d4a875a49d6d67ef596e7e6ff309caafa80a..c0811bddaad79cb69852b79d3755e076dc40d92c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This is a standard SquirrelMail 1.2 API for plugins.
  *
- * @copyright 1999-2010 The SquirrelMail Project Team
+ * @copyright 1999-2018 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -50,10 +50,10 @@ function sent_subfolders_check_handleAsSent_do($mailbox) {
 function sent_subfolders_optpage_loadhook_folders_do() {
 
     global $data_dir, $username, $optpage_data, $imapServerAddress,
-           $imapPort, $show_contain_subfolders_option, $sent_folder;
+           $imapPort, $imap_stream_options, $show_contain_subfolders_option, $sent_folder;
 
     /* Get some imap data we need later. */
-    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
 
@@ -131,6 +131,10 @@ function save_option_sent_subfolders_setting($option) {
     } else {
         setPref($data_dir, $username, 'use_sent_subfolders', SMPREF_ON);
         setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
+        $check_sent_subfolders_base = getPref($data_dir, $username, 'sent_subfolders_base', '');
+        if ($check_sent_subfolders_base === '') {
+            setPref($data_dir, $username, 'sent_subfolders_base', $sent_subfolders_base);
+        }
     }
 
     /* Now just save the option as normal. */
@@ -157,7 +161,7 @@ function save_option_sent_subfolders_base($option) {
 function sent_subfolders_update_sentfolder_do() {
     global $sent_folder, $username,
            $data_dir, $imapServerAddress, $imapPort,
-           $move_to_sent;
+           $imap_stream_options, $move_to_sent;
 
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
@@ -214,7 +218,7 @@ function sent_subfolders_update_sentfolder_do() {
             /* Auto-create folders, if they do not yet exist. */
             if ($sent_subfolder != 'none') {
                 /* Create the imap connection. */
-                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10);
+                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10, $imap_stream_options);
 
                 $boxes = false;
                 /**