Always return EXIST and RECENT untagged responses. Thanks Simon Josefsson <jas@e…
…xtundo.com> for reporting.
Showing
1 changed file
with
9 additions
and
6 deletions
... | @@ -30,6 +30,7 @@ struct _uid_table | ... | @@ -30,6 +30,7 @@ struct _uid_table |
30 | 30 | ||
31 | static struct _uid_table *uid_table; | 31 | static struct _uid_table *uid_table; |
32 | static size_t uid_table_count; | 32 | static size_t uid_table_count; |
33 | static int uid_table_loaded; | ||
33 | 34 | ||
34 | static void | 35 | static void |
35 | add_flag (char **pbuf, const char *f) | 36 | add_flag (char **pbuf, const char *f) |
... | @@ -160,6 +161,7 @@ free_uids (void) | ... | @@ -160,6 +161,7 @@ free_uids (void) |
160 | uid_table = NULL; | 161 | uid_table = NULL; |
161 | } | 162 | } |
162 | uid_table_count = 0; | 163 | uid_table_count = 0; |
164 | uid_table_loaded = 0; | ||
163 | } | 165 | } |
164 | 166 | ||
165 | static void | 167 | static void |
... | @@ -199,6 +201,7 @@ reset_uids (void) | ... | @@ -199,6 +201,7 @@ reset_uids (void) |
199 | attribute_copy (uid_table[uid_table_count].attr, attr); | 201 | attribute_copy (uid_table[uid_table_count].attr, attr); |
200 | uid_table_count++; | 202 | uid_table_count++; |
201 | } | 203 | } |
204 | uid_table_loaded = 1; | ||
202 | } | 205 | } |
203 | 206 | ||
204 | static void | 207 | static void |
... | @@ -206,6 +209,7 @@ notify (void) | ... | @@ -206,6 +209,7 @@ notify (void) |
206 | { | 209 | { |
207 | size_t total = 0; | 210 | size_t total = 0; |
208 | int reset = 0; | 211 | int reset = 0; |
212 | size_t recent = 0; | ||
209 | 213 | ||
210 | mailbox_messages_count (mbox, &total); | 214 | mailbox_messages_count (mbox, &total); |
211 | 215 | ||
... | @@ -218,7 +222,6 @@ notify (void) | ... | @@ -218,7 +222,6 @@ notify (void) |
218 | if (uid_table) | 222 | if (uid_table) |
219 | { | 223 | { |
220 | size_t i; | 224 | size_t i; |
221 | size_t recent = 0; | ||
222 | 225 | ||
223 | for (i = 1; i <= total; i++) | 226 | for (i = 1; i <= total; i++) |
224 | { | 227 | { |
... | @@ -229,12 +232,12 @@ notify (void) | ... | @@ -229,12 +232,12 @@ notify (void) |
229 | notify_uid (uid); | 232 | notify_uid (uid); |
230 | } | 233 | } |
231 | notify_deleted (); | 234 | notify_deleted (); |
232 | util_out (RESP_NONE, "%d EXISTS", total); | ||
233 | mailbox_messages_recent (mbox, &recent); | 235 | mailbox_messages_recent (mbox, &recent); |
234 | if (recent) | ||
235 | util_out (RESP_NONE, "%d RECENT", recent); | ||
236 | } | 236 | } |
237 | 237 | ||
238 | util_out (RESP_NONE, "%d EXISTS", total); | ||
239 | util_out (RESP_NONE, "%d RECENT", recent); | ||
240 | |||
238 | if (!reset) | 241 | if (!reset) |
239 | reset_uids (); | 242 | reset_uids (); |
240 | else | 243 | else |
... | @@ -271,12 +274,12 @@ imap4d_sync_flags (size_t msgno) | ... | @@ -271,12 +274,12 @@ imap4d_sync_flags (size_t msgno) |
271 | int | 274 | int |
272 | imap4d_sync (void) | 275 | imap4d_sync (void) |
273 | { | 276 | { |
274 | /* If mbox --> NULL, it means to free all the ressources. | 277 | /* If mbox --> NULL, it means to free all the resources. |
275 | It may be because of close or before select/examine a new mailbox. | 278 | It may be because of close or before select/examine a new mailbox. |
276 | If it was a close we do not send any notification. */ | 279 | If it was a close we do not send any notification. */ |
277 | if (mbox == NULL) | 280 | if (mbox == NULL) |
278 | free_uids (); | 281 | free_uids (); |
279 | else if (uid_table == NULL || !mailbox_is_updated (mbox)) | 282 | else if (!uid_table_loaded || !mailbox_is_updated (mbox)) |
280 | notify (); | 283 | notify (); |
281 | else | 284 | else |
282 | { | 285 | { | ... | ... |
-
Please register or sign in to post a comment