]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Fixed pop3.order caching for mails without no specified order.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 15 Mar 2016 22:30:20 +0000 (09:30 +1100)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 16 Mar 2016 00:02:41 +0000 (11:02 +1100)
src/lib-storage/index/dbox-common/dbox-mail.c

index 3cfe90bba6916a1904f236ad75b7d641ab1e206a..ddd93bdaa61dda53672985ab0262fe45708d2d0c 100644 (file)
@@ -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;