move url.[hc] into the lib-lib.
[apps/madmutt.git] / imap / message.c
index 1dddd52..ba49cd1 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>
@@ -247,7 +248,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
       fputs ("\n\n", fp);
 
       /* update context with message header */
-      ctx->hdrs[msgno] = mutt_new_header ();
+      ctx->hdrs[msgno] = header_new();
 
       ctx->hdrs[msgno]->index = h.sid - 1;
       if (h.sid != ctx->msgcount + 1)
@@ -552,8 +553,7 @@ int imap_append_message (CONTEXT * ctx, MESSAGE * msg)
 
     debug_print (1, ("command failed: %s\n", idata->cmd.buf));
 
-    pc = idata->cmd.buf + SEQLEN;
-    SKIPWS (pc);
+    pc = vskipspaces(idata->cmd.buf + SEQLEN);
     pc = imap_next_word (pc);
     mutt_error ("%s", pc);
     mutt_sleep (1);
@@ -588,8 +588,7 @@ int imap_append_message (CONTEXT * ctx, MESSAGE * msg)
     char *pc;
 
     debug_print (1, ("command failed: %s\n", idata->cmd.buf));
-    pc = idata->cmd.buf + SEQLEN;
-    SKIPWS (pc);
+    pc = vskipspaces(idata->cmd.buf + SEQLEN);
     pc = imap_next_word (pc);
     mutt_error ("%s", pc);
     mutt_sleep (1);
@@ -771,8 +770,8 @@ void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags,
 
   while (keywords) {
     if (msg_has_flag (mailbox_flags, keywords->data)) {
-      str_cat (s, slen, keywords->data);
-      str_cat (s, slen, " ");
+      m_strcat(s, slen, keywords->data);
+      m_strcat(s, slen, " ");
     }
     keywords = keywords->next;
   }
@@ -970,22 +969,20 @@ static int msg_parse_fetch (IMAP_HEADER * h, char *s)
     return -1;
 
   while (*s) {
-    SKIPWS (s);
+    s = vskipspaces(s);
 
     if (ascii_strncasecmp ("FLAGS", s, 5) == 0) {
       if ((s = msg_parse_flags (h, s)) == NULL)
         return -1;
     }
     else if (ascii_strncasecmp ("UID", s, 3) == 0) {
-      s += 3;
-      SKIPWS (s);
+      s = vskipspaces(s + 3);
       h->data->uid = (unsigned int) atoi (s);
 
       s = imap_next_word (s);
     }
     else if (ascii_strncasecmp ("INTERNALDATE", s, 12) == 0) {
-      s += 12;
-      SKIPWS (s);
+      s = vskipspaces(s + 12);
       if (*s != '\"') {
         debug_print (1, ("bogus INTERNALDATE entry: %s\n", s));
         return -1;
@@ -1001,8 +998,7 @@ static int msg_parse_fetch (IMAP_HEADER * h, char *s)
       h->received = imap_parse_date (tmp);
     }
     else if (ascii_strncasecmp ("RFC822.SIZE", s, 11) == 0) {
-      s += 11;
-      SKIPWS (s);
+      s = vskipspaces(s + 11);
       ptmp = tmp;
       while (isdigit ((unsigned char) *s))
         *ptmp++ = *s++;
@@ -1036,8 +1032,7 @@ static char *msg_parse_flags (IMAP_HEADER * h, char *s)
     debug_print (1, ("not a FLAGS response: %s\n", s));
     return NULL;
   }
-  s += 5;
-  SKIPWS (s);
+  s = vskipspaces(s + 5);
   if (*s != '(') {
     debug_print (1, ("bogus FLAGS response: %s\n", s));
     return NULL;
@@ -1081,7 +1076,7 @@ static char *msg_parse_flags (IMAP_HEADER * h, char *s)
       mutt_add_list (h->data->keywords, flag_word);
       *s = ctmp;
     }
-    SKIPWS (s);
+    s = vskipspaces(s);
   }
 
   /* wrap up, or note bad flags response */