<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] Fix CAPABILITY handling for IMAP



On Saturday, 05 August 2006 at 11:20, Rocco Rutte wrote:
> Hi,
> 
> * Brendan Cully [06-08-04 17:43:25 -0700] wrote:
> 
> >Mutt just wasn't checking for capabilities on tagged responses. Does
> >the following patch work for you?
> 
> Yes, thanks. But know it's parsing the initial CAPA twice.

How about this one then?
? cscope.out
Index: imap/command.c
===================================================================
RCS file: /home/roessler/cvs/mutt/imap/command.c,v
retrieving revision 3.40
diff -u -p -r3.40 command.c
--- imap/command.c      6 Jul 2006 18:18:31 -0000       3.40
+++ imap/command.c      5 Aug 2006 21:20:13 -0000
@@ -167,8 +167,9 @@ int imap_cmd_step (IMAP_DATA* idata)
   idata->lastread = time (NULL);
 
   /* handle untagged messages. The caller still gets its shot afterwards. */
-  if (!ascii_strncmp (idata->buf, "* ", 2) &&
-      cmd_handle_untagged (idata))
+  if ((!ascii_strncmp (idata->buf, "* ", 2)
+       || !ascii_strncmp (imap_next_word (idata->buf), "OK [", 4))
+      && cmd_handle_untagged (idata))
     return IMAP_CMD_BAD;
 
   /* server demands a continuation response from us */
@@ -365,6 +366,7 @@ static int cmd_handle_untagged (IMAP_DAT
   int count;
 
   s = imap_next_word (idata->buf);
+  pn = imap_next_word (s);
 
   if ((idata->state >= IMAP_SELECTED) && isdigit ((unsigned char) *s))
   {
@@ -417,7 +419,9 @@ static int cmd_handle_untagged (IMAP_DAT
   else if (ascii_strncasecmp ("CAPABILITY", s, 10) == 0)
     cmd_parse_capability (idata, s);
   else if (!ascii_strncasecmp ("OK [CAPABILITY", s, 14))
-    cmd_parse_capability (idata, imap_next_word (s));
+    cmd_parse_capability (idata, pn);
+  else if (!ascii_strncasecmp ("OK [CAPABILITY", pn, 14))
+    cmd_parse_capability (idata, imap_next_word (pn));
   else if (ascii_strncasecmp ("LIST", s, 4) == 0)
     cmd_parse_list (idata, s);
   else if (ascii_strncasecmp ("LSUB", s, 4) == 0)

Attachment: pgpMbhabgAwIO.pgp
Description: PGP signature