Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/lib-storage/index/maildir/maildir-storage.c @ 296:d66aa1f1fb2d HEAD
Added fast-flag for mailbox opening, which doesn't do any index compressing
or cache updating. This flag is set when mailbox is opened by APPEND, COPY
or STATUS (ie. not SELECT/EXAMINE).
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 23 Sep 2002 13:42:20 +0300 |
parents | 945063e0fb85 |
children | 39c9a9fc190b |
comparison
equal
deleted
inserted
replaced
295:c6c0e376008f | 296:d66aa1f1fb2d |
---|---|
121 | 121 |
122 return TRUE; | 122 return TRUE; |
123 } | 123 } |
124 | 124 |
125 static Mailbox *maildir_open(MailStorage *storage, const char *name, | 125 static Mailbox *maildir_open(MailStorage *storage, const char *name, |
126 int readonly) | 126 int readonly, int fast) |
127 { | 127 { |
128 IndexMailbox *ibox; | 128 IndexMailbox *ibox; |
129 const char *path; | 129 const char *path; |
130 | 130 |
131 path = t_strconcat(storage->dir, "/.", name, NULL); | 131 path = t_strconcat(storage->dir, "/.", name, NULL); |
132 | 132 |
133 ibox = index_storage_init(storage, &maildir_mailbox, | 133 ibox = index_storage_init(storage, &maildir_mailbox, |
134 maildir_index_alloc(path), name, readonly); | 134 maildir_index_alloc(path), name, readonly, |
135 fast); | |
135 if (ibox != NULL) | 136 if (ibox != NULL) |
136 ibox->expunge_locked = maildir_expunge_locked; | 137 ibox->expunge_locked = maildir_expunge_locked; |
137 return (Mailbox *) ibox; | 138 return (Mailbox *) ibox; |
138 } | 139 } |
139 | 140 |
148 | 149 |
149 return name; | 150 return name; |
150 } | 151 } |
151 | 152 |
152 static Mailbox *maildir_open_mailbox(MailStorage *storage, const char *name, | 153 static Mailbox *maildir_open_mailbox(MailStorage *storage, const char *name, |
153 int readonly) | 154 int readonly, int fast) |
154 { | 155 { |
155 struct stat st; | 156 struct stat st; |
156 char path[1024]; | 157 char path[1024]; |
157 | 158 |
158 mail_storage_clear_error(storage); | 159 mail_storage_clear_error(storage); |
159 | 160 |
160 name = inbox_fix_case(storage, name); | 161 name = inbox_fix_case(storage, name); |
161 if (strcmp(name, "INBOX") == 0) { | 162 if (strcmp(name, "INBOX") == 0) { |
162 if (!verify_inbox(storage, storage->dir)) | 163 if (!verify_inbox(storage, storage->dir)) |
163 return NULL; | 164 return NULL; |
164 return maildir_open(storage, "INBOX", readonly); | 165 return maildir_open(storage, "INBOX", readonly, fast); |
165 } | 166 } |
166 | 167 |
167 if (!maildir_is_valid_name(storage, name)) { | 168 if (!maildir_is_valid_name(storage, name)) { |
168 mail_storage_set_error(storage, "Invalid mailbox name"); | 169 mail_storage_set_error(storage, "Invalid mailbox name"); |
169 return FALSE; | 170 return FALSE; |
172 i_snprintf(path, sizeof(path), "%s/.%s", storage->dir, name); | 173 i_snprintf(path, sizeof(path), "%s/.%s", storage->dir, name); |
173 if (stat(path, &st) == 0) { | 174 if (stat(path, &st) == 0) { |
174 /* exists - make sure the required directories are also there */ | 175 /* exists - make sure the required directories are also there */ |
175 (void)create_maildir(path, TRUE); | 176 (void)create_maildir(path, TRUE); |
176 | 177 |
177 return maildir_open(storage, name, readonly); | 178 return maildir_open(storage, name, readonly, fast); |
178 } else if (errno == ENOENT) { | 179 } else if (errno == ENOENT) { |
179 mail_storage_set_error(storage, "Mailbox doesn't exist: %s", | 180 mail_storage_set_error(storage, "Mailbox doesn't exist: %s", |
180 name); | 181 name); |
181 return NULL; | 182 return NULL; |
182 } else { | 183 } else { |