From: Timo Sirainen Date: Thu, 5 Feb 2009 16:54:53 +0000 (-0500) Subject: pop3: Fix to previous changes: Update \Seen flags even when not using QUIT. X-Git-Tag: 1.2.beta1~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d71e8ab63e794cae4bfbcd5e9ea8d585ed6f8583;p=thirdparty%2Fdovecot%2Fcore.git pop3: Fix to previous changes: Update \Seen flags even when not using QUIT. --HG-- branch : HEAD --- diff --git a/src/pop3/client.c b/src/pop3/client.c index ff3599ffa0..77b10c3064 100644 --- a/src/pop3/client.c +++ b/src/pop3/client.c @@ -272,6 +272,9 @@ static const char *client_get_disconnect_reason(struct client *client) void client_destroy(struct client *client, const char *reason) { + if (client->seen_change_count > 0) + client_update_mails(client); + if (!client->disconnected) { if (reason == NULL) reason = client_get_disconnect_reason(client); diff --git a/src/pop3/client.h b/src/pop3/client.h index e2bcef55b4..da08deeec5 100644 --- a/src/pop3/client.h +++ b/src/pop3/client.h @@ -66,6 +66,7 @@ int client_send_line(struct client *client, const char *fmt, ...) void client_send_storage_error(struct client *client); bool client_handle_input(struct client *client); +bool client_update_mails(struct client *client); void clients_init(void); void clients_deinit(void); diff --git a/src/pop3/commands.c b/src/pop3/commands.c index bb78194073..4759b7a431 100644 --- a/src/pop3/commands.c +++ b/src/pop3/commands.c @@ -195,7 +195,7 @@ pop3_search_build(struct client *client, uint32_t seq) return search_args; } -static bool update_mails(struct client *client) +bool client_update_mails(struct client *client) { struct mail_search_args *search_args; struct mail_search_context *ctx; @@ -226,13 +226,14 @@ static bool update_mails(struct client *client) } mail_free(&mail); + client->seen_change_count = 0; return mailbox_search_deinit(&ctx) == 0; } static int cmd_quit(struct client *client, const char *args ATTR_UNUSED) { if (client->deleted || client->seen_bitmask != NULL) { - if (!update_mails(client)) { + if (!client_update_mails(client)) { client_send_storage_error(client); client_disconnect(client, "Storage error during logout.");