]> granicus.if.org Git - neomutt/commitdiff
Parse IMAP responses locale- and case- insensitive. From Brendan
authorThomas Roessler <roessler@does-not-exist.org>
Sun, 13 Jan 2002 21:16:34 +0000 (21:16 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sun, 13 Jan 2002 21:16:34 +0000 (21:16 +0000)
Cully.

imap/auth_sasl.c
imap/browse.c
imap/command.c
imap/imap.c
imap/message.c
imap/util.c

index 5c54f5dc7128299efdfb4f74df9488f55967f837..c8e656edfa1910b6aa1f88d679d397e0e1846e2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2000-1 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 2000-2 Brendan Cully <brendan@kublai.com>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method)
 
     if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
        (!idata->conn->account.user[0] ||
-        !mutt_strncmp (idata->conn->account.user, "anonymous", 9)))
+        !ascii_strncmp (idata->conn->account.user, "anonymous", 9)))
       rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, NULL, &pc, &olen,
                              &mech);
   }
index 846fc4bc175f0e7d0dedf6dbdb5cb63a3d7dbccf..f5af8922ae4156eaf1b121b153a3b207983cb507 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ int imap_browse (char* path, struct browser_state* state)
           }
         }
       }
-      while (mutt_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN));
+      while (ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN));
     }
 
     /* if we're descending a folder, mark it as current in browser_state */
@@ -335,7 +335,7 @@ static int browse_add_list_result (IMAP_DATA* idata, const char* cmd,
           isparent);
     }
   }
-  while ((mutt_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
+  while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
 
   FREE (&mx.mbox);
   return 0;
@@ -439,7 +439,7 @@ static int browse_get_namespace (IMAP_DATA* idata, char* nsbuf, int nsblen,
       for (type = IMAP_NS_PERSONAL; *s; type++)
       {
        s = imap_next_word (s);
-       if (*s && strncmp (s, "NIL", 3))
+       if (ascii_strncasecmp (s, "NIL", 3))
        {
          s++;
          while (*s && *s != ')')
@@ -545,7 +545,7 @@ static int browse_verify_namespace (IMAP_DATA* idata,
        return -1;
       nsi->listable |= (name != NULL);
     }
-    while ((mutt_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
+    while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
   }
 
   return 0;
index ed01d432df6c3d66a53f40d4b6dcdb7d8ea458ef..2d475bf6f3371a59d5bba7e894bc41b84e5de96d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
  * Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -135,18 +135,18 @@ int imap_cmd_step (IMAP_DATA* idata)
   }
   
   /* handle untagged messages. The caller still gets its shot afterwards. */
-  if (!strncmp (cmd->buf, "* ", 2) &&
+  if (!ascii_strncmp (cmd->buf, "* ", 2) &&
       cmd_handle_untagged (idata))
     return IMAP_CMD_BAD;
 
   /* server demands a continuation response from us */
-  if (!strncmp (cmd->buf, "+ ", 2))
+  if (!ascii_strncmp (cmd->buf, "+ ", 2))
   {
     return IMAP_CMD_RESPOND;
   }
 
   /* tagged completion code */
-  if (!mutt_strncmp (cmd->buf, cmd->seq, SEQLEN))
+  if (!ascii_strncmp (cmd->buf, cmd->seq, SEQLEN))
   {
     imap_cmd_finish (idata);
     return imap_code (cmd->buf) ? IMAP_CMD_OK : IMAP_CMD_NO;
index 1998e2bfc98973ffb29a06055f2c30829254d0c6..3059d7ac7852eb3279a250bc34e447f6ddbb6964 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
  * Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -378,7 +378,7 @@ int imap_open_connection (IMAP_DATA* idata)
   if (imap_cmd_step (idata) != IMAP_CMD_CONTINUE)
     goto bail;
 
-  if (mutt_strncmp ("* OK", idata->cmd.buf, 4) == 0)
+  if (ascii_strncasecmp ("* OK", idata->cmd.buf, 4) == 0)
   {
     /* TODO: Parse new tagged CAPABILITY data (* OK [CAPABILITY...]) */
     if (imap_check_capabilities (idata))
@@ -419,7 +419,7 @@ int imap_open_connection (IMAP_DATA* idata)
       dprint (2, (debugfile, "Communication encrypted at %d bits\n",
        idata->conn->ssf));
   }
-  else if (mutt_strncmp ("* PREAUTH", idata->cmd.buf, 9) == 0)
+  else if (ascii_strncasecmp ("* PREAUTH", idata->cmd.buf, 9) == 0)
   {
     if (imap_check_capabilities (idata) != 0)
       goto bail;
@@ -613,7 +613,7 @@ int imap_open_mailbox (CONTEXT* ctx)
     goto fail;
 
   /* check for READ-ONLY notification */
-  if (!strncmp (imap_get_qualifier (idata->cmd.buf), "[READ-ONLY]", 11))
+  if (!ascii_strncasecmp (imap_get_qualifier (idata->cmd.buf), "[READ-ONLY]", 11))
   {
     dprint (2, (debugfile, "Mailbox is read-only.\n"));
     ctx->readonly = 1;
@@ -1183,7 +1183,7 @@ int imap_mailbox_check (char* path, int new)
    */
 
   if (mutt_strcmp (mbox_unquoted, idata->mailbox) == 0
-      || (mutt_strcasecmp (mbox_unquoted, "INBOX") == 0
+      || (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0
          && mutt_strcasecmp (mbox_unquoted, idata->mailbox) == 0))
   {
     strfcpy (buf, "NOOP", sizeof (buf));
@@ -1289,7 +1289,7 @@ int imap_parse_list_response(IMAP_DATA* idata, char **name, int *noselect,
       return 0;
     s = imap_next_word (s); /* delim */
     /* Reset the delimiter, this can change */
-    if (strncmp (s, "NIL", 3))
+    if (ascii_strncmp (s, "NIL", 3))
     {
       if (s && s[0] == '\"' && s[1] && s[2] == '\"')
        *delim = s[1];
@@ -1434,7 +1434,7 @@ int imap_complete(char* dest, size_t dlen, char* path) {
       completions++;
     }
   }
-  while (mutt_strncmp(idata->cmd.seq, idata->cmd.buf, SEQLEN));
+  while (ascii_strncmp(idata->cmd.seq, idata->cmd.buf, SEQLEN));
 
   if (completions)
   {
index 62510b0c18b6bf7a7a1d33d8735ede674573f8be..65b74bd8c6c84497d296f8a2eb4fccd7279e247b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -591,7 +591,7 @@ int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete)
   if (rc == -2)
   {
     /* bail out if command failed for reasons other than nonexistent target */
-    if (strncmp (imap_get_qualifier (idata->cmd.buf), "[TRYCREATE]", 11))
+    if (ascii_strncasecmp (imap_get_qualifier (idata->cmd.buf), "[TRYCREATE]", 11))
     {
       imap_error ("imap_copy_messages", idata->cmd.buf);
       goto fail;
index bb7ff16f9430d795214dbee611b7cb3258a492aa..d5002a7bd3cf5bf0a7c3ef24f3809695d26478e1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
  * Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -152,7 +152,7 @@ int imap_parse_path (const char* path, IMAP_MBOX* mx)
        mx->account.flags |= M_ACCT_PORT;
       if (sscanf (tmp, "/%s", tmp) == 1)
       {
-       if (!strncmp (tmp, "ssl", 3))
+       if (!ascii_strncmp (tmp, "ssl", 3))
          mx->account.flags |= M_ACCT_SSL;
        else
        {