From baa93d5ed7c015309dc51aa238f8d0c79561121f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 16 Mar 2016 09:30:20 +1100 Subject: [PATCH] dbox: Fixed pop3.order caching for mails without no specified order. --- src/lib-storage/index/dbox-common/dbox-mail.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib-storage/index/dbox-common/dbox-mail.c b/src/lib-storage/index/dbox-common/dbox-mail.c index 3cfe90bba6..ddd93bdaa6 100644 --- a/src/lib-storage/index/dbox-common/dbox-mail.c +++ b/src/lib-storage/index/dbox-common/dbox-mail.c @@ -182,7 +182,15 @@ dbox_get_cached_metadata(struct dbox_mail *mail, enum dbox_metadata_key key, i_assert(str_len(str) == sizeof(order)); memcpy(&order, str_data(str), sizeof(order)); str_truncate(str, 0); - str_printfa(str, "%u", order); + if (order != 0) + str_printfa(str, "%u", order); + else { + /* order=0 means it doesn't exist. we don't + want to return "0" though, because then the + mails get ordered to beginning, while + nonexistent are supposed to be ordered at + the end. */ + } } *value_r = str_c(str); return 0;