Add more flexibility for plugins
[squirrelmail.git] / config / conf.pl
index 408e57ec76c519e5c383a473a5f09383717df6e8..61f2bf98325cad7fb5da9564c4ade0da6fc17df8 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 # conf.pl
 #
-# Copyright (c) 1999-2010 The SquirrelMail Project Team
+# Copyright (c) 1999-2012 The SquirrelMail Project Team
 # Licensed under the GNU GPL. For full terms see COPYING.
 #
 # A simple configure script to configure SquirrelMail
@@ -545,7 +545,8 @@ $list_supported_imap_servers =
     "    hmailserver = hMailServer\n" .
     "    macosx      = Mac OS X Mailserver\n" .
     "    mercury32   = Mercury/32\n" .
-    "    uw          = University of Washington's IMAP server\n";
+    "    uw          = University of Washington's IMAP server\n" .
+    "    gmail       = IMAP access to Google mail (Gmail) accounts\n";
 
 #####################################################################################
 if ( $config_use_color == 1 ) {
@@ -1524,7 +1525,7 @@ sub command112a {
 
 
 # SMTP authentication type
-# Possible choices: none, plain, cram-md5, digest-md5
+# Possible choices: none, login, plain, cram-md5, digest-md5
 sub command112b {
     if ($use_smtp_tls ne "0") {
         print "Auto-detection of login methods is unavailable when using TLS or STARTTLS.\n";
@@ -1565,6 +1566,7 @@ sub command112b {
                 print $sock "QUIT\r\n";
                 close $sock;
             }
+
             # Try login (SquirrelMail default)
             print "Testing login:\t\t";
             $tmp=detect_auth_support('SMTP',$host,'LOGIN');
@@ -1578,6 +1580,19 @@ sub command112b {
                   print $WHT . "ERROR DETECTING$NRM\n";
               }
 
+            # Try plain
+            print "Testing plain:\t\t";
+            $tmp=detect_auth_support('SMTP',$host,'PLAIN');
+            if (defined($tmp)) {
+                if ($tmp eq 'YES') {
+                    print $WHT . "SUPPORTED$NRM\n";
+                } else {
+                    print $WHT . "NOT SUPPORTED$NRM\n";
+                }
+              } else {
+                  print $WHT . "ERROR DETECTING$NRM\n";
+              }
+
             # Try CRAM-MD5
             print "Testing CRAM-MD5:\t";
             $tmp=detect_auth_support('SMTP',$host,'CRAM-MD5');
@@ -1608,12 +1623,12 @@ sub command112b {
     print "\nWhat authentication mechanism do you want to use for SMTP connections?\n";
     print $WHT . "none" . $NRM . " - Your SMTP server does not require authorization.\n";
     print $WHT . "login" . $NRM . " - Plaintext. If you can do better, you probably should.\n";
-    print $WHT . "plain" . $NRM . " - SASL PLAIN.  You already know it if you need this.\n";
+    print $WHT . "plain" . $NRM . " - SASL PLAIN. Plaintext. If you can do better, you probably should.\n";
     print $WHT . "cram-md5" . $NRM . " - Slightly better than plaintext.\n";
     print $WHT . "digest-md5" . $NRM . " - Privacy protection - better than cram-md5.\n";
     print $WHT . "\n*** YOUR SMTP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***\n" . $NRM;
     print "If you don't understand or are unsure, you probably want \"none\"\n\n";
-    print "none, login, cram-md5, or digest-md5 [$WHT$smtp_auth_mech$NRM]: $WHT";
+    print "none, login, plain, cram-md5, or digest-md5 [$WHT$smtp_auth_mech$NRM]: $WHT";
     $inval=<STDIN>;
     chomp($inval);
     if ($inval =~ /^none\b/i) {
@@ -2573,15 +2588,15 @@ sub command311 {
 
 sub command311b {
     print "$NRM";
-    print "\n  SquirrelMail adds username information to every outgoing
-  email in order to prevent possible sender forging when users are
-  allowed to change their email and/or full name.
+    print "\n  SquirrelMail adds username information to every outgoing email in
+  order to prevent possible sender forging by users that are allowed
+  to change their email and/or full name.
 
-  You can remove user information from this header (y) if you think that
-  it violates privacy or security.
+  You can remove user information from this header (y) if you think
+  that it violates privacy or security.
 
-  Note: If users are allowed to change their email addresses,
-  this setting will make it difficult to determine who sent what where.
+  Note: If users are allowed to change their email addresses, this
+  setting will make it difficult to determine who sent what where.
   Use at your own risk.
 
   Note: If you have defined a header encryption key in your SMTP or
@@ -4161,9 +4176,7 @@ sub command94 {
 
 sub command95 {
     print "This is the name of the field in which you want to store the\n";
-    print "username of the person the prefs are for. It default to 'user'\n";
-    print "which clashes with a reserved keyword in PostgreSQL so this\n";
-    print "will need to be changed for that database at least\n";
+    print "username of the person the prefs are for. It defaults to 'user'\n";
     print "\n";
     print "[$WHT$prefs_user_field$NRM]: $WHT";
     $new_field = <STDIN>;
@@ -4628,12 +4641,12 @@ sub commandB8 {
         print "1     " . ($sm_debug_mode & 1 ? "y" : " ")
             . "      Simple debugging (PHP E_ERROR)\n";
         print "2     " . ($sm_debug_mode & 512 ? "y" : " ")
-            . "      Moderate debugging (PHP E_ALL)\n";
+            . "      Moderate debugging (PHP E_ALL without E_STRICT)\n";
         print "3     " . ($sm_debug_mode & 524288 ? "y" : " ")
-            . "      Advanced debugging (PHP E_ALL plus log errors\n";
-        print "             intentionally suppressed)\n";
+            . "      Advanced debugging (PHP E_ALL (without E_STRICT) plus\n";
+        print "             log errors intentionally suppressed)\n";
         print "4     " . ($sm_debug_mode & 536870912 ? "y" : " ")
-            . "      Strict debugging (PHP E_STRICT)\n";
+            . "      Strict debugging (PHP E_ALL and E_STRICT)\n";
         print "\n";
     
         print "SquirrelMail debug mode (0,1,2,3,4) or d when done? : $WHT";
@@ -5091,7 +5104,7 @@ sub save_data {
                 # integer
                 print CF "    'search_tree' => $ldap_search_tree[$count]";
             }
-            if ( $ldap_listing[$count] ) {
+            if ( $ldap_starttls[$count] ) {
                 print CF ",\n";
                 # boolean
                 print CF "    'starttls' => $ldap_starttls[$count]";
@@ -5371,6 +5384,50 @@ sub set_defaults {
             $message = "\nIf you use IMAPdir depot, you must set default folder prefix to empty string.\n";
 
             $continue = 1;
+        } elsif ( $server eq "gmail" ) {
+            $imap_server_type               = "gmail";
+            $default_folder_prefix          = "";
+            $trash_folder                   = "[Gmail]/Trash";
+            $default_move_to_trash          = true;
+            $sent_folder                    = "[Gmail]/Sent Mail";
+            $draft_folder                   = "[Gmail]/Drafts";
+            $auto_create_special            = false;
+            $show_prefix_option             = false;
+            $default_sub_of_inbox           = false;
+            $show_contain_subfolders_option = false;
+            $delete_folder                  = true;
+            $force_username_lowercase       = false;
+            $optional_delimiter             = "/";
+            $disp_default_folder_prefix     = "<none>";
+            $domain                         = "gmail.com";
+            $imapServerAddress              = "imap.gmail.com";
+            $imapPort                       = 993;
+            $use_imap_tls                   = true;
+            $imap_auth_mech                 = "login";
+            $smtpServerAddress              = "smtp.gmail.com";
+            $smtpPort                       = 465;
+            $pop_before_smtp                = false;
+            $useSendmail                    = false;
+            $use_smtp_tls                   = true;
+            $smtp_auth_mech                 = "login";
+            $continue = 1;
+
+            # Gmail changes system folder names (Drafts, Sent, Trash) out
+            # from under you when the user changes language settings
+            $message = "\nNOTE!  When a user changes languages in Gmail's interface, the\n" 
+                     . "Drafts, Sent and Trash folder names are changed to localized\n"
+                     . "versions thereof.  To see those folders correctly in SquirrelMail,\n"
+                     . "the user should change the SquirrelMail language to match.\n"
+                     . "Moreover, SquirrelMail then needs to be told what folders to use\n"
+                     . "for Drafts, Sent and Trash in Options --> Folder Preferences.\n"
+                     . "These default settings will only correctly find the Sent, Trash\n"
+                     . "and Drafts folders if both Gmail and SquirrelMail languages are\n"
+                     . "set to English.\n\n"
+                     . "Also note that in some regions (Europe?), the default folder\n"
+                     . "names (see main menu selection 3. Folder Defaults) are different\n"
+                     . "(they may need to have the prefix \"[Google Mail]\" instead of\n"
+                     . "\"[Gmail]\") and \"Trash\" may be called \"Bin\" instead.\n";
+
         } elsif ( $server eq "quit" ) {
             $continue = 1;
         } else {