Browse Source

always put changed messages in the cur/ subdirectory since they are no

longer new.

don't set \Seen implicitly for messages in the cur/ folder.  Require the S
flag on the message since Mutt will move Old (unread, but not recent)
messges into cur/.
0.9
Michael Elkins 24 years ago
parent
commit
8944538399
  1. 29
      maildir.c
  2. 2
      sync.c

29
maildir.c

@ -195,18 +195,20 @@ maildir_open (const char *path, int fast)
p = *cur; p = *cur;
p->file = strdup (e->d_name); p->file = strdup (e->d_name);
p->uid = -1; p->uid = -1;
p->flags = (count == 1) ? D_SEEN : 0; p->flags = 0;
p->new = (count == 0); p->new = (count == 0);
/* filename format is something like: /* filename format is something like:
* <unique-prefix>.UID<n>:2,<flags> * <unique-prefix>,U=<n>:2,<flags>
* This is completely non-standard, but in order for mail * This is completely non-standard, but in order for mail
* clients to understand the flags, we have to use the * clients to understand the flags, we have to use the
* standard :info as described by the qmail spec * standard :info as described by the qmail spec
*/ */
s = strstr (p->file, "UID"); s = strstr (p->file, ",U=");
if (!s) if (!s)
puts ("Warning, no uid for message"); s = strstr (p->file, "UID");
if (!s)
puts ("Warning, no UID for message");
else else
{ {
p->uid = strtol (s + 3, &s, 10); p->uid = strtol (s + 3, &s, 10);
@ -215,9 +217,16 @@ maildir_open (const char *path, int fast)
m->maxuid = p->uid; m->maxuid = p->uid;
m->maxuidchanged = 1; m->maxuidchanged = 1;
} }
if (*s && *s != ':') /* Courier-IMAP names it files
* unique,S=<size>:info
* so we need to put the UID before the size, hence here
* we check for a comma as a valid terminator as well,
* since the format will be
* unique,U=<uid>,S=<size>:info
*/
if (*s && *s != ':' && *s != ',')
{ {
puts ("warning, unable to parse uid"); puts ("Warning, unable to parse UID");
p->uid = -1; /* reset */ p->uid = -1; /* reset */
} }
} }
@ -352,9 +361,11 @@ maildir_sync (mailbox_t * mbox)
if (p) if (p)
*p = 0; *p = 0;
/* generate new path */ /* generate new path - always put this in the cur/ directory
snprintf (path, sizeof (path), "%s/%s/%s:2,%s%s%s%s", * because its no longer new
mbox->path, (cur->flags & D_SEEN) ? "cur" : "new", */
snprintf (path, sizeof (path), "%s/cur/%s:2,%s%s%s%s",
mbox->path,
cur->file, (cur->flags & D_FLAGGED) ? "F" : "", cur->file, (cur->flags & D_FLAGGED) ? "F" : "",
(cur->flags & D_ANSWERED) ? "R" : "", (cur->flags & D_ANSWERED) ? "R" : "",
(cur->flags & D_SEEN) ? "S" : "", (cur->flags & D_SEEN) ? "S" : "",

2
sync.c

@ -152,7 +152,7 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags, unsigned int max_size)
for (;;) for (;;)
{ {
/* create new file */ /* create new file */
snprintf (path, sizeof (path), "%s/tmp/%s.%ld_%d.%d.UID%d%s", snprintf (path, sizeof (path), "%s/tmp/%s.%ld_%d.%d,U=%d%s",
mbox->path, Hostname, time (0), MaildirCount++, mbox->path, Hostname, time (0), MaildirCount++,
getpid (), cur->uid, suffix); getpid (), cur->uid, suffix);

Loading…
Cancel
Save