Sam,
Attached to this message is a small patch for imapd.c in courier-0.36.1.
It could be categorised as a slight usability improvement patch. It
gives the user faster feedback if new mail has arrived at the point
where the client is commanding the server to enter IDLE mode, instead of
having to wait until the IDLE loop times out. I know, it's not as if
your life was at stake, but why not give the user the smallest of favors? :)
It's been running on my production systems for the last 8 months or so
without any problem. My systems is running Debian Potato i386, soon to
be upgraded to Woody (which already runs in my production test environment).
Regards, Tomas
<NOTE>
For some reason the major part of the code being replaced (marked "@@
-1379,25 +1420,32 @@") was using space instead of tab and was slightly
misaligned with one space missing.
I'm afraid it originates from my original IDLE patch. There is a similar
space-instead-of-tab section at the imapidle() function body which
probably also was part of that same IDLE patch. Just wanted to give you
a hint if you haven't noticed it before. The code format in general
seems to be using tabs, correct me if I'm wrong...
</NOTE>
--- ./imap/imapd.c- Wed Nov 14 05:14:51 2001
+++ ./imap/imapd.c Mon Jan 7 19:57:30 2002
@@ -1077,6 +1085,7 @@
const int idleTimeout = envp ? atoi(envp) : 60;
writes("+ entering idle mode\r\n");
+ noop();
writeflush();
while (!doidle(idleTimeout))
{
@@ -1379,25 +1420,32 @@
writes(" OK NOOP completed\r\n");
return (0);
}
- if (strcmp(curtoken->tokenbuf, "IDLE") == 0)
- {
- if (nexttoken()->tokentype != IT_EOL) return (-1);
- if (current_mailbox)
- {
- read_eol();
- imapidle();
- curtoken=nexttoken();
- if (strcmp(curtoken->tokenbuf, "DONE") == 0)
- {
- if (current_mailbox)
- noop();
- writes(tag);
- writes(" OK IDLE completed\r\n");
- return (0);
- }
- }
- return (-1);
- }
+ if (strcmp(curtoken->tokenbuf, "IDLE") == 0)
+ {
+ if (nexttoken()->tokentype != IT_EOL) return (-1);
+ if (!current_mailbox)
+ {
+ char * p=decode_valid_mailbox("inbox",1);
+ if (imapscan_maildir(¤t_mailbox_info, p, 1, 1))
+ {
+ free(p);
+ return (-1);
+ }
+ current_mailbox=p;
+ }
+ read_eol();
+ imapidle();
+ curtoken=nexttoken();
+ if (strcmp(curtoken->tokenbuf, "DONE") == 0)
+ {
+ if (current_mailbox)
+ noop();
+ writes(tag);
+ writes(" OK IDLE completed\r\n");
+ return (0);
+ }
+ return (-1);
+ }
if (strcmp(curtoken->tokenbuf, "LOGOUT") == 0)
{
if (nexttoken()->tokentype != IT_EOL) return (-1);