changeset 19927:fa49be8b4835

dbox: Fixed pop3.order caching for mails without no specified order.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 16 Mar 2016 09:30:20 +1100
parents 3a190d74a1ac
children ba0605b83842
files src/lib-storage/index/dbox-common/dbox-mail.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-mail.c	Fri Mar 11 19:03:34 2016 +1300
+++ b/src/lib-storage/index/dbox-common/dbox-mail.c	Wed Mar 16 09:30:20 2016 +1100
@@ -182,7 +182,15 @@
 			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;