From d71e8ab63e794cae4bfbcd5e9ea8d585ed6f8583 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 5 Feb 2009 11:54:53 -0500 Subject: [PATCH] pop3: Fix to previous changes: Update \Seen flags even when not using QUIT. --HG-- branch : HEAD --- src/pop3/client.c | 3 +++ src/pop3/client.h | 1 + src/pop3/commands.c | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) 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."); -- 2.47.3