Mercurial > dovecot > core-2.2
annotate src/lib-storage/index/index-storage.c @ 196:95d21ab87eeb HEAD
X-IMAPbase is now parsed correctly.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 09 Sep 2002 05:11:01 +0300 |
parents | 73bf05a1d862 |
children | cf4d065f2f85 |
rev | line source |
---|---|
0 | 1 /* Copyright (C) 2002 Timo Sirainen */ |
2 | |
3 #include "lib.h" | |
4 #include "mail-index.h" | |
114
0c3ffb677ad1
Reset index error message after it's been moved to storage.
Timo Sirainen <tss@iki.fi>
parents:
106
diff
changeset
|
5 #include "mail-index-util.h" |
175
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
6 #include "mail-custom-flags.h" |
0 | 7 #include "index-storage.h" |
8 | |
9 IndexMailbox *index_storage_init(MailStorage *storage, Mailbox *box, | |
10 MailIndex *index, const char *name, | |
11 int readonly) | |
12 { | |
13 IndexMailbox *ibox; | |
14 | |
15 i_assert(name != NULL); | |
16 | |
17 /* open the index first */ | |
18 if (!index->open_or_create(index, !readonly)) { | |
13
bb294faf7379
"Critical errors" aren't displayed to users anymore, ie. anything that is
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
19 mail_storage_set_internal_error(storage); |
0 | 20 index->free(index); |
21 return NULL; | |
22 } | |
23 | |
24 ibox = i_new(IndexMailbox, 1); | |
25 ibox->box = *box; | |
26 | |
27 ibox->box.storage = storage; | |
28 ibox->box.name = i_strdup(name); | |
29 ibox->box.readonly = readonly; | |
30 | |
31 ibox->index = index; | |
106
5fe3e04ca8d9
Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents:
47
diff
changeset
|
32 ibox->cache = imap_msgcache_alloc(&index_msgcache_iface); |
0 | 33 |
34 return ibox; | |
35 } | |
36 | |
37 void index_storage_close(Mailbox *box) | |
38 { | |
39 IndexMailbox *ibox = (IndexMailbox *) box; | |
40 | |
41 imap_msgcache_free(ibox->cache); | |
42 ibox->index->free(ibox->index); | |
43 i_free(box->name); | |
44 i_free(box); | |
45 } | |
46 | |
47 int mail_storage_set_index_error(IndexMailbox *ibox) | |
48 { | |
49 ibox->box.inconsistent = | |
50 ibox->index->is_inconsistency_error(ibox->index); | |
13
bb294faf7379
"Critical errors" aren't displayed to users anymore, ie. anything that is
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
51 mail_storage_set_internal_error(ibox->box.storage); |
114
0c3ffb677ad1
Reset index error message after it's been moved to storage.
Timo Sirainen <tss@iki.fi>
parents:
106
diff
changeset
|
52 index_reset_error(ibox->index); |
0 | 53 return FALSE; |
54 } | |
55 | |
175
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
56 int index_mailbox_fix_custom_flags(IndexMailbox *ibox, MailFlags *flags, |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
57 const char *custom_flags[]) |
0 | 58 { |
175
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
59 int ret; |
0 | 60 |
175
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
61 ret = mail_custom_flags_fix_list(ibox->index->custom_flags, |
196
95d21ab87eeb
X-IMAPbase is now parsed correctly.
Timo Sirainen <tss@iki.fi>
parents:
175
diff
changeset
|
62 flags, custom_flags, |
95d21ab87eeb
X-IMAPbase is now parsed correctly.
Timo Sirainen <tss@iki.fi>
parents:
175
diff
changeset
|
63 MAIL_CUSTOM_FLAGS_COUNT); |
175
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
64 switch (ret) { |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
65 case 1: |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
66 return TRUE; |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
67 case 0: |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
68 mail_storage_set_error(ibox->box.storage, "Maximum number of " |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
69 "different custom flags exceeded"); |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
70 return FALSE; |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
71 default: |
73bf05a1d862
Moved custom flags handling into lib-index.
Timo Sirainen <tss@iki.fi>
parents:
171
diff
changeset
|
72 return mail_storage_set_index_error(ibox); |
0 | 73 } |
74 } |