#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"
#endif
#include <lib-lib/macros.h>
-#include "lib/debug.h"
+#include <lib-lib/file.h>
#if HAVE_STDINT_H
#include <stdint.h>
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);
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;
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)
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);
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);
/* 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;
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;
}
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);
}
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);
/* 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;
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;
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++;
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;
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++;
mutt_add_list (h->data->keywords, flag_word);
*s = ctmp;
}
- SKIPWS (s);
+ s = vskipspaces(s);
}
/* wrap up, or note bad flags response */