From: Timo Sirainen Date: Thu, 19 Dec 2013 02:05:52 +0000 (+0200) Subject: pop3c: Added pop3c_quick_received_date setting. X-Git-Tag: 2.2.10~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f4e547bb810403e8cfb19a49d8fe34713507ffd;p=thirdparty%2Fdovecot%2Fcore.git pop3c: Added pop3c_quick_received_date setting. With this enabled dsync no longer requires calling TOP for each message to get the metadata. --- diff --git a/src/lib-storage/index/pop3c/pop3c-mail.c b/src/lib-storage/index/pop3c/pop3c-mail.c index 78eb02da1f..82cdd8933f 100644 --- a/src/lib-storage/index/pop3c/pop3c-mail.c +++ b/src/lib-storage/index/pop3c/pop3c-mail.c @@ -4,14 +4,22 @@ #include "ioloop.h" #include "istream.h" #include "index-mail.h" +#include "pop3c-settings.h" #include "pop3c-client.h" #include "pop3c-sync.h" #include "pop3c-storage.h" static int pop3c_mail_get_received_date(struct mail *_mail, time_t *date_r) { + struct pop3c_mailbox *mbox = (struct pop3c_mailbox *)_mail->box; int tz; + if (mbox->storage->set->pop3c_quick_received_date) { + /* we don't care about the date, just return the current date */ + *date_r = ioloop_time; + return 0; + } + /* FIXME: we could also parse the first Received: header and get the date from there, but since this code is unlikely to be called except during migration, I don't think it really matters. */ diff --git a/src/lib-storage/index/pop3c/pop3c-settings.c b/src/lib-storage/index/pop3c/pop3c-settings.c index 522e66737b..118c049351 100644 --- a/src/lib-storage/index/pop3c/pop3c-settings.c +++ b/src/lib-storage/index/pop3c/pop3c-settings.c @@ -25,6 +25,7 @@ static const struct setting_define pop3c_setting_defines[] = { DEF(SET_BOOL, pop3c_ssl_verify), DEF(SET_STR, pop3c_rawlog_dir), + DEF(SET_BOOL, pop3c_quick_received_date), SETTING_DEFINE_LIST_END }; @@ -40,7 +41,8 @@ static const struct pop3c_settings pop3c_default_settings = { .pop3c_ssl = "no:pop3s:starttls", .pop3c_ssl_verify = TRUE, - .pop3c_rawlog_dir = "" + .pop3c_rawlog_dir = "", + .pop3c_quick_received_date = FALSE }; static const struct setting_parser_info pop3c_setting_parser_info = { diff --git a/src/lib-storage/index/pop3c/pop3c-settings.h b/src/lib-storage/index/pop3c/pop3c-settings.h index bfd3c6b151..da95131259 100644 --- a/src/lib-storage/index/pop3c/pop3c-settings.h +++ b/src/lib-storage/index/pop3c/pop3c-settings.h @@ -13,6 +13,7 @@ struct pop3c_settings { bool pop3c_ssl_verify; const char *pop3c_rawlog_dir; + bool pop3c_quick_received_date; }; const struct setting_parser_info *pop3c_get_setting_parser_info(void);