Pārlūkot izejas kodu

Add server type 'hmailserver' to work around a searching problem with hMailServer.
Fixes: #1085377

Thijs Kinkhorst 20 gadi atpakaļ
vecāks
revīzija
a3be315040
5 mainītis faili ar 38 papildinājumiem un 23 dzēšanām
  1. 2 0
      ChangeLog
  2. 19 13
      config/conf.pl
  3. 2 1
      config/config_default.php
  4. 12 6
      doc/presets.txt
  5. 3 3
      functions/imap_search.php

+ 2 - 0
ChangeLog

@@ -165,6 +165,8 @@ Version 1.5.1 -- CVS
   - Added sq_setlocale function in order to use multiple locale names.
   - Added sq_setlocale function in order to use multiple locale names.
   - Added size attributes to new_mail sound tags. Fixes #818958.
   - Added size attributes to new_mail sound tags. Fixes #818958.
   - Removed extra ; in SquirrelMail added Received header per RFC 822. Fixes #1088548.
   - Removed extra ; in SquirrelMail added Received header per RFC 822. Fixes #1088548.
+  - Add IMAP server type "hmailserver" to make search work with hMailServer.
+    Fixes #1085377.
 
 
 Version 1.5.0
 Version 1.5.0
 --------------------
 --------------------

+ 19 - 13
config/conf.pl

