~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2004-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2004-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
22
22
        unsigned int record_size;
23
23
        unsigned int recs_count;
24
24
        void *recs;
25
 
        ARRAY_DEFINE(all_recs, void *);
 
25
        ARRAY(void *) all_recs;
26
26
};
27
27
 
28
28
static void tview_close(struct mail_index_view *view)
85
85
                         const struct mail_index_record *rec, uint32_t seq)
86
86
{
87
87
        struct mail_index_transaction *t = tview->t;
88
 
        const struct mail_transaction_flag_update *updates;
 
88
        const struct mail_index_flag_update *updates;
89
89
        struct mail_index_record *trec;
90
90
        unsigned int idx, count;
91
91
 
139
139
                /* FIXME: is this right to return index map..?
140
140
                   it's not there yet. */
141
141
                *map_r = view->index->map;
142
 
                *expunged_r = FALSE;
 
142
                if (expunged_r != NULL)
 
143
                        *expunged_r = FALSE;
143
144
                return mail_index_transaction_lookup(tview->t, seq);
144
145
        }
145
146
 
146
147
        rec = tview->super->lookup_full(view, seq, map_r, expunged_r);
147
148
        rec = tview_apply_flag_updates(tview, *map_r, rec, seq);
148
149
 
149
 
        if (mail_index_transaction_is_expunged(tview->t, seq))
 
150
        if (expunged_r != NULL &&
 
151
            mail_index_transaction_is_expunged(tview->t, seq))
150
152
                *expunged_r = TRUE;
151
153
        return rec;
152
154
}
303
305
                return;
304
306
        }
305
307
 
306
 
        /* apply any keyword updates in this transaction */
307
 
        if (array_is_created(&t->keyword_resets)) {
308
 
                if (seq_range_exists(&t->keyword_resets, seq))
309
 
                        array_clear(keyword_idx);
310
 
        }
311
 
 
312
308
        if (array_is_created(&t->keyword_updates))
313
309
                updates = array_get(&t->keyword_updates, &count);
314
310
        else {
393
389
        }
394
390
}
395
391
 
 
392
static bool
 
393
tview_is_ext_reset(struct mail_index_view_transaction *tview, uint32_t ext_id)
 
394
{
 
395
        const struct mail_transaction_ext_reset *resets;
 
396
        unsigned int count;
 
397
 
 
398
        if (!array_is_created(&tview->t->ext_resets))
 
399
                return FALSE;
 
400
 
 
401
        resets = array_get(&tview->t->ext_resets, &count);
 
402
        return ext_id < count && resets[ext_id].new_reset_id != 0;
 
403
}
 
404
 
396
405
static void
397
406
tview_lookup_ext_full(struct mail_index_view *view, uint32_t seq,
398
407
                      uint32_t ext_id, struct mail_index_map **map_r,
406
415
 
407
416
        i_assert(ext_id < array_count(&view->index->extensions));
408
417
 
409
 
        *expunged_r = FALSE;
 
418
        if (expunged_r != NULL)
 
419
                *expunged_r = FALSE;
410
420
 
411
421
        if (array_is_created(&tview->t->ext_rec_updates) &&
412
422
            ext_id < array_count(&tview->t->ext_rec_updates)) {
423
433
                }
424
434
        }
425
435
 
426
 
        /* not updated, return the existing value */
427
 
        if (seq < tview->t->first_new_seq) {
 
436
        /* not updated, return the existing value, unless ext was
 
437
           already reset */
 
438
        if (seq < tview->t->first_new_seq &&
 
439
            !tview_is_ext_reset(tview, ext_id)) {
428
440
                tview->super->lookup_ext_full(view, seq, ext_id,
429
441
                                              map_r, data_r, expunged_r);
430
442
        } else {