summaryrefslogtreecommitdiff
blob: a2d4c1efc8cfdab3231d167a5ef19d1d3a82ba62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
http://dev.mutt.org/trac/changeset/a2a4286491b4
http://dev.mutt.org/trac/ticket/3296

Harmonize hcache uidvalidity size to unsigned int (per IMAP RFC).
Closes #3296.


Index: hcache.c
===================================================================
--- hcache.c (revision 5986:848f08512bf3)
+++ hcache.c (revision 6002:a2a4286491b4)
@@ -87,5 +87,5 @@
 {
   struct timeval timeval;
-  unsigned long uid_validity;
+  unsigned int uidvalidity;
 } validate;
 
@@ -590,5 +590,5 @@
 static void *
 mutt_hcache_dump(header_cache_t *h, HEADER * header, int *off,
-		 unsigned long uid_validity)
+		 unsigned int uidvalidity)
 {
   unsigned char *d = NULL;
@@ -599,6 +599,6 @@
   d = lazy_malloc(sizeof (validate));
 
-  if (uid_validity)
-    memcpy(d, &uid_validity, sizeof (unsigned long));
+  if (uidvalidity)
+    memcpy(d, &uidvalidity, sizeof (uidvalidity));
   else
   {
@@ -759,5 +759,5 @@
 int
 mutt_hcache_store(header_cache_t *h, const char *filename, HEADER * header,
-		  unsigned long uid_validity,
+		  unsigned int uidvalidity,
 		  size_t(*keylen) (const char *fn))
 {
@@ -769,5 +769,5 @@
     return -1;
   
-  data = mutt_hcache_dump(h, header, &dlen, uid_validity);
+  data = mutt_hcache_dump(h, header, &dlen, uidvalidity);
   ret = mutt_hcache_store_raw (h, filename, data, dlen, keylen);
   
Index: hcache.h
===================================================================
--- hcache.h (revision 5224:010084b62288)
+++ hcache.h (revision 6002:a2a4286491b4)
@@ -34,6 +34,7 @@
 void *mutt_hcache_fetch_raw (header_cache_t *h, const char *filename,
                              size_t (*keylen)(const char *fn));
+/* uidvalidity is an IMAP-specific unsigned 32 bit number */
 int mutt_hcache_store(header_cache_t *h, const char *filename, HEADER *header,
-                      unsigned long uid_validity, size_t (*keylen)(const char *fn));
+                      unsigned int uidvalidity, size_t (*keylen)(const char *fn));
 int mutt_hcache_store_raw (header_cache_t *h, const char* filename, void* data,
                            size_t dlen, size_t(*keylen) (const char* fn));
Index: imap/util.c
===================================================================
--- imap/util.c (revision 5957:ecea9568202f)
+++ imap/util.c (revision 6002:a2a4286491b4)
@@ -130,4 +130,6 @@
     if (*uv == idata->uid_validity)
       h = mutt_hcache_restore ((unsigned char*)uv, NULL);
+    else
+      dprint (3, (debugfile, "hcache uidvalidity mismatch: %u", *uv));
     FREE (&uv);
   }