Possible the attached patch can help you.

It's only for unix format. So you can use patched UW-POP3 instead Qpopper but
can't move to MIX format right now.

You will able to do it in future when:

1) Мost of X-UIDL messages will be pruned from mailboxes by users.
2) A tool that will copy a mailbox into a mix format mailbox with the same
   UID structure as the source mailbox will be created.
http://mailman1.u.washington.edu/pipermail/imap-uw/2006-November/000978.html




Hi,

I am considering moving my IMAP/POP3 users from UW-IMAP/Qpopper to UW-IMAP/UW-POP3 thanks to its cute new MIX format. However, this is going to cause X-UIDL mess in the messages, which in turn will cause re-downloading of messages left on the POP3 server.

Dovecot 1.0 has a neat feature "pop3_reuse_xuidl = yes" which if set will use the contents of the (first) X-UIDL header, if it exists, instead of the result of expanding pop3_uidl_format. It will use pop3_uidl_format if there is no X-UIDL header. (But for various other reasons I'd still prefer to stick with UW.)

I couldn't find anything like this with UW-IMAP... any idea how to make this transition smooth?


Thanks in advance for replies!

_______________________________________________
Imap-uw mailing list
Imap-uw@u.washington.edu
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

#----------------------------------------------------
# diff -u imap-2006e/src/c-client/mail.c src/c-client/mail.c
--- imap-2006e/src/c-client/mail.c      Wed Jan 10 04:01:57 2007
+++ src/c-client/mail.c Fri Feb  9 11:13:46 2007
@@ -5781,6 +5781,8 @@
     mail_gc_msg (&(*elt)->private.msg,GC_ENV | GC_TEXTS);
     if (mailfreeeltsparep && (*elt)->sparep)
       (*mailfreeeltsparep) (&(*elt)->sparep);
+    if ((*elt)->private.xuidl)
+      fs_give ((void **) &(*elt)->private.xuidl);
     fs_give ((void **) elt);
   }
   else *elt = NIL;             /* else simply drop pointer */
#----------------------------------------------------
# diff -u imap-2006e/src/c-client/mail.h src/c-client/mail.h
--- imap-2006e/src/c-client/mail.h      Fri Jan 19 03:57:37 2007
+++ src/c-client/mail.h Fri Feb  9 11:13:46 2007
@@ -812,6 +819,7 @@
     unsigned long mod;         /* modseq */
     PARTTEXT special;          /* special text pointers */
     MESSAGE msg;               /* internal message pointers */
+    char *xuidl;               /* QPOPPER's X-UIDL */
     union {                    /* driver internal use */
       unsigned long data;
       void *ptr;
#----------------------------------------------------
# diff -u imap-2006e/src/ipopd/ipop3d.c src/ipopd/ipop3d.c
--- imap-2006e/src/ipopd/ipop3d.c       Tue Dec 19 02:19:59 2006
+++ src/ipopd/ipop3d.c  Fri Feb  9 11:13:47 2007
@@ -99,6 +99,19 @@
 long blat (char *text,long lines,unsigned long size,STRING *st);
 void rset ();
 
+void fill_uidl(char buf[], size_t buf_size, unsigned long i)
+{
+  MESSAGECACHE *elt = mail_elt(stream, msg[i]);
+
+  if (elt && elt->private.xuidl && elt->private.xuidl[0]) {
+    snprintf(buf, buf_size, "%lu %s\015\012",
+             i, elt->private.xuidl);
+  } else {
+    snprintf(buf, buf_size, "%lu %08lx%08lx\015\012",
+             i, stream->uid_validity, mail_uid(stream, msg[i]));
+  }
+}
+
 /* Main program */
 
 int main (int argc,char *argv[])
@@ -323,8 +345,8 @@
        else if (!strcmp (s,"UIDL")) {
          if (t && *t) {        /* argument do single message */
            if ((i = strtoul (t,NIL,10)) && (i <= nmsgs) && (msg[i] > 0)) {
-             sprintf (tmp,"+OK %lu %08lx%08lx\015\012",i,stream->uid_validity,
-                      mail_uid (stream,msg[i]));
+             sprintf (tmp,"+OK ");
+              fill_uidl(tmp + 4, sizeof(tmp) - 4, i);
              PSOUT (tmp);
            }
            else PSOUT ("-ERR No such message\015\012");
@@ -332,8 +354,7 @@
          else {                /* entire mailbox */
            PSOUT ("+OK Unique-ID listing follows\015\012");
            for (i = 1,j = 0,k = 0; i <= nmsgs; i++) if (msg[i] > 0) {
-             sprintf (tmp,"%lu %08lx%08lx\015\012",i,stream->uid_validity,
-                      mail_uid (stream,msg[i]));
+              fill_uidl(tmp, sizeof(tmp), i);
              PSOUT (tmp);
            }
            PBOUT ('.');        /* end of list */
#----------------------------------------------------
# diff -u imap-2006e/src/osdep/unix/unix.c src/osdep/unix/unix.c
--- imap-2006e/src/osdep/unix/unix.c    Thu Dec 21 10:07:25 2006
+++ src/osdep/unix/unix.c       Fri Feb  9 11:13:48 2007
@@ -1669,6 +1669,33 @@
                }
                break;
              }
+
+                               /* possible X-UIDL */
+             else if (s[2] == 'U' && s[3] == 'I' && s[4] == 'D' && s[5] == 'L' 
&&
+                      s[6] == ':') {
+
+               if (!elt->private.xuidl) {
+                 int len_xuidl;
+                 char *pb, *p;
+
+                 pb = s + 7;   /* advance to UIDL value */
+                               /* flush whitespace */
+                 while (*pb == ' ') pb++;
+
+                 for (p = pb ; *p >= 0x21 && *p <= 0x7E ; p++)
+                   ;
+
+                 len_xuidl = p - pb;
+
+                 if (len_xuidl >= 12 && len_xuidl <= 33) {
+                   elt->private.xuidl = (char *)fs_get(len_xuidl + 1);
+                   strncpy(elt->private.xuidl, pb, len_xuidl);
+                   elt->private.xuidl[len_xuidl] = 0;
+                 }
+               } else {
+                 elt->private.xuidl[0] = 0;
+               }
+             }
            }
                                /* otherwise fall into S case */
 
#----------------------------------------------------
_______________________________________________
Imap-uw mailing list
Imap-uw@u.washington.edu
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to