X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=imap%2Fimap.c;h=dbe6f7606611f1fea734c3dc4d90ecae5da186da;hp=cb100cee080e34a8d93a75d0a3df21f251050bc9;hb=108f3c7ab59844591f7540347914ea57be5245e2;hpb=238b70e39b78f585c586bd51aef41988b3cc73d1 diff --git a/imap/imap.c b/imap/imap.c index cb100ce..dbe6f76 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "mutt.h" #include "mx.h" @@ -28,12 +29,11 @@ #include "message.h" #include "imap_private.h" #if defined(USE_SSL) || defined(USE_GNUTLS) -# include "mutt_ssl.h" +# include #endif #include "buffy.h" #include -#include "lib/debug.h" #include #include @@ -44,7 +44,7 @@ /* imap forward declarations */ static int imap_get_delim (IMAP_DATA * idata); -static char *imap_get_flags (LIST ** hflags, char *s); +static char *imap_get_flags (string_list_t ** hflags, char *s); static int imap_check_acl (IMAP_DATA * idata); static int imap_check_capabilities (IMAP_DATA * idata); static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag, @@ -266,14 +266,14 @@ static int imap_get_delim (IMAP_DATA * idata) * than getting the delim wrong */ idata->delim = '/'; - imap_cmd_start (idata, "LIST \"\" \"\""); + imap_cmd_start (idata, "string_list_t \"\" \"\""); do { if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) break; s = imap_next_word (idata->cmd.buf); - if (ascii_strncasecmp ("LIST", s, 4) == 0) { + if (ascii_strncasecmp ("string_list_t", s, 4) == 0) { s = imap_next_word (s); s = imap_next_word (s); if (s && s[0] == '\"' && s[1] && s[2] == '\"') @@ -482,9 +482,9 @@ bail: /* imap_get_flags: Make a simple list out of a FLAGS response. * return stream following FLAGS response */ -static char *imap_get_flags (LIST ** hflags, char *s) +static char *imap_get_flags (string_list_t ** hflags, char *s) { - LIST *flags; + string_list_t *flags; char *flag_word; char ctmp; @@ -493,20 +493,18 @@ static char *imap_get_flags (LIST ** hflags, 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; } /* create list, update caller's flags handle */ - flags = mutt_new_list (); + flags = string_item_new(); *hflags = flags; while (*s && *s != ')') { - s++; - SKIPWS (s); + s = vskipspaces(s + 1); flag_word = s; while (*s && (*s != ')') && !ISSPACE (*s)) s++; @@ -520,7 +518,7 @@ static char *imap_get_flags (LIST ** hflags, char *s) /* note bad flags response */ if (*s != ')') { debug_print (1, ("Unterminated FLAGS response: %s\n", s)); - mutt_free_list (hflags); + string_list_wipe(hflags); return NULL; } @@ -603,7 +601,7 @@ int imap_open_mailbox (CONTEXT * ctx) else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) { debug_print (2, ("Getting mailbox PERMANENTFLAGS\n")); /* safe to call on NULL */ - mutt_free_list (&(idata->flags)); + string_list_wipe(&(idata->flags)); /* skip "OK [PERMANENT" so syntax is the same as FLAGS */ pc += 13; if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL) @@ -656,7 +654,7 @@ int imap_open_mailbox (CONTEXT * ctx) if (!idata->flags) debug_print (3, ("No folder flags found\n")); else { - LIST *t = idata->flags; + string_list_t *t = idata->flags; debug_print (3, ("Mailbox flags:\n")); @@ -906,7 +904,7 @@ int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd, if (mutt_bit_isset (idata->rights, ACL_WRITE)) imap_add_keywords (flags, hdr, idata->flags, sizeof (flags)); - str_skip_trailws (flags); + m_strrtrim(flags); /* UW-IMAP is OK with null flags, Cyrus isn't. The only solution is to * explicitly revoke all system flags (if we have permission) */ @@ -917,7 +915,7 @@ int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd, imap_set_flag (idata, ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags)); imap_set_flag (idata, ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags)); - str_skip_trailws (flags); + m_strrtrim(flags); mutt_buffer_addstr (cmd, " -FLAGS.SILENT ("); } else @@ -1084,7 +1082,7 @@ void imap_close_mailbox (CONTEXT * ctx) idata->reopen &= IMAP_REOPEN_ALLOW; p_delete(&(idata->mailbox)); - mutt_free_list (&idata->flags); + string_list_wipe(&idata->flags); idata->ctx = NULL; } @@ -1311,9 +1309,8 @@ static int imap_compile_search (const pattern_t* pat, BUFFER* buf) mutt_buffer_addch (buf, ' '); /* and field */ - *delim = ':'; - delim++; - SKIPWS(delim); + *delim++ = ':'; + delim = vskipspaces(delim); imap_quote_string (term, sizeof (term), delim); mutt_buffer_addstr (buf, term); break; @@ -1364,7 +1361,7 @@ int imap_search (CONTEXT* ctx, const pattern_t* pat) { /* all this listing/browsing is a mess. I don't like that name is a pointer * into idata->buf (used to be a pointer into the passed in buffer, just * as bad), nor do I like the fact that the fetch is done here. This - * code can't possibly handle non-LIST untagged responses properly. + * code can't possibly handle non-string_list_t untagged responses properly. * FIXME. ?! */ int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect, int *noinferiors, char *delim) @@ -1382,7 +1379,7 @@ int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect, return -1; s = imap_next_word (idata->cmd.buf); - if ((ascii_strncasecmp ("LIST", s, 4) == 0) || + if ((ascii_strncasecmp ("string_list_t", s, 4) == 0) || (ascii_strncasecmp ("LSUB", s, 4) == 0)) { *noselect = 0; *noinferiors = 0; @@ -1585,7 +1582,7 @@ int imap_complete (char *dest, size_t dlen, char *path) { /* fire off command */ snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"", - option (OPTIMAPLSUB) ? "LSUB" : "LIST", list); + option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", list); imap_cmd_start (idata, buf);