and less size_t's
[apps/madmutt.git] / imap / message.c
index 518718f..92afea8 100644 (file)
 #include <lib-lib/ascii.h>
 #include <lib-lib/str.h>
 #include <lib-lib/buffer.h>
+#include <lib-lib/debug.h>
+
+#include <lib-ui/curses.h>
 
 #include "mutt.h"
-#include "mutt_curses.h"
 #include "imap_private.h"
 #include "message.h"
 #include "mx.h"
@@ -35,7 +37,6 @@
 
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include "lib/debug.h"
 
 #if HAVE_STDINT_H
 #include <stdint.h>
@@ -46,7 +47,7 @@
 static void flush_buffer (char *buf, size_t * len, CONNECTION * conn);
 static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf,
                              FILE * fp);
-static int msg_has_flag (LIST * flag_list, const char *flag);
+static int msg_has_flag (string_list_t * flag_list, const char *flag);
 static int msg_parse_fetch (IMAP_HEADER * h, char *s);
 static char *msg_parse_flags (IMAP_HEADER * h, char *s);
 
@@ -73,7 +74,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
   int rc, mfhrc, oldmsgcount;
   int fetchlast = 0;
   const char *want_headers =
-    "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL";
+    "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES string_list_t-POST X-LABEL";
 
 #ifdef USE_HCACHE
   void *hc = NULL;
@@ -183,7 +184,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
                                     ((msgno + 1) >= fetchlast)));
 
       if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) {
-        imap_free_header_data ((void **) &h.data);
+        imap_free_header_data((void *)&h.data);
         fclose (fp);
         mutt_hcache_close (hc);
         return -1;
@@ -326,7 +327,7 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
   int uid;
   int cacheno;
   IMAP_CACHE *cache;
-  int read;
+  int isread;
   int rc;
   progress_t bar;
 
@@ -388,7 +389,7 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
         if (ascii_strncasecmp ("UID", pc, 3) == 0) {
           pc = imap_next_word (pc);
           uid = atoi (pc);
-          if (uid != HEADER_DATA (h)->uid)
+          if (uid != HEADER_DATA(h)->uid)
             mutt_error (_
                         ("The message index is incorrect. Try reopening the mailbox."));
         }
@@ -448,15 +449,15 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
    * the server's notion of 'read' and if it differs from the message info
    * picked up in mutt_read_rfc822_header, we mark the message (and context
    * changed). Another possiblity: ignore Status on IMAP?*/
-  read = h->read;
+  isread = h->read;
   newenv = mutt_read_rfc822_header (msg->fp, h, 0, 0);
   mutt_merge_envelopes(h->env, &newenv);
 
   /* see above. We want the new status in h->read, so we unset it manually
    * and let mutt_set_flag set it correctly, updating context. */
-  if (read != h->read) {
-    h->read = read;
-    mutt_set_flag (ctx, h, M_NEW, read);
+  if (isread != h->read) {
+    h->read = isread;
+    mutt_set_flag (ctx, h, M_NEW, isread);
   }
 
   h->lines = 0;
@@ -757,10 +758,10 @@ fail:
 
 /* imap_add_keywords: concatenate custom IMAP tags to list, if they
  *   appear in the folder flags list. Why wouldn't they? */
-void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags,
+void imap_add_keywords (char *s, HEADER * h, string_list_t * mailbox_flags,
                         size_t slen)
 {
-  LIST *keywords;
+  string_list_t *keywords;
 
   if (!mailbox_flags || !HEADER_DATA (h) || !HEADER_DATA (h)->keywords)
     return;
@@ -780,7 +781,7 @@ void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags,
 void imap_free_header_data (void **data)
 {
   /* this should be safe even if the list wasn't used */
-  mutt_free_list (&(((IMAP_HEADER_DATA *) * data)->keywords));
+  string_list_wipe(&(((IMAP_HEADER_DATA *) * data)->keywords));
 
   p_delete(data);
 }
@@ -822,7 +823,7 @@ char *imap_set_flags (IMAP_DATA * idata, HEADER * h, char *s)
   ctx->changed &= ~readonly;
   ctx->readonly = readonly;
 
-  mutt_free_list (&(HEADER_DATA (h)->keywords));
+  string_list_wipe(&(HEADER_DATA (h)->keywords));
   HEADER_DATA (h)->keywords = newh.data->keywords;
   p_delete(&newh.data);
 
@@ -942,7 +943,7 @@ static int msg_fetch_header_fetch (CONTEXT * ctx, IMAP_HEADER * h, char *buf,
 
 /* msg_has_flag: do a caseless comparison of the flag against a flag list,
  *   return 1 if found or flag list has '\*', 0 otherwise */
-static int msg_has_flag (LIST * flag_list, const char *flag)
+static int msg_has_flag (string_list_t * flag_list, const char *flag)
 {
   if (!flag_list)
     return 0;
@@ -1066,7 +1067,7 @@ static char *msg_parse_flags (IMAP_HEADER * h, char *s)
       char *flag_word = s;
 
       if (!h->data->keywords)
-        h->data->keywords = mutt_new_list ();
+        h->data->keywords = string_item_new();
 
       while (*s && !ISSPACE (*s) && *s != ')')
         s++;