From: Marco Bettini Date: Thu, 29 May 2025 08:47:25 +0000 (+0000) Subject: imap: client_send_mailbox_flags() - Don't send PERMANENTFLAGS if not selecting and... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d94e46f3628df54bf4af4996bf73fd326a0ac86e;p=thirdparty%2Fdovecot%2Fcore.git imap: client_send_mailbox_flags() - Don't send PERMANENTFLAGS if not selecting and we have allow_new_keywords --- diff --git a/src/imap/imap-commands-util.c b/src/imap/imap-commands-util.c index 5dd3d1406c..45a7e28ac4 100644 --- a/src/imap/imap-commands-util.c +++ b/src/imap/imap-commands-util.c @@ -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.");