]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: imapc_untagged_fetch_update_flags() - Reduce indentation
authorMarkus Valentin <markus.valentin@open-xchange.com>
Thu, 27 Jan 2022 07:06:16 +0000 (08:06 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 14 Mar 2022 11:38:19 +0000 (11:38 +0000)
src/lib-storage/index/imapc/imapc-mailbox.c

index 0111eb7fb817f7285eb9ec4d37e376005b91fcf6..89cd535c3d11a0bb490d874105122db0d42467d3 100644 (file)
@@ -499,39 +499,39 @@ imapc_untagged_fetch_update_flags(struct imapc_mailbox *mbox,
                                  struct imapc_untagged_fetch_ctx *ctx,
                                  uint32_t lseq)
 {
+       ARRAY_TYPE(keyword_indexes) old_kws;
+       struct mail_keywords *kw;
        const struct mail_index_record *rec = NULL;
        const char *atom;
 
+       if (!ctx->have_flags)
+               return;
+
        rec = mail_index_lookup(mbox->delayed_sync_view, lseq);
-       if (ctx->have_flags && rec->flags != ctx->flags) {
+       if (rec->flags != ctx->flags) {
                mail_index_update_flags(mbox->delayed_sync_trans, lseq,
                                        MODIFY_REPLACE, ctx->flags);
        }
-       if (ctx->have_flags) {
-               ARRAY_TYPE(keyword_indexes) old_kws;
-               struct mail_keywords *kw;
 
-               t_array_init(&old_kws, 8);
-               mail_index_lookup_keywords(mbox->delayed_sync_view, lseq,
-                                          &old_kws);
+       t_array_init(&old_kws, 8);
+       mail_index_lookup_keywords(mbox->delayed_sync_view, lseq, &old_kws);
 
-               if (ctx->have_gmail_labels) {
-                       /* add keyword for mails that have GMail labels.
-                          this can be used for "All Mail" mailbox migrations
-                          with dsync */
-                       atom = "$GMailHaveLabels";
-                       array_push_back(&ctx->keywords, &atom);
-               }
+       if (ctx->have_gmail_labels) {
+               /* add keyword for mails that have GMail labels.
+                  this can be used for "All Mail" mailbox migrations
+                  with dsync */
+               atom = "$GMailHaveLabels";
+               array_push_back(&ctx->keywords, &atom);
+       }
 
-               array_append_zero(&ctx->keywords);
-               kw = mail_index_keywords_create(mbox->box.index,
-                                               array_front(&ctx->keywords));
-               if (!keywords_are_equal(kw, &old_kws)) {
-                       mail_index_update_keywords(mbox->delayed_sync_trans,
-                                                  lseq, MODIFY_REPLACE, kw);
-               }
-               mail_index_keywords_unref(&kw);
+       array_append_zero(&ctx->keywords);
+       kw = mail_index_keywords_create(mbox->box.index,
+                                       array_front(&ctx->keywords));
+       if (!keywords_are_equal(kw, &old_kws)) {
+               mail_index_update_keywords(mbox->delayed_sync_trans,
+                                          lseq, MODIFY_REPLACE, kw);
        }
+       mail_index_keywords_unref(&kw);
 }
 
 static void imapc_untagged_fetch_handle(struct imapc_mailbox *mbox,