]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Add imapc_mail_error_to_resp_text_code to access error msg by enum
authorMarkus Valentin <markus.valentin@open-xchange.com>
Tue, 25 May 2021 10:38:50 +0000 (12:38 +0200)
committermarkus.valentin <markus.valentin@open-xchange.com>
Wed, 26 May 2021 10:15:09 +0000 (10:15 +0000)
src/lib-storage/index/imapc/imapc-storage.c
src/lib-storage/index/imapc/imapc-storage.h

index 60f718684f7be03e2cd4f288d07428588c6bd3a4..84a75d771b1f4cd59fe034e27f47c89c3be77a95 100644 (file)
@@ -79,6 +79,19 @@ bool imapc_resp_text_code_parse(const char *str, enum mail_error *error_r)
        return FALSE;
 }
 
+bool imapc_mail_error_to_resp_text_code(enum mail_error error, const char **str_r)
+{
+       unsigned int i;
+
+       for (i = 0; i < N_ELEMENTS(imapc_resp_code_map); i++) {
+               if (imapc_resp_code_map[i].error == error) {
+                       *str_r = imapc_resp_code_map[i].code;
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
 bool imapc_mailbox_has_modseqs(struct imapc_mailbox *mbox)
 {
        return (mbox->capabilities & (IMAPC_CAPABILITY_CONDSTORE |
index f14d1e102078dfdf984997f6e80409332fe34b36..0736e566b0aebd7c6e77470833960d0d74bda732 100644 (file)
@@ -188,6 +188,7 @@ void imap_mailbox_select_finish(struct imapc_mailbox *mbox);
 
 bool imapc_mailbox_has_modseqs(struct imapc_mailbox *mbox);
 bool imapc_resp_text_code_parse(const char *str, enum mail_error *error_r);
+bool imapc_mail_error_to_resp_text_code(enum mail_error error, const char **str_r);
 void imapc_copy_error_from_reply(struct imapc_storage *storage,
                                 enum mail_error default_error,
                                 const struct imapc_command_reply *reply);