From: Sunil S. <sh...@bo...> - 2010-01-14 11:45:30
|
[switching to fetchmail-devel] Hi Matthias, Quoting from Sunil Shetye's mail on Wed, Jan 13, 2010: > I agree that many servers do not send it. Also, fetchmail can and should handle > the counts better. However, in my opinion, the fix from dovecot side should be > trivial. Whereas, the fix from fetchmail side will be non-trivial as a major > rewrite of the imap driver will be required. I was thinking of rewriting the imap driver so that all imap server responses are routed via the imap_ok() function. This is so that all the unexpected 'EXISTS', 'EXPUNGE' responses get trapped properly. This is how it will work: Any imap command will go through this kind of loop: =============================================================================== #define PS_UNTAGGED 30 /* untagged response on imap command (internal use) */ ok = gen_send(sock, "SEARCH UNSEEN"); while ((ok = imap_ok(sock, buf)) == PS_UNTAGGED) { /* if we have reached here, we have got an untagged response not parsable by imap_ok(). */ if ((cp = strstr(buf, "* SEARCH"))) { /* parse the response */ } /* go back to get the remaining response */ } if (ok != 0) { report(stderr, GT_("search for unseen messages failed\n")); return(ok); } =============================================================================== In essence, gen_recv() at many places in imap.c will get replaced by imap_ok(). Are all the above changes okay? Should I start with the changes in imap_getrange() only? imap_getpartialsizes() can be the next function if this works out. -- Sunil Shetye. |