]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Add support for SEARCH MIMEPART
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 4 Dec 2025 07:19:33 +0000 (09:19 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 4 Dec 2025 07:19:33 +0000 (09:19 +0200)
Use it if the remote server advertises SEARCH=X-MIMEPART or SEARCH=MIMEPART.

src/lib-imap-client/imapc-settings.c
src/lib-imap-client/imapc-settings.h
src/lib-storage/index/imapc/imapc-search.c

index ab6b7cb3ba2a2607acc675ad9f2f3e6d50dccf04..8556133c0b1675c387d0a51879934a11d31297ad 100644 (file)
@@ -114,6 +114,8 @@ const struct imapc_capability_name imapc_capability_names[] = {
        { "SORT", IMAPC_CAPABILITY_SORT },
        { "ESORT", IMAPC_CAPABILITY_ESORT },
        { "SORT=DISPLAY", IMAPC_CAPABILITY_SORT_DISPLAY },
+       { "SEARCH=MIMEPART", IMAPC_CAPABILITY_SEARCH_MIMEPART },
+       { "SEARCH=X-MIMEPART", IMAPC_CAPABILITY_SEARCH_MIMEPART },
 
        { "IMAP4REV1", IMAPC_CAPABILITY_IMAP4REV1 },
        { "IMAP4REV2", IMAPC_CAPABILITY_IMAP4REV2 },
index 85345d52202ac86ce36415872ca709a1bf8d10f9..cc44afbbc76b2fbd7ab632bb66392a043ce4f819 100644 (file)
@@ -48,6 +48,7 @@ enum imapc_capability {
        IMAPC_CAPABILITY_SORT           = 0x20000,
        IMAPC_CAPABILITY_ESORT          = 0x40000,
        IMAPC_CAPABILITY_SORT_DISPLAY   = 0x100000,
+       IMAPC_CAPABILITY_SEARCH_MIMEPART= 0x200000,
 
        IMAPC_CAPABILITY_IMAP4REV2      = 0x20000000,
        IMAPC_CAPABILITY_IMAP4REV1      = 0x40000000,
index 977ee586f76b1fbee3b496e9f1fb76ce22c0ce24..460872c6da304830c3a5728b66543c048a9e7697 100644 (file)
@@ -222,9 +222,12 @@ imapc_build_search_query_arg(struct imapc_mailbox *mbox,
        case SEARCH_MAILBOX_GUID:
        case SEARCH_MAILBOX_GLOB:
        case SEARCH_REAL_UID:
-       case SEARCH_MIMEPART:
                /* not supported for now */
                break;
+       case SEARCH_MIMEPART:
+               if ((mbox->capabilities & IMAPC_CAPABILITY_SEARCH_MIMEPART) == 0)
+                       return FALSE;
+               return mail_search_arg_to_imap(str, arg, &error);
        }
        return FALSE;
 }