@@ -1075,12 +1075,13 @@ sub command19 {
     print "these servers.  If you would like to use them, please select your\n";
     print "these servers.  If you would like to use them, please select your\n";
     print "IMAP server.  If you do not wish to use these work-arounds, you can\n";
     print "IMAP server.  If you do not wish to use these work-arounds, you can\n";
     print "set this to \"other\", and none will be used.\n";
     print "set this to \"other\", and none will be used.\n";
-    print "    cyrus      = Cyrus IMAP server\n";
-    print "    uw         = University of Washington's IMAP server\n";
-    print "    exchange   = Microsoft Exchange IMAP server\n";
-    print "    courier    = Courier IMAP server\n";
-    print "    macosx     = Mac OS X Mailserver\n";
-    print "    other      = Not one of the above servers\n";
+    print "    cyrus       = Cyrus IMAP server\n";
+    print "    uw          = University of Washington's IMAP server\n";
+    print "    exchange    = Microsoft Exchange IMAP server\n";
+    print "    courier     = Courier IMAP server\n";
+    print "    macosx      = Mac OS X Mailserver\n";
+    print "    hmailserver = hMailServer\n";
+    print "    other       = Not one of the above servers\n";
     print "[$WHT$imap_server_type$NRM]: $WHT";
     print "[$WHT$imap_server_type$NRM]: $WHT";
     $new_imap_server_type = <STDIN>;
     $new_imap_server_type = <STDIN>;
 
 
@@ -3384,13 +3385,14 @@ sub set_defaults {
     $continue = 0;
     $continue = 0;
     while ( $continue != 1 ) {
     while ( $continue != 1 ) {
         print "Please select your IMAP server:\n";
         print "Please select your IMAP server:\n";
-        print "    cyrus      = Cyrus IMAP server\n";
-        print "    uw         = University of Washington's IMAP server\n";
-        print "    exchange   = Microsoft Exchange IMAP server\n";
-        print "    courier    = Courier IMAP server\n";
-        print "    macosx     = Mac OS X Mailserver\n";
-        print "    mercury32  = Mercury/32\n";
-        print "    quit       = Do not change anything\n";
+        print "    cyrus       = Cyrus IMAP server\n";
+        print "    uw          = University of Washington's IMAP server\n";
+        print "    exchange    = Microsoft Exchange IMAP server\n";
+        print "    courier     = Courier IMAP server\n";
+        print "    macosx      = Mac OS X Mailserver\n";
+        print "    hmailserver = hMailServer\n";
+        print "    mercury32   = Mercury/32\n";
+        print "    quit        = Do not change anything\n";
         print "Command >> ";
         print "Command >> ";
         $server = <STDIN>;
         $server = <STDIN>;
         $server =~ s/[\r\n]//g;
         $server =~ s/[\r\n]//g;
@@ -3468,6 +3470,10 @@ sub set_defaults {
             $disp_default_folder_prefix     = $default_folder_prefix;
             $disp_default_folder_prefix     = $default_folder_prefix;
 
 
             $continue = 1;
             $continue = 1;
+        } elsif ( $server eq "hmailserver" ) {
+            $imap_server_type               = "hmailserver";
+
+	    $continue = 1;
         } elsif ( $server eq "mercury32" ) {
         } elsif ( $server eq "mercury32" ) {
             $imap_server_type               = "mercury32";
             $imap_server_type               = "mercury32";
             $default_folder_prefix          = "";
             $default_folder_prefix          = "";

+ 2 - 1
config/config_default.php

@@ -192,6 +192,7 @@ $imapPort = 143;
  *   exchange
  *   exchange
  *   uw
  *   uw
  *   macosx
  *   macosx
+ *   hmailserver
  *   mercury32
  *   mercury32
  *   other
  *   other
  *
  *
@@ -968,4 +969,4 @@ $config_use_color = 2;
  * sent and regular output to begin, which will majorly screw
  * sent and regular output to begin, which will majorly screw
  * things up when we try to send more headers later.
  * things up when we try to send more headers later.
  */
  */
-?>
+?>

+ 12 - 6
doc/presets.txt

@@ -6,12 +6,13 @@ It can be used if user can't run conf.pl and changes options manually.
 Settings can be different if IMAP server uses shared folders.
 Settings can be different if IMAP server uses shared folders.
 
 
 Possible server values are:
 Possible server values are:
- cyrus      = Cyrus IMAP server
- uw         = University of Washington's IMAP server
- exchange   = Microsoft Exchange IMAP server
- courier    = Courier IMAP server
- macosx     = Mac OS X Mailserver
- mercury32  = Mercury/32
+ cyrus       = Cyrus IMAP server
+ uw          = University of Washington's IMAP server
+ exchange    = Microsoft Exchange IMAP server
+ courier     = Courier IMAP server
+ macosx      = Mac OS X Mailserver
+ hmailserver = hMailServer
+ mercury32   = Mercury/32
 
 
 -----------------
 -----------------
 default settings:
 default settings:
@@ -104,6 +105,11 @@ show_contain_subfolders_option = false
                  delete_folder = true
                  delete_folder = true
       force_username_lowercase = false
       force_username_lowercase = false
 
 
+------------------
+'hmailserver' settings:
+------------------
+              imap_server_type = hmailserver   (used in imap_search.php)
+
 -------------------
 -------------------
 'mercury' settings:
 'mercury' settings:
 -------------------
 -------------------

+ 3 - 3
functions/imap_search.php

@@ -36,7 +36,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
     $multi_search = explode(' ', $search_what);
     $multi_search = explode(' ', $search_what);
     $search_string = '';
     $search_string = '';
 
 
-    /* it seems macosx does not support the prefered search
+    /* it seems macosx and hmailserver do not support the prefered search
        syntax so we fall back to the older style. This IMAP
        syntax so we fall back to the older style. This IMAP
        server has a problem with multiple search terms. Instead
        server has a problem with multiple search terms. Instead
        of returning the messages that match all the terms it
        of returning the messages that match all the terms it
@@ -44,7 +44,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
        on the client side, but should be fixed on the server
        on the client side, but should be fixed on the server
        as per the RFC */
        as per the RFC */
 
 
-    if ($imap_server_type == 'macosx') {
+    if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') {
         foreach ($multi_search as $multi_search_part) {
         foreach ($multi_search as $multi_search_part) {
             if (strtoupper($languages[$squirrelmail_language]['CHARSET']) == 'ISO-2022-JP') {
             if (strtoupper($languages[$squirrelmail_language]['CHARSET']) == 'ISO-2022-JP') {
                 $multi_search_part = mb_convert_encoding($multi_search_part, 'JIS', 'auto');
                 $multi_search_part = mb_convert_encoding($multi_search_part, 'JIS', 'auto');
@@ -122,4 +122,4 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
 
 
 
 
 
 
-?>
+?>