]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: client_send_mailbox_flags() - Don't send PERMANENTFLAGS if not selecting and...
authorMarco Bettini <marco.bettini@open-xchange.com>
Thu, 29 May 2025 08:47:25 +0000 (08:47 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Thu, 26 Jun 2025 08:23:16 +0000 (08:23 +0000)
src/imap/imap-commands-util.c

index 5dd3d1406c233f8c60777ed9710a476878bb8aaa..45a7e28ac4d0077d1d357531c35cf4e7eb5ae7d9 100644 (file)
@@ -317,6 +317,19 @@ void client_send_mailbox_flags(struct client *client, bool selecting)
        str_append_c(str, ')');
        client_send_line(client, str_c(str));
 
+       bool readonly = mailbox_is_readonly(client->mailbox);
+       if (!selecting && (status.allow_new_keywords || readonly)) {
+               /* If not in a SELEXT/EXAMINE command, update is optional.
+
+                  If the mailbox is readonly, nothing can really change,
+                  so no update is needed.
+
+                  Also, if '*' is present, all possibly new keywords
+                  are already included in that, so there is no need to
+                  update either. */
+               return;
+       }
+
        if (!status.permanent_keywords)
                keywords = NULL;
 
@@ -330,7 +343,7 @@ void client_send_mailbox_flags(struct client *client, bool selecting)
        }
        str_append(str, ")] ");
 
-       if (mailbox_is_readonly(client->mailbox))
+       if (readonly)
                str_append(str, "Read-only mailbox.");
        else
                str_append(str, "Flags permitted.");