--- /home/chris/Temp/mailwatch-mailbox-imap.c.orig 2006-08-16 08:42:21.000000000 +0100 +++ /home/chris/Temp/mailwatch-mailbox-imap.c 2006-08-16 08:42:21.000000000 +0100 @@ -595,11 +595,21 @@ buf_extra[(BUFSIZE + 1) * i] = 0; g_snprintf(tmp, 64, "%05d OK", imailbox->imap_tag); - if(!strstr(buf_extra, tmp)) { + +//clw - We seem to get the expected response with no new messages but +//clw - when there are new messages we don't get the "nnnnn OK SEARCH completed" bit +//clw - but only get "* SEARCH n1 n2..." +//clw - code changed to try to cope with this: + +//clw - line 607 added (expected response, no new messages, so return 0) +//clw - line 608 - changed to match on "* SEARCH" instead of "tmp" (we have new messages) + + if(strstr(buf_extra, "OK SEARCH completed")) return 0; + if(!strstr(buf_extra, "* SEARCH")) { xfce_mailwatch_log_message(imailbox->mailwatch, XFCE_MAILWATCH_MAILBOX(imailbox), XFCE_MAILWATCH_LOG_WARNING, - _("The IMAP server returned a response we weren't quite expecting. This might be OK, or this plugin might need to be modified to support your mail server if the new message counts are incorrect.")); + _("The IMAP server returned a response we weren't quite expecting.")); g_warning("Mailwatch: Odd response to SEARCH UNSEEN"); } p = strstr(buf_extra, "* SEARCH"); @@ -612,14 +622,22 @@ p += 8; /* find the end of the line */ - q = strstr(p, "\r"); - if(!q) - q = strstr(p, "\n"); - if(!q) { - g_free(buf_extra); - return 0; - } - *q = 0; + +//clw - lines 628 to 635 commented out (we don't seem to have a proper end of line in reply) + + //q = strstr(p, "\r"); + //if(!q) + // q = strstr(p, "\n"); + //if(!q) { + // g_free(buf_extra); + // return 0; + //} + //*q = 0; + +//clw - line 639 added (we don't have a proper end of line, so use length returned by imap_recv) + + p[bin] = 0; + DBG(" ok, we have a list of messages: '%s'", p); /* find each space in the string; that's a message */