diff --git a/TODO b/TODO index 9fc1131..5987c2d 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,6 @@ add support for syncing with other: and shared: via NAMESPACE finish implementing --quiet + +isync gets confused when new mail is delivered while in the middle of an +IMAP session. need to handled those asynchronous notifications properly. diff --git a/configure.in b/configure.in index 6c75549..6d05ede 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(isync.h) -AM_INIT_AUTOMAKE(isync,0.5) +AM_INIT_AUTOMAKE(isync,0.6) AM_PROG_CC_STDC if test $CC = gcc; then CFLAGS="$CFLAGS -pipe" diff --git a/imap.c b/imap.c index cc92283..0e8f0d6 100644 --- a/imap.c +++ b/imap.c @@ -421,7 +421,10 @@ imap_exec (imap_t * imap, const char *fmt, ...) snprintf (buf, sizeof (buf), "%d %s\r\n", ++Tag, tmp); if (Verbose) + { + fputs (">>> ", stdout); fputs (buf, stdout); + } n = socket_write (imap->sock, buf, strlen (buf)); if (n <= 0) { @@ -880,7 +883,22 @@ imap_fetch_message (imap_t * imap, unsigned int uid, int fd) next_arg (&cmd); /* * */ next_arg (&cmd); /* */ - next_arg (&cmd); /* FETCH */ + arg = next_arg (&cmd); /* FETCH */ + + if (strcasecmp ("FETCH", arg) != 0) + { + /* this is likely an untagged response, such as when new + * mail arrives in the middle of the session. just skip + * it for now. + * + * eg., + * "* 4000 EXISTS" + * "* 2 RECENT" + * + */ + printf ("skipping untagged response: %s\n", arg); + continue; + } while ((arg = next_arg (&cmd)) && *arg != '{') ; diff --git a/isync.1 b/isync.1 index 8715f62..cfff57d 100644 --- a/isync.1 +++ b/isync.1 @@ -282,6 +282,13 @@ mailbox rather than the :info field. When synchronizing multiple mailboxes on the same IMAP server, it is not possible to select different SSL options for each mailbox. Only the options from the first mailbox are applied since the SSL session is reused. +.P +If new mail arrives in the IMAP mailbox after +.B isync +has retrieved the initial message list, the new mail will not be fetched +until the next time +.B isync +is invoked. .SH SEE ALSO mutt(1), maildir(5) .P