~ubuntu-branches/ubuntu/trusty/dovecot/trusty-updates

« back to all changes in this revision

Viewing changes to src/lib-index/mail-index-view-sync.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (1.15.3) (96.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20140108093549-814nkqdcxfbvgktg
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2003-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2003-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
145
145
 
146
146
        src_count = src_size / sizeof(*src);
147
147
        for (i = 0; i < src_count; i++)
148
 
                seq_range_array_add(dest, 0, src[i].uid);
 
148
                seq_range_array_add(dest, src[i].uid);
149
149
}
150
150
 
151
151
static int
273
273
 
274
274
        qsort(old_idx, old_count, sizeof(*old_idx), uint_cmp);
275
275
        qsort(new_idx, new_count, sizeof(*new_idx), uint_cmp);
276
 
        return memcmp(old_idx, new_idx, old_count * sizeof(old_idx)) == 0;
 
276
        return memcmp(old_idx, new_idx, old_count * sizeof(*old_idx)) == 0;
277
277
}
278
278
 
279
279
static int view_sync_update_keywords(struct mail_index_view_sync_ctx *ctx,
370
370
                                           &kw_reset) < 0)
371
371
                        return -1;
372
372
 
373
 
                view_sync_update_keywords(ctx, new_rec->uid);
 
373
                if (view_sync_update_keywords(ctx, new_rec->uid) < 0)
 
374
                        return -1;
374
375
                changed = TRUE;
375
376
        }
376
377
 
394
395
           be avoided by always keeping a private copy of the map in the view,
395
396
           but that's a waste of memory for as rare of a problem as this. */
396
397
        if (changed)
397
 
                seq_range_array_add(&ctx->lost_flags, 0, new_rec->uid);
 
398
                seq_range_array_add(&ctx->lost_flags, new_rec->uid);
398
399
        return 0;
399
400
}
400
401
 
437
438
                        i++; j++;
438
439
                } else if (old_rec->uid < new_rec->uid) {
439
440
                        /* message expunged */
440
 
                        seq_range_array_add(&ctx->expunges, 0, old_rec->uid);
 
441
                        seq_range_array_add(&ctx->expunges, old_rec->uid);
441
442
                        i++;
442
443
                } else {
443
444
                        /* new message appeared out of nowhere */
451
452
        /* if there are old messages left, they're all expunged */
452
453
        for (; i < old_count; i++) {
453
454
                old_rec = MAIL_INDEX_MAP_IDX(old_map, i);
454
 
                seq_range_array_add(&ctx->expunges, 0, old_rec->uid);
 
455
                seq_range_array_add(&ctx->expunges, old_rec->uid);
455
456
        }
456
457
        /* if there are new messages left, they're all new messages */
457
458
        thdr.type = MAIL_TRANSACTION_APPEND | MAIL_TRANSACTION_EXTERNAL;
463
464
                        return -1;
464
465
                mail_index_map_lookup_keywords(new_map, j + 1,
465
466
                                               &ctx->lost_new_kw);
466
 
                view_sync_update_keywords(ctx, new_rec->uid);
 
467
                if (view_sync_update_keywords(ctx, new_rec->uid) < 0)
 
468
                        return -1;
467
469
        }
468
470
        *expunge_count_r = view_sync_expunges2seqs(ctx);
469
471
 
767
769
 
768
770
                        /* skip internal flag changes */
769
771
                        if (ctx->data_offset == ctx->hdr->size)
770
 
                                return 0;
 
772
                                return FALSE;
771
773
 
772
774
                        update = CONST_PTR_OFFSET(data, ctx->data_offset);
773
775
                }
774
776
 
775
 
                rec->type = MAIL_INDEX_VIEW_SYNC_TYPE_FLAGS;
 
777
                if (update->add_flags != 0 || update->remove_flags != 0)
 
778
                        rec->type = MAIL_INDEX_VIEW_SYNC_TYPE_FLAGS;
 
779
                else
 
780
                        rec->type = MAIL_INDEX_VIEW_SYNC_TYPE_MODSEQ;
776
781
                rec->uid1 = update->uid1;
777
782
                rec->uid2 = update->uid2;
778
783
                break;
835
840
        sync_rec->type = MAIL_INDEX_VIEW_SYNC_TYPE_FLAGS;
836
841
        sync_rec->uid1 = range[ctx->lost_flag_idx].seq1;
837
842
        sync_rec->uid2 = range[ctx->lost_flag_idx].seq2;
 
843
        sync_rec->hidden = FALSE;
838
844
        ctx->lost_flag_idx++;
839
845
        return TRUE;
840
846
}