Fix imap keyword search. Libetpan assumes keyword search is a MUST but RFC states...
authorMichael Rasmussen <mir@datanom.net>
Thu, 5 Dec 2019 23:50:48 +0000 (00:50 +0100)
committerMichael Rasmussen <mir@datanom.net>
Fri, 6 Dec 2019 15:26:07 +0000 (16:26 +0100)
Signed-off-by: Michael Rasmussen <mir@datanom.net>
src/imap.c

index 8d8876b..8521e35 100644 (file)
@@ -2496,10 +2496,16 @@ static gint     search_msgs             (Folder                 *folder,
                progress_cb(progress_data, TRUE, container->total_msgs, 0, container->total_msgs);
 
        if (result == MAILIMAP_ERROR_PROTOCOL) {
-               debug_print("search_msgs - got protocol error, aborting\n");
+               debug_print("Server side search unavailable, using local search\n");
                imap_handle_error(SESSION(session), NULL, result);
-               alertpanel_error_log(_("Search failed due to server error."));
-               return -1;
+               result = folder_item_search_msgs_local(folder, container, msgs,                             NULL, predicate, progress_cb, progress_data);
+               if (result < 0) {
+                       debug_print("search_msgs - got protocol error, aborting\n");
+                       alertpanel_error_log(_("Search failed due to server error."));
+                       return -1;
+               }
+
+               return result;
        } if (result == MAILIMAP_NO_ERROR) {
                gint result = 0;