annotate src/lib-index/mail-index-transaction-view.c @ 2224:a816e2d88406 HEAD

Added mail_index_transaction_get_updated_view() which can be used to access uncommitted messages.
author Timo Sirainen <tss@iki.fi>
date Tue, 22 Jun 2004 10:36:33 +0300
parents
children 51719889ffcf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2224
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 /* Copyright (C) 2004 Timo Sirainen */
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3 #include "lib.h"
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 #include "buffer.h"
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 #include "mail-index-private.h"
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 #include "mail-index-view-private.h"
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 #include "mail-index-transaction-private.h"
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9 struct mail_index_view_transaction {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 struct mail_index_view view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11 struct mail_index_view_methods *parent;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 struct mail_index_transaction *t;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 };
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
15 static void _tview_close(struct mail_index_view *view)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
16 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
17 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
19
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
20 tview->t->updated_view = NULL;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
21
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
22 return tview->parent->close(view);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
23 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
24
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
25 static uint32_t _tview_get_message_count(struct mail_index_view *view)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
26 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
27 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30 return view->messages_count +
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31 (tview->t->last_new_seq == 0 ? 0 :
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32 tview->t->last_new_seq - tview->t->first_new_seq);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
33 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35 static int _tview_get_header(struct mail_index_view *view,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36 const struct mail_index_header **hdr_r)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
39 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
40
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
41 if (tview->parent->get_header(view, hdr_r) < 0)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42 return -1;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
43
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
44 if ((*hdr_r)->messages_count != view->messages_count) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
45 /* messages_count differs, use a modified copy.
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
46 FIXME: same problems as with _view_get_header().. */
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
47 view->tmp_hdr_copy = **hdr_r;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
48 view->tmp_hdr_copy.messages_count = view->messages_count;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
49 *hdr_r = &view->tmp_hdr_copy;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
50 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
51 return 0;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
52 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
53
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
54 static int _tview_lookup_full(struct mail_index_view *view, uint32_t seq,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
55 struct mail_index_map **map_r,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56 const struct mail_index_record **rec_r)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
57 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
58 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
59 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
60
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
61 if (seq >= tview->t->first_new_seq) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
62 /* FIXME: is this right to return index map..?
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63 it's not there yet. */
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
64 *map_r = view->index->map;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 *rec_r = mail_index_transaction_lookup(tview->t, seq);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
66 return 1;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 } else {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68 return tview->parent->lookup_full(view, seq, map_r, rec_r);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
69 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72 static int _tview_lookup_uid(struct mail_index_view *view, uint32_t seq,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 uint32_t *uid_r)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
76 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
77
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78 if (seq >= tview->t->first_new_seq) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
79 *uid_r = mail_index_transaction_lookup(tview->t, seq)->uid;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 return 0;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
81 } else {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82 return tview->parent->lookup_uid(view, seq, uid_r);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
83 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
84 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
86 static int _tview_lookup_uid_range(struct mail_index_view *view,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
87 uint32_t first_uid, uint32_t last_uid,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
88 uint32_t *first_seq_r, uint32_t *last_seq_r)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
89 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
90 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
91 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
92
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
93 if (tview->parent->lookup_uid_range(view, first_uid, last_uid,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
94 first_seq_r, last_seq_r) < 0)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
95 return -1;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
96
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
97 /* FIXME: we don't need this function yet.. new UIDs might be 0 as
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
98 well.. */
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
99
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
100 if (*first_seq_r == 0) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
101 /* nothing found, either doesn't exist or it's completely
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
102 newly appended. */
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
103 } else if (*last_seq_r + 1 == tview->t->first_new_seq) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
104 /* last_seq_r may be growed from transactions */
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
105 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
106
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
107 return 0;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
108 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
109
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
110 static int _tview_lookup_first(struct mail_index_view *view,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
111 enum mail_flags flags, uint8_t flags_mask,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
112 uint32_t *seq_r)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
114 struct mail_index_view_transaction *tview =
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
115 (struct mail_index_view_transaction *)view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
116 const struct mail_index_record *rec;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
117 uint32_t seq, message_count;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
118
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
119 if (tview->parent->lookup_first(view, flags, flags_mask, seq_r) < 0)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
120 return -1;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
121
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122 if (*seq_r != 0)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
123 return 0;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
124
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
125 rec = buffer_get_data(tview->t->appends, NULL);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
126 seq = tview->t->first_new_seq;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
127 message_count = tview->t->last_new_seq;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
128 for (; seq <= message_count; seq++) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
129 if ((rec->flags & flags_mask) == (uint8_t)flags) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
130 *seq_r = seq;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
131 break;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
132 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
133 rec = CONST_PTR_OFFSET(rec, view->index->record_size);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
134 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
135
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
136 return 0;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
137 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
138
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
139 static struct mail_index_view_methods view_methods = {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
140 _tview_close,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
141 _tview_get_message_count,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
142 _tview_get_header,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
143 _tview_lookup_full,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
144 _tview_lookup_uid,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
145 _tview_lookup_uid_range,
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
146 _tview_lookup_first
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
147 };
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
148
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
149 struct mail_index_view *
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
150 mail_index_transaction_get_updated_view(struct mail_index_transaction *t)
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
151 {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
152 struct mail_index_view_transaction *tview;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
153
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
154 if (t->updated_view == NULL) {
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
155 tview = i_new(struct mail_index_view_transaction, 1);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
156 mail_index_view_clone(&tview->view, t->view);
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
157 tview->view.methods = view_methods;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
158 tview->parent = &t->view->methods;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
159 tview->t = t;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
160
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
161 t->updated_view = &tview->view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
162 }
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
163
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
164 return t->updated_view;
a816e2d88406 Added mail_index_transaction_get_updated_view() which can be used to access
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
165 }