Jeff Tucker writes:

The only way an old-style UIDL (filename) will be printed is if the uid.n field in the msglist is zero. So, what I need is a msglist with all these current existing messages to have a uid.n of 0. The only way I can see that happening is if the system noticed that it was started with no courierpop3dsizelist file and created one using the special rule that uid.n was set to zero for all existing files. All new files can have an incrementing uid.n field. This might break other logic, though.

I don't think anything will break. Roll back the first patch, and try this one, instead.

I have a feeling that intermediate versions of Courier IMAP created earlier versions of the courierpop3dsizelist file, ones in which the uid.n wasn't printed out. Those versions printed the filename as the UIDL. When this version reads one of those old files, it gets 0 for the uid.n for every filename and saves that when writing out the new-style file. But this version of the software doesn't seem to be able to handle a missing courierpop3dsizelist file.

Yup, I think this is the correct analysis.


Attachment: pgp00000.pgp
Description: PGP signature

diff -U3 -r1.25 pop3dserver.c
--- imap/pop3dserver.c  5 Oct 2003 04:47:50 -0000       1.25
+++ imap/pop3dserver.c  9 Oct 2003 02:04:57 -0000
@@ -105,6 +105,7 @@
 static unsigned long retr_count=0;
 
 static unsigned long uidv=0;
+static int convert_v0=0;
 
 /*
 ** The RFC is pretty strict in stating that octet size must count the CR
@@ -161,12 +162,17 @@
 
        uidv=time(NULL);
 
+       convert_v0=0;
+
        if (fp == NULL ||
            fgets(linebuf, sizeof(linebuf)-1, fp) == NULL ||
            linebuf[0] != '/' || sscanf(linebuf+1, "%d %lu %lu", &vernum,
                                        uid, &uidv)
            < 2 || (vernum != 1 && vernum != 2))
        {
+               if (fp == NULL)
+                       convert_v0=1;
+
                if (vernum == 0 && fp && fseek(fp, 0L, SEEK_SET) >= 0)
                {
                        /* Old version 0 format courierpop3dsizelist file */
@@ -453,6 +459,9 @@
                        msglist_a[i]->uid.n=nextuid++;
                        msglist_a[i]->uid.uidv=uidv;
                        msglist_a[i]->isnew=1;
+                       if (convert_v0)
+                               msglist_a[i]->uid.n=0;
+
                        calcsize(msglist_a[i]);
                        savesizes=1;
                }      

Attachment: pgp00001.pgp
Description: PGP signature



Reply via email to