From a4dc02b7028c29ae0cfa81ca477be587236bab28 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 3 Sep 2018 16:50:13 +0100 Subject: [PATCH] tidy upstream changes --- email/parameter.h | 2 +- globals.h | 4 +- imap/command.c | 42 +++---- imap/imap.c | 33 +++--- imap/imap.h | 1 + imap/imap_private.h | 24 ++-- imap/message.c | 259 +++++++++++++++++++++++++------------------- imap/util.c | 94 ++++++++++------ init.h | 38 +++---- mutt/string.c | 17 ++- mutt_account.c | 4 +- ncrypt/pgp.c | 4 +- pop/pop.c | 2 +- pop/pop_auth.c | 7 +- 14 files changed, 297 insertions(+), 234 deletions(-) diff --git a/email/parameter.h b/email/parameter.h index 90cf235c4..52ae6a19e 100644 --- a/email/parameter.h +++ b/email/parameter.h @@ -27,7 +27,7 @@ #include "mutt/mutt.h" /** - * struct ParameterList - List of parameters. + * struct ParameterList - List of parameters */ TAILQ_HEAD(ParameterList, Parameter); diff --git a/globals.h b/globals.h index 2ed0f3107..af194bc6e 100644 --- a/globals.h +++ b/globals.h @@ -224,11 +224,11 @@ WHERE bool Header; ///< Config: Include the message head WHERE bool Help; ///< Config: Display a help line with common key bindings #ifdef USE_IMAP WHERE bool ImapCheckSubscribed; ///< Config: (imap) When opening a mailbox, ask the server for a list of subscribed folders -WHERE bool ImapCondStore; +WHERE bool ImapCondStore; ///< Config: (imap) Enable the CONDSTORE extension WHERE bool ImapListSubscribed; ///< Config: (imap) When browsing a mailbox, only display subscribed folders WHERE bool ImapPassive; ///< Config: (imap) Reuse an existing IMAP connection to check for new mail WHERE bool ImapPeek; ///< Config: (imap) Don't mark messages as read when fetching them from the server -WHERE bool ImapQResync; +WHERE bool ImapQResync; ///< Config: (imap) Enable the QRESYNC extension #endif #ifdef USE_SSL #ifndef USE_SSL_GNUTLS diff --git a/imap/command.c b/imap/command.c index bfefd4acd..1544eae02 100644 --- a/imap/command.c +++ b/imap/command.c @@ -275,16 +275,19 @@ static void cmd_parse_expunge(struct ImapData *idata, const char *s) idata->reopen |= IMAP_EXPUNGE_PENDING; } -/* cmd_parse_vanished: handles VANISHED (RFC 7162), which is like - * expunge, but passes a seqset of UIDs. An optional (EARLIER) argument - * specifies not to decrement subsequent MSNs. */ +/** + * cmd_parse_vanished - Parse vanished command + * @param idata Server data + * @param s String containing MSN of message to expunge + * + * Handle VANISHED (RFC7162), which is like expunge, but passes a seqset of UIDs. + * An optional (EARLIER) argument specifies not to decrement subsequent MSNs. + */ static void cmd_parse_vanished(struct ImapData *idata, char *s) { - int earlier = 0, rc; - char *end_of_seqset; - struct SeqsetIterator *iter; - unsigned int uid, exp_msn, cur; - struct Header *h; + bool earlier = false; + int rc; + unsigned int uid = 0; mutt_debug(2, "Handling VANISHED\n"); @@ -292,12 +295,11 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) { /* The RFC says we should not decrement msns with the VANISHED EARLIER tag. * My experimentation says that's crap. */ - /* earlier = 1; */ - earlier = 1; + earlier = true; s = imap_next_word(s); } - end_of_seqset = s; + char *end_of_seqset = s; while (*end_of_seqset) { if (!strchr("0123456789:,", *end_of_seqset)) @@ -306,7 +308,7 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) end_of_seqset++; } - iter = mutt_seqset_iterator_new(s); + struct SeqsetIterator *iter = mutt_seqset_iterator_new(s); if (!iter) { mutt_debug(2, "VANISHED: empty seqset [%s]?\n", s); @@ -315,11 +317,11 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) while ((rc = mutt_seqset_iterator_next(iter, &uid)) == 0) { - h = (struct Header *) mutt_hash_int_find(idata->uid_hash, uid); + struct Header *h = mutt_hash_int_find(idata->uid_hash, uid); if (!h) continue; - exp_msn = HEADER_DATA(h)->msn; + unsigned int exp_msn = HEADER_DATA(h)->msn; /* imap_expunge_mailbox() will rewrite h->index. * It needs to resort using SORT_ORDER anyway, so setting to INT_MAX @@ -327,7 +329,7 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) h->index = INT_MAX; HEADER_DATA(h)->msn = 0; - if (exp_msn < 1 || exp_msn > idata->max_msn) + if ((exp_msn < 1) || (exp_msn > idata->max_msn)) { mutt_debug(1, "VANISHED: msn for UID %u is incorrect.\n", uid); continue; @@ -343,7 +345,7 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) if (!earlier) { /* decrement seqno of those above. */ - for (cur = exp_msn; cur < idata->max_msn; cur++) + for (unsigned int cur = exp_msn; cur < idata->max_msn; cur++) { h = idata->msn_index[cur]; if (h) @@ -467,7 +469,7 @@ static void cmd_parse_fetch(struct ImapData *idata, char *s) SKIPWS(s); if (*s != '(') { - mutt_debug(1, "cmd_parse_fetch: bogus MODSEQ response: %s\n", s); + mutt_debug(1, "bogus MODSEQ response: %s\n", s); return; } s++; @@ -477,7 +479,7 @@ static void cmd_parse_fetch(struct ImapData *idata, char *s) s++; else { - mutt_debug(1, "cmd_parse_fetch: Unterminated MODSEQ response: %s\n", s); + mutt_debug(1, "Unterminated MODSEQ response: %s\n", s); return; } } @@ -1012,7 +1014,7 @@ static int cmd_handle_untagged(struct ImapData *idata) else if (mutt_str_strncasecmp("FETCH", s, 5) == 0) cmd_parse_fetch(idata, pn); } - else if ((idata->state >= IMAP_SELECTED) && mutt_str_strncasecmp("VANISHED", s, 8) == 0) + else if ((idata->state >= IMAP_SELECTED) && (mutt_str_strncasecmp("VANISHED", s, 8) == 0)) cmd_parse_vanished(idata, pn); else if (mutt_str_strncasecmp("CAPABILITY", s, 10) == 0) cmd_parse_capability(idata, s); @@ -1332,7 +1334,7 @@ void imap_cmd_finish(struct ImapData *idata) /* check_status: curs_main uses imap_check_mailbox to detect * whether the index needs updating */ idata->check_status = IMAP_NEWMAIL_PENDING; - imap_read_headers(idata, idata->max_msn + 1, count, 0); + imap_read_headers(idata, idata->max_msn + 1, count, false); } else if (idata->reopen & IMAP_EXPUNGE_PENDING) { diff --git a/imap/imap.c b/imap/imap.c index 329c1af19..b11f6f40f 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -624,7 +624,7 @@ int imap_access(const char *path) } FREE(&mx.mbox); - if (imap_mboxcache_get(idata, mailbox, 0)) + if (imap_mboxcache_get(idata, mailbox, false)) { mutt_debug(3, "found %s in cache\n", mailbox); return 0; @@ -1581,7 +1581,7 @@ int imap_status(const char *path, bool queue) imap_exec(idata, buf, 0); queued = 0; - status = imap_mboxcache_get(idata, mbox, 0); + status = imap_mboxcache_get(idata, mbox, false); if (status) return status->messages; @@ -1602,13 +1602,6 @@ int imap_status(const char *path, bool queue) struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox, bool create) { struct ImapStatus *status = NULL; -#ifdef USE_HCACHE - header_cache_t *hc = NULL; - void *uidvalidity = NULL; - void *uidnext = NULL; - unsigned long long *modseq = NULL; -#endif - struct ListNode *np = NULL; STAILQ_FOREACH(np, &idata->mboxcache, entries) { @@ -1625,17 +1618,17 @@ struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox, struct ImapStatus *scache = mutt_mem_calloc(1, sizeof(struct ImapStatus)); scache->name = (char *) mbox; mutt_list_insert_tail(&idata->mboxcache, (char *) scache); - status = imap_mboxcache_get(idata, mbox, 0); + status = imap_mboxcache_get(idata, mbox, false); status->name = mutt_str_strdup(mbox); } #ifdef USE_HCACHE - hc = imap_hcache_open(idata, mbox); + header_cache_t *hc = imap_hcache_open(idata, mbox); if (hc) { - uidvalidity = mutt_hcache_fetch_raw(hc, "/UIDVALIDITY", 12); - uidnext = mutt_hcache_fetch_raw(hc, "/UIDNEXT", 8); - modseq = mutt_hcache_fetch_raw(hc, "/MODSEQ", 7); + void *uidvalidity = mutt_hcache_fetch_raw(hc, "/UIDVALIDITY", 12); + void *uidnext = mutt_hcache_fetch_raw(hc, "/UIDNEXT", 8); + unsigned long long *modseq = mutt_hcache_fetch_raw(hc, "/MODSEQ", 7); if (uidvalidity) { if (!status) @@ -1644,13 +1637,13 @@ struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox, mutt_hcache_free(hc, &uidnext); mutt_hcache_free(hc, (void **) &modseq); mutt_hcache_close(hc); - return imap_mboxcache_get(idata, mbox, 1); + return imap_mboxcache_get(idata, mbox, true); } status->uidvalidity = *(unsigned int *) uidvalidity; status->uidnext = uidnext ? *(unsigned int *) uidnext : 0; status->modseq = modseq ? *modseq : 0; - mutt_debug(3, "mboxcache: hcache uidvalidity %u, uidnext %u, modseq %llu\n", - status->uidvalidity, status->uidnext, status->modseq); + mutt_debug(3, "hcache uidvalidity %u, uidnext %u, modseq %llu\n", + status->uidvalidity, status->uidnext, status->modseq); } mutt_hcache_free(hc, &uidvalidity); mutt_hcache_free(hc, &uidnext); @@ -2079,7 +2072,7 @@ static int imap_mbox_open(struct Context *ctx) if (ImapCheckSubscribed) imap_exec(idata, "LSUB \"\" \"*\"", IMAP_CMD_QUEUE); -#if USE_HCACHE +#ifdef USE_HCACHE if (mutt_bit_isset(idata->capabilities, CONDSTORE) && ImapCondStore) condstore = " (CONDSTORE)"; else @@ -2093,7 +2086,7 @@ static int imap_mbox_open(struct Context *ctx) imap_cmd_start(idata, bufout); - status = imap_mboxcache_get(idata, idata->mailbox, 1); + status = imap_mboxcache_get(idata, idata->mailbox, true); do { @@ -2226,7 +2219,7 @@ static int imap_mbox_open(struct Context *ctx) ctx->v2r = mutt_mem_calloc(count, sizeof(int)); ctx->msgcount = 0; - if (count && (imap_read_headers(idata, 1, count, 1) < 0)) + if (count && (imap_read_headers(idata, 1, count, true) < 0)) { mutt_error(_("Error opening mailbox")); goto fail; diff --git a/imap/imap.h b/imap/imap.h index bcc32ee4e..b80ea1215 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -34,6 +34,7 @@ * | imap/auth_cram.c | @subpage imap_auth_cram | * | imap/auth_gss.c | @subpage imap_auth_gss | * | imap/auth_login.c | @subpage imap_auth_login | + * | imap/auth_oauth.c | @subpage imap_auth_oauth | * | imap/auth_plain.c | @subpage imap_auth_plain | * | imap/auth_sasl.c | @subpage imap_auth_sasl | * | imap/browse.c | @subpage imap_browse | diff --git a/imap/imap_private.h b/imap/imap_private.h index 126eb92e4..795cc4a6d 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -272,14 +272,19 @@ struct ImapData #endif }; +/** + * struct SeqsetIterator - UID Sequence Set Iterator + */ struct SeqsetIterator { char *full_seqset; char *eostr; int in_range; int down; - unsigned int range_cur, range_end; - char *substr_cur, *substr_end; + unsigned int range_cur; + unsigned int range_end; + char *substr_cur; + char *substr_end; }; /* -- private IMAP functions -- */ @@ -314,8 +319,7 @@ int imap_cmd_idle(struct ImapData *idata); /* message.c */ void imap_free_header_data(struct ImapHeaderData **data); -int imap_read_headers (struct ImapData* idata, unsigned int msn_begin, unsigned int msn_end, - int initial_download); +int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned int msn_end, bool initial_download); char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *server_changes); int imap_cache_del(struct ImapData *idata, struct Header *h); int imap_cache_clean(struct ImapData *idata); @@ -332,9 +336,9 @@ void imap_hcache_close(struct ImapData *idata); struct Header *imap_hcache_get(struct ImapData *idata, unsigned int uid); int imap_hcache_put(struct ImapData *idata, struct Header *h); int imap_hcache_del(struct ImapData *idata, unsigned int uid); -int imap_hcache_store_uid_seqset (struct ImapData *idata); -int imap_hcache_clear_uid_seqset (struct ImapData *idata); -char *imap_hcache_get_uid_seqset (struct ImapData *idata); +int imap_hcache_store_uid_seqset(struct ImapData *idata); +int imap_hcache_clear_uid_seqset(struct ImapData *idata); +char *imap_hcache_get_uid_seqset(struct ImapData *idata); #endif int imap_continue(const char *msg, const char *resp); @@ -352,9 +356,9 @@ void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_back void imap_unquote_string(char *s); void imap_munge_mbox_name(struct ImapData *idata, char *dest, size_t dlen, const char *src); void imap_unmunge_mbox_name(struct ImapData *idata, char *s); -struct SeqsetIterator *mutt_seqset_iterator_new (const char *seqset); -int mutt_seqset_iterator_next (struct SeqsetIterator *iter, unsigned int *next); -void mutt_seqset_iterator_free (struct SeqsetIterator **p_iter); +struct SeqsetIterator *mutt_seqset_iterator_new(const char *seqset); +int mutt_seqset_iterator_next(struct SeqsetIterator *iter, unsigned int *next); +void mutt_seqset_iterator_free(struct SeqsetIterator **p_iter); int imap_account_match(const struct Account *a1, const struct Account *a2); void imap_get_parent(const char *mbox, char delim, char *buf, size_t buflen); diff --git a/imap/message.c b/imap/message.c index 8cb637b3f..35129ebb6 100644 --- a/imap/message.c +++ b/imap/message.c @@ -336,7 +336,7 @@ static int msg_parse_fetch(struct ImapHeader *h, char *s) return -1; } else if ((mutt_str_strncasecmp("BODY", s, 4) == 0) || - (mutt_str_strncasecmp("RFC822.struct Header", s, 13) == 0)) + (mutt_str_strncasecmp("RFC822.HEADER", s, 13) == 0)) { /* handle above, in msg_fetch_header */ return -2; @@ -347,7 +347,7 @@ static int msg_parse_fetch(struct ImapHeader *h, char *s) SKIPWS(s); if (*s != '(') { - mutt_debug(1, "msg_parse_flags: bogus MODSEQ response: %s\n", s); + mutt_debug(1, "bogus MODSEQ response: %s\n", s); return -1; } s++; @@ -357,7 +357,7 @@ static int msg_parse_fetch(struct ImapHeader *h, char *s) s++; else { - mutt_debug(1, "msg_parse_flags: Unterminated MODSEQ response: %s\n", s); + mutt_debug(1, "Unterminated MODSEQ response: %s\n", s); return -1; } } @@ -458,19 +458,23 @@ static void flush_buffer(char *buf, size_t *len, struct Connection *conn) *len = 0; } -/* If the user hits ctrl-c during an initial header download for a mailbox, +/** + * query_abort_header_download - Ask the user whether to abort the download + * @param idata Server data + * @retval true Abort the download + * + * If the user hits ctrl-c during an initial header download for a mailbox, * prompt whether to completely abort the download and close the mailbox. */ -static int query_abort_header_download(struct ImapData *idata) +static bool query_abort_header_download(struct ImapData *idata) { - int abort = 0; + bool abort = false; mutt_flushinp(); - /* L10N: This prompt is made if the user hits Ctrl-C when opening - * an IMAP mailbox */ + /* L10N: This prompt is made if the user hits Ctrl-C when opening an IMAP mailbox */ if (mutt_yesorno(_("Abort download and close mailbox?"), MUTT_YES) == MUTT_YES) { - abort = 1; + abort = true; imap_close_connection(idata); } SigInt = 0; @@ -516,7 +520,12 @@ static void alloc_msn_index(struct ImapData *idata, size_t msn_count) idata->msn_index_size = new_size; } -/* This function is run after imap_alloc_msn_index, so we skip the +/** + * imap_alloc_uid_hash - Create a Hash Table for the UIDs + * @param idata Server data + * @param msn_count Number of MSNs in use + * + * This function is run after imap_alloc_msn_index, so we skip the * malicious msn_count size check. */ static void imap_alloc_uid_hash(struct ImapData *idata, unsigned int msn_count) @@ -526,7 +535,7 @@ static void imap_alloc_uid_hash(struct ImapData *idata, unsigned int msn_count) } /** - * generate_seqset - Generate a sequence set + * imap_fetch_msn_seqset - Generate a sequence set * @param b Buffer for the result * @param idata Server data * @param msn_begin First Message Sequence number @@ -544,11 +553,12 @@ static void imap_fetch_msn_seqset(struct Buffer *b, struct ImapData *idata, { int chunks = 0; int state = 0; /* 1: single msn, 2: range of msn */ - unsigned int range_begin, range_end; + unsigned int range_begin = 0; + unsigned int range_end = 0; - for (unsigned int msn = msn_begin; msn <= msn_end + 1; msn++) + for (unsigned int msn = msn_begin; msn <= (msn_end + 1); msn++) { - if (msn <= msn_end && !idata->msn_index[msn - 1]) + if ((msn <= msn_end) && !idata->msn_index[msn - 1]) { switch (state) { @@ -580,7 +590,7 @@ static void imap_fetch_msn_seqset(struct Buffer *b, struct ImapData *idata, } /* Too big. Just query the whole range then. */ - if (chunks == 150 || mutt_str_strlen(b->data) > 500) + if ((chunks == 150) || (mutt_str_strlen(b->data) > 500)) { b->dptr = b->data; mutt_buffer_printf(b, "%u:%u", msn_begin, msn_end); @@ -625,8 +635,16 @@ static void set_changed_flag(struct Context *ctx, struct Header *h, mutt_set_flag(ctx, h, flag_name, new_hd_flag); } -#if USE_HCACHE -/* Retrieve data from the header cache. +#ifdef USE_HCACHE +/** + * read_headers_normal_eval_cache - Retrieve data from the header cache + * @param idata Server data + * @param msn_end Last Message Sequence number + * @param uidnext UID of next email + * @param store_flag_updates if true, save flags to the header cache + * @param eval_condstore if true, use CONDSTORE to fetch flags + * @retval 0 Success + * @retval -1 Error * * Without CONDSTORE or QRESYNC, we need to query all the current * UIDs and update their flag state and current MSN. @@ -635,18 +653,15 @@ static void set_changed_flag(struct Context *ctx, struct Header *h, * their MSN. The current flag state will be queried in * read_headers_condstore_qresync_updates(). */ -static int read_headers_normal_eval_cache(struct ImapData *idata, unsigned int msn_end, - unsigned int uidnext, - int store_flag_updates, int eval_condstore) +static int read_headers_normal_eval_cache(struct ImapData *idata, + unsigned int msn_end, unsigned int uidnext, + bool store_flag_updates, bool eval_condstore) { - struct Context *ctx; - int idx, msgno, rc, mfhrc = 0; struct Progress progress; - struct ImapHeader h; char buf[LONG_STRING]; - ctx = idata->ctx; - idx = ctx->msgcount; + struct Context *ctx = idata->ctx; + int idx = ctx->msgcount; /* L10N: Comparing the cached data with the IMAP server's data */ @@ -660,8 +675,10 @@ static int read_headers_normal_eval_cache(struct ImapData *idata, unsigned int m imap_cmd_start(idata, buf); - rc = IMAP_CMD_CONTINUE; - for (msgno = 1; rc == IMAP_CMD_CONTINUE; msgno++) + int rc = IMAP_CMD_CONTINUE; + int mfhrc = 0; + struct ImapHeader h; + for (int msgno = 1; rc == IMAP_CMD_CONTINUE; msgno++) { if (SigInt && query_abort_header_download(idata)) return -1; @@ -676,30 +693,27 @@ static int read_headers_normal_eval_cache(struct ImapData *idata, unsigned int m if (rc != IMAP_CMD_CONTINUE) break; - if ((mfhrc = msg_fetch_header(ctx, &h, idata->buf, NULL)) < 0) + mfhrc = msg_fetch_header(ctx, &h, idata->buf, NULL); + if (mfhrc < 0) continue; if (!h.data->uid) { - mutt_debug(2, "imap_read_headers: skipping hcache FETCH " - "response for message number %d missing a UID\n", - h.data->msn); + mutt_debug(2, "skipping hcache FETCH response for message number %d missing a UID\n", + h.data->msn); continue; } - if (h.data->msn < 1 || h.data->msn > msn_end) + if ((h.data->msn < 1) || (h.data->msn > msn_end)) { - mutt_debug(1, "imap_read_headers: skipping hcache FETCH " - "response for unknown message number %d\n", - h.data->msn); + mutt_debug(1, "skipping hcache FETCH response for unknown message number %d\n", + h.data->msn); continue; } if (idata->msn_index[h.data->msn - 1]) { - mutt_debug(2, "imap_read_headers: skipping hcache FETCH " - "for duplicate message %d\n", - h.data->msn); + mutt_debug(2, "skipping hcache FETCH for duplicate message %d\n", h.data->msn); continue; } @@ -713,8 +727,8 @@ static int read_headers_normal_eval_cache(struct ImapData *idata, unsigned int m ctx->hdrs[idx]->index = idx; /* messages which have not been expunged are ACTIVE (borrowed from mh * folders) */ - ctx->hdrs[idx]->active = 1; - ctx->hdrs[idx]->changed = 0; + ctx->hdrs[idx]->active = true; + ctx->hdrs[idx]->changed = false; if (!eval_condstore) { ctx->hdrs[idx]->read = h.data->read; @@ -733,7 +747,7 @@ static int read_headers_normal_eval_cache(struct ImapData *idata, unsigned int m } /* ctx->hdrs[msgno]->received is restored from mutt_hcache_restore */ - ctx->hdrs[idx]->data = (void *) (h.data); + ctx->hdrs[idx]->data = h.data; STAILQ_INIT(&ctx->hdrs[idx]->tags); driver_tags_replace(&ctx->hdrs[idx]->tags, mutt_str_strdup(h.data->flags_remote)); @@ -759,29 +773,28 @@ static int read_headers_normal_eval_cache(struct ImapData *idata, unsigned int m return 0; } -/* Retrieve data from the header cache. +/** + * read_headers_qresync_eval_cache - Retrieve data from the header cache + * @param idata Server data + * @param uid_seqset Sequence Set of UIDs + * @retval >=0 Success + * @retval -1 Error * - * For QRESYNC, we grab the UIDs in order by MSN from the header - * cache. + * For QRESYNC, we grab the UIDs in order by MSN from the header cache. * - * In read_headers_condstore_qresync_updates(). We will update change - * flags using CHANGEDSINCE and find out what UIDs have been expunged - * using VANISHED. + * In read_headers_condstore_qresync_updates(). We will update change flags + * using CHANGEDSINCE and find out what UIDs have been expunged using VANISHED. */ static int read_headers_qresync_eval_cache(struct ImapData *idata, char *uid_seqset) { - struct Context *ctx; int rc; - unsigned int uid, msn; - struct SeqsetIterator *iter; - struct Header *h; - struct ImapHeaderData *ihd; + unsigned int uid = 0; mutt_debug(2, "Reading uid seqset from header cache\n"); - ctx = idata->ctx; - msn = 1; + struct Context *ctx = idata->ctx; + unsigned int msn = 1; - iter = mutt_seqset_iterator_new(uid_seqset); + struct SeqsetIterator *iter = mutt_seqset_iterator_new(uid_seqset); if (!iter) return -1; @@ -792,7 +805,7 @@ static int read_headers_qresync_eval_cache(struct ImapData *idata, char *uid_seq if (msn > idata->msn_index_size) alloc_msn_index(idata, msn); - h = imap_hcache_get(idata, uid); + struct Header *h = imap_hcache_get(idata, uid); if (h) { idata->max_msn = MAX(idata->max_msn, msn); @@ -801,12 +814,12 @@ static int read_headers_qresync_eval_cache(struct ImapData *idata, char *uid_seq if (ctx->msgcount >= ctx->hdrmax) mx_alloc_memory(ctx); - ihd = mutt_mem_calloc(1, sizeof(struct ImapHeaderData)); + struct ImapHeaderData *ihd = mutt_mem_calloc(1, sizeof(struct ImapHeaderData)); h->data = ihd; h->index = ctx->msgcount; - h->active = 1; - h->changed = 0; + h->active = true; + h->changed = false; ihd->read = h->read; ihd->old = h->old; ihd->deleted = h->deleted; @@ -829,26 +842,29 @@ static int read_headers_qresync_eval_cache(struct ImapData *idata, char *uid_seq return rc; } -/* - * Retrieve updates from the server. +/** + * read_headers_condstore_qresync_updates - Retrieve updates from the server + * @param idata Server data + * @param msn_end Last Message Sequence number + * @param uidnext UID of next email + * @param hc_modseq Timestamp of last Header Cache update + * @param eval_qresync If true, use QRESYNC + * @retval 0 Success + * @retval -1 Error * * CONDSTORE and QRESYNC use FETCH extensions to grab updates. */ -static int read_headers_condstore_qresync_updates(struct ImapData *idata, unsigned int msn_end, - unsigned int uidnext, - unsigned long long hc_modseq, int eval_qresync) +static int read_headers_condstore_qresync_updates(struct ImapData *idata, + unsigned int msn_end, unsigned int uidnext, + unsigned long long hc_modseq, bool eval_qresync) { - struct Context *ctx; struct Progress progress; - int msgno, rc; char buf[LONG_STRING]; - unsigned int header_msn; - char *fetch_buf; + unsigned int header_msn = 0; - ctx = idata->ctx; + struct Context *ctx = idata->ctx; - /* L10N: - Fetching IMAP flag changes, using the CONDSTORE extension */ + /* L10N: Fetching IMAP flag changes, using the CONDSTORE extension */ mutt_progress_init(&progress, _("Fetching flag updates..."), MUTT_PROGRESS_MSG, ReadInc, msn_end); @@ -857,8 +873,8 @@ static int read_headers_condstore_qresync_updates(struct ImapData *idata, unsign imap_cmd_start(idata, buf); - rc = IMAP_CMD_CONTINUE; - for (msgno = 1; rc == IMAP_CMD_CONTINUE; msgno++) + int rc = IMAP_CMD_CONTINUE; + for (int msgno = 1; rc == IMAP_CMD_CONTINUE; msgno++) { if (SigInt && query_abort_header_download(idata)) return -1; @@ -872,19 +888,17 @@ static int read_headers_condstore_qresync_updates(struct ImapData *idata, unsign /* so we just need to grab the header and persist it back into * the header cache */ - fetch_buf = idata->buf; + char *fetch_buf = idata->buf; if (fetch_buf[0] != '*') continue; fetch_buf = imap_next_word(fetch_buf); - if (!isdigit((unsigned char) *fetch_buf) || mutt_str_atoui(fetch_buf, &header_msn) < 0) + if (!isdigit((unsigned char) *fetch_buf) || (mutt_str_atoui(fetch_buf, &header_msn) < 0)) continue; - if (header_msn < 1 || header_msn > msn_end || !idata->msn_index[header_msn - 1]) + if ((header_msn < 1) || (header_msn > msn_end) || !idata->msn_index[header_msn - 1]) { - mutt_debug(1, "imap_read_headers: skipping CONDSTORE flag " - "update for unknown message number %u\n", - header_msn); + mutt_debug(1, "skipping CONDSTORE flag update for unknown message number %u\n", header_msn); continue; } @@ -894,7 +908,7 @@ static int read_headers_condstore_qresync_updates(struct ImapData *idata, unsign /* The IMAP flag setting as part of cmd_parse_fetch() ends up * flipping these on. */ idata->check_status &= ~IMAP_FLAGS_PENDING; - ctx->changed = 0; + ctx->changed = false; /* VANISHED handling: we need to empty out the messages */ if (idata->reopen & IMAP_EXPUNGE_PENDING) @@ -909,53 +923,59 @@ static int read_headers_condstore_qresync_updates(struct ImapData *idata, unsign } #endif /* USE_HCACHE */ -/* Retrieve new messages from the server +/** + * read_headers_fetch_new - Retrieve new messages from the server + * @param[in] idata Server data + * @param[in] msn_begin First Message Sequence number + * @param[in] msn_end Last Message Sequence number + * @param[in] evalhc if true, check the Header Cache + * @param[out] maxuid Highest UID seen + * @param[in] initial_download true, if this is the first opening of the mailbox + * @retval 0 Success + * @retval -1 Error */ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin, - unsigned int msn_end, int evalhc, - unsigned int *maxuid, int initial_download) + unsigned int msn_end, bool evalhc, + unsigned int *maxuid, bool initial_download) { - struct Context *ctx; - int idx, msgno, rc, mfhrc = 0, retval = -1; + int rc, mfhrc = 0, retval = -1; unsigned int fetch_msn_end = 0; struct Progress progress; char *hdrreq = NULL; char tempfile[_POSIX_PATH_MAX]; FILE *fp = NULL; struct ImapHeader h; - struct Buffer *b; static const char *const want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE " "CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL " "X-ORIGINAL-TO"; - ctx = idata->ctx; - idx = ctx->msgcount; + struct Context *ctx = idata->ctx; + int idx = ctx->msgcount; if (mutt_bit_isset(idata->capabilities, IMAP4REV1)) { - safe_asprintf(&hdrreq, "BODY.PEEK[struct Header.FIELDS (%s%s%s)]", - want_headers, ImapHeaders ? " " : "", NONULL(ImapHeaders)); + safe_asprintf(&hdrreq, "BODY.PEEK[HEADER.FIELDS (%s%s%s)]", want_headers, + ImapHeaders ? " " : "", NONULL(ImapHeaders)); } else if (mutt_bit_isset(idata->capabilities, IMAP4)) { - safe_asprintf(&hdrreq, "RFC822.struct Header.LINES (%s%s%s)", want_headers, + safe_asprintf(&hdrreq, "RFC822.HEADER.LINES (%s%s%s)", want_headers, ImapHeaders ? " " : "", NONULL(ImapHeaders)); } else { /* Unable to fetch headers for lower versions */ mutt_error(_("Unable to fetch headers from this IMAP server version.")); - mutt_sleep(2); /* pause a moment to let the user see the error */ goto bail; } /* instead of downloading all headers and then parsing them, we parse them * as they come in. */ mutt_mktemp(tempfile, sizeof(tempfile)); - if (!(fp = mutt_file_fopen(tempfile, "w+"))) + fp = mutt_file_fopen(tempfile, "w+"); + if (!fp) { mutt_error(_("Could not create temporary file %s"), tempfile); - mutt_sleep(2); goto bail; } unlink(tempfile); @@ -963,9 +983,9 @@ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin mutt_progress_init(&progress, _("Fetching message headers..."), MUTT_PROGRESS_MSG, ReadInc, msn_end); - while (msn_begin <= msn_end && fetch_msn_end < msn_end) + while ((msn_begin <= msn_end) && (fetch_msn_end < msn_end)) { - b = mutt_buffer_new(); + struct Buffer *b = mutt_buffer_new(); if (evalhc) { /* In case there are holes in the header cache. */ @@ -983,7 +1003,7 @@ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin mutt_buffer_free(&b); rc = IMAP_CMD_CONTINUE; - for (msgno = msn_begin; rc == IMAP_CMD_CONTINUE; msgno++) + for (int msgno = msn_begin; rc == IMAP_CMD_CONTINUE; msgno++) { if (initial_download && SigInt && query_abort_header_download(idata)) goto bail; @@ -1018,7 +1038,7 @@ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin /* make sure we don't get remnants from older larger message headers */ fputs("\n\n", fp); - if (h.data->msn < 1 || h.data->msn > fetch_msn_end) + if ((h.data->msn < 1) || (h.data->msn > fetch_msn_end)) { mutt_debug(1, "skipping FETCH response for unknown message number %d\n", h.data->msn); @@ -1043,7 +1063,7 @@ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin /* messages which have not been expunged are ACTIVE (borrowed from mh * folders) */ ctx->hdrs[idx]->active = true; - ctx->hdrs[idx]->changed = 0; + ctx->hdrs[idx]->changed = false; ctx->hdrs[idx]->read = h.data->read; ctx->hdrs[idx]->old = h.data->old; ctx->hdrs[idx]->deleted = h.data->deleted; @@ -1112,9 +1132,10 @@ bail: /** * imap_read_headers - Read headers from the server - * @param idata Server data - * @param msn_begin First Message Sequence Number - * @param msn_end Last Message Sequence Number + * @param idata Server data + * @param msn_begin First Message Sequence Number + * @param msn_end Last Message Sequence Number + * @param initial_download true, if this is the first opening of the mailbox * @retval num Last MSN * @retval -1 Failure * @@ -1123,7 +1144,7 @@ bail: * comes in while downloading headers (in theory). */ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, - unsigned int msn_end, int initial_download) + unsigned int msn_end, bool initial_download) { struct ImapStatus *status = NULL; int oldmsgcount; @@ -1135,10 +1156,10 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, void *uid_validity = NULL; void *puidnext = NULL; unsigned int uidnext = 0; - int has_condstore = 0; - int has_qresync = 0; - int eval_condstore = 0; - int eval_qresync = 0; + bool has_condstore = false; + bool has_qresync = false; + bool eval_condstore = false; + bool eval_qresync = false; unsigned long long *pmodseq = NULL; unsigned long long hc_modseq = 0; char *uid_seqset = NULL; @@ -1172,17 +1193,17 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, if (idata->modseq) { if (mutt_bit_isset(idata->capabilities, CONDSTORE) && ImapCondStore) - has_condstore = 1; + has_condstore = true; /* If mutt_bit_isset(QRESYNC) and option(OPTIMAPQRESYNC) then Mutt * sends ENABLE QRESYNC. If we receive an ENABLED response back, then * idata->qresync is set. */ if (idata->qresync) - has_qresync = 1; + has_qresync = true; } - if (uid_validity && uidnext && *(unsigned int *) uid_validity == idata->uid_validity) + if (uid_validity && uidnext && (*(unsigned int *) uid_validity == idata->uid_validity)) { evalhc = true; pmodseq = mutt_hcache_fetch_raw(idata->hcache, "/MODSEQ", 7); @@ -1197,11 +1218,11 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, { uid_seqset = imap_hcache_get_uid_seqset(idata); if (uid_seqset) - eval_qresync = 1; + eval_qresync = true; } if (!eval_qresync && has_condstore) - eval_condstore = 1; + eval_condstore = true; } } mutt_hcache_free(idata->hcache, &uid_validity); @@ -1221,9 +1242,13 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, } if ((eval_condstore || eval_qresync) && (hc_modseq != idata->modseq)) + { if (read_headers_condstore_qresync_updates(idata, msn_end, uidnext, hc_modseq, eval_qresync) < 0) + { goto bail; + } + } /* Look for the first empty MSN and start there */ while (msn_begin <= msn_end) @@ -1240,9 +1265,11 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, if (maxuid && (status = imap_mboxcache_get(idata, idata->mailbox, 0)) && (status->uidnext < maxuid + 1)) + { status->uidnext = maxuid + 1; + } -#if USE_HCACHE +#ifdef USE_HCACHE mutt_hcache_store_raw(idata->hcache, "/UIDVALIDITY", 12, &idata->uid_validity, sizeof(idata->uid_validity)); if (maxuid && idata->uidnext < maxuid + 1) @@ -1251,8 +1278,10 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, idata->uidnext = maxuid + 1; } if (idata->uidnext > 1) + { mutt_hcache_store_raw(idata->hcache, "/UIDNEXT", 8, &idata->uidnext, sizeof(idata->uidnext)); + } /* We currently only sync CONDSTORE and QRESYNC on the initial download. * To do it more often, we'll need to deal with flag updates combined with @@ -1262,8 +1291,10 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, if (initial_download) { if (has_condstore || has_qresync) + { mutt_hcache_store_raw(idata->hcache, "/MODSEQ", 7, &idata->modseq, sizeof(idata->modseq)); + } else mutt_hcache_delete(idata->hcache, "/MODSEQ", 7); @@ -1287,7 +1318,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, retval = msn_end; bail: -#if USE_HCACHE +#ifdef USE_HCACHE imap_hcache_close(idata); FREE(&uid_seqset); #endif /* USE_HCACHE */ diff --git a/imap/util.c b/imap/util.c index 81190dee3..ce559e69f 100644 --- a/imap/util.c +++ b/imap/util.c @@ -210,26 +210,30 @@ void imap_clean_path(char *path, size_t plen) } #ifdef USE_HCACHE -/* Generates a seqseq of the UIDs in msn_index to persist in the header cache. +/** + * imap_msn_index_to_uid_seqset - Convert MSN index of UIDs to Seqset + * @param b Buffer for the result + * @param idata Server data * + * Generates a seqseq of the UIDs in msn_index to persist in the header cache. * Empty spots are stored as 0. */ static void imap_msn_index_to_uid_seqset(struct Buffer *b, struct ImapData *idata) { - int first = 1, state = 0, match = 0; - struct Header *cur_header; - unsigned int msn, cur_uid = 0, last_uid = 0; + int first = 1, state = 0; + bool match = false; + unsigned int cur_uid = 0, last_uid = 0; unsigned int range_begin = 0, range_end = 0; - for (msn = 1; msn <= idata->max_msn + 1; msn++) + for (unsigned int msn = 1; msn <= idata->max_msn + 1; msn++) { - match = 0; + match = false; if (msn <= idata->max_msn) { - cur_header = idata->msn_index[msn - 1]; + struct Header *cur_header = idata->msn_index[msn - 1]; cur_uid = cur_header ? HEADER_DATA(cur_header)->uid : 0; - if (!state || (cur_uid && (cur_uid - 1 == last_uid))) - match = 1; + if (!state || (cur_uid && ((cur_uid - 1) == last_uid))) + match = true; last_uid = cur_uid; } @@ -392,31 +396,38 @@ int imap_hcache_del(struct ImapData *idata, unsigned int uid) return mutt_hcache_delete(idata->hcache, key, imap_hcache_keylen(key)); } +/** + * imap_hcache_store_uid_seqset - Store a UID Sequence Set in the header cache + * @param idata Server data + * @retval 0 Success + * @retval -1 Error + */ int imap_hcache_store_uid_seqset(struct ImapData *idata) { - struct Buffer *b; - size_t seqset_size; - int rc; - if (!idata->hcache) return -1; - b = mutt_buffer_new(); + struct Buffer *b = mutt_buffer_new(); /* The seqset is likely large. Preallocate to reduce reallocs */ mutt_buffer_increase_size(b, HUGE_STRING); imap_msn_index_to_uid_seqset(b, idata); - seqset_size = b->dptr - b->data; + size_t seqset_size = b->dptr - b->data; if (seqset_size == 0) b->data[0] = '\0'; - rc = mutt_hcache_store_raw(idata->hcache, "/UIDSEQSET", 10, b->data, - seqset_size + 1); + int rc = mutt_hcache_store_raw(idata->hcache, "/UIDSEQSET", 10, b->data, seqset_size + 1); mutt_debug(5, "Stored /UIDSEQSET %s\n", b->data); mutt_buffer_free(&b); return rc; } +/** + * imap_hcache_clear_uid_seqset - Delete a UID Sequence Set from the header cache + * @param idata Server data + * @retval 0 Success + * @retval -1 Error + */ int imap_hcache_clear_uid_seqset(struct ImapData *idata) { if (!idata->hcache) @@ -425,15 +436,19 @@ int imap_hcache_clear_uid_seqset(struct ImapData *idata) return mutt_hcache_delete(idata->hcache, "/UIDSEQSET", 10); } +/** + * imap_hcache_get_uid_seqset - Get a UID Sequence Set from the header cache + * @param idata Server data + * @retval ptr UID Sequence Set + * @retval NULL Error + */ char *imap_hcache_get_uid_seqset(struct ImapData *idata) { - char *hc_seqset, *seqset; - if (!idata->hcache) return NULL; - hc_seqset = mutt_hcache_fetch_raw(idata->hcache, "/UIDSEQSET", 10); - seqset = mutt_str_strdup(hc_seqset); + char *hc_seqset = mutt_hcache_fetch_raw(idata->hcache, "/UIDSEQSET", 10); + char *seqset = mutt_str_strdup(hc_seqset); mutt_hcache_free(idata->hcache, (void **) &hc_seqset); mutt_debug(5, "Retrieved /UIDSEQSET %s\n", NONULL(seqset)); @@ -1131,8 +1146,11 @@ int imap_account_match(const struct Account *a1, const struct Account *a2) return mutt_account_match(a1_canon, a2_canon); } -/* Sequence set iteration */ - +/** + * mutt_seqset_iterator_new - Create a new Sequence Set Iterator + * @param seqset Source Sequence Set + * @retval ptr Newly allocated Sequence Set Iterator + */ struct SeqsetIterator *mutt_seqset_iterator_new(const char *seqset) { struct SeqsetIterator *iter; @@ -1148,9 +1166,13 @@ struct SeqsetIterator *mutt_seqset_iterator_new(const char *seqset) return iter; } -/* Returns: 0 when the next sequence is generated - * 1 when the iterator is finished - * -1 on error +/** + * mutt_seqset_iterator_next - Get the next UID from a Sequence Set + * @param[in] iter Sequence Set Iterator + * @param[out] next Next UID in set + * @retval 0 Next sequence is generated + * @retval 1 Iterator is finished + * @retval -1 error */ int mutt_seqset_iterator_next(struct SeqsetIterator *iter, unsigned int *next) { @@ -1161,9 +1183,11 @@ int mutt_seqset_iterator_next(struct SeqsetIterator *iter, unsigned int *next) if (iter->in_range) { - if ((iter->down && iter->range_cur == (iter->range_end - 1)) || - (!iter->down && iter->range_cur == (iter->range_end + 1))) + if ((iter->down && (iter->range_cur == (iter->range_end - 1))) || + (!iter->down && (iter->range_cur == (iter->range_end + 1)))) + { iter->in_range = 0; + } } if (!iter->in_range) @@ -1184,11 +1208,11 @@ int mutt_seqset_iterator_next(struct SeqsetIterator *iter, unsigned int *next) if (range_sep) *range_sep++ = '\0'; - if (mutt_str_atoui(iter->substr_cur, &iter->range_cur)) + if (mutt_str_atoui(iter->substr_cur, &iter->range_cur) != 0) return -1; if (range_sep) { - if (mutt_str_atoui(range_sep, &iter->range_end)) + if (mutt_str_atoui(range_sep, &iter->range_end) != 0) return -1; } else @@ -1207,14 +1231,16 @@ int mutt_seqset_iterator_next(struct SeqsetIterator *iter, unsigned int *next) return 0; } +/** + * mutt_seqset_iterator_free - Free a Sequence Set Iterator + * @param p_iter Iterator to free + */ void mutt_seqset_iterator_free(struct SeqsetIterator **p_iter) { - struct SeqsetIterator *iter; - if (!p_iter || !*p_iter) return; - iter = *p_iter; + struct SeqsetIterator *iter = *p_iter; FREE(&iter->full_seqset); - FREE(p_iter); /* __FREE_CHECKED__ */ + FREE(p_iter); } diff --git a/init.h b/init.h index 50b572ec5..854075566 100644 --- a/init.h +++ b/init.h @@ -1423,16 +1423,16 @@ struct ConfigDef MuttVars[] = { */ { "imap_condstore", DT_BOOL, R_NONE, &ImapCondStore, 0 }, /* - ** .pp - ** When \fIset\fP, mutt will use the CONDSTORE extension (RFC 7162) - ** if advertised by the server. Mutt's current implementation is basic, - ** used only for initial message fetching and flag updates. - ** .pp - ** For some IMAP servers, enabling this will slightly speed up - ** downloading initial messages. Unfortunately, Gmail is not one - ** those, and displays worse performance when enabled. Your - ** mileage may vary. - */ + ** .pp + ** When \fIset\fP, mutt will use the CONDSTORE extension (RFC 7162) + ** if advertised by the server. Mutt's current implementation is basic, + ** used only for initial message fetching and flag updates. + ** .pp + ** For some IMAP servers, enabling this will slightly speed up + ** downloading initial messages. Unfortunately, Gmail is not one + ** those, and displays worse performance when enabled. Your + ** mileage may vary. + */ { "imap_delim_chars", DT_STRING, R_NONE, &ImapDelimChars, IP "/." }, /* ** .pp @@ -1545,15 +1545,15 @@ struct ConfigDef MuttVars[] = { */ { "imap_qresync", DT_BOOL, R_NONE, &ImapQResync, 0 }, /* - ** .pp - ** When \fIset\fP, mutt will use the QRESYNC extension (RFC 7162) - ** if advertised by the server. Mutt's current implementation is basic, - ** used only for initial message fetching and flag updates. - ** .pp - ** Note: this feature is currently experimental. If you experience - ** strange behavior, such as duplicate or missing messages please - ** file a bug report to let us know. - */ + ** .pp + ** When \fIset\fP, mutt will use the QRESYNC extension (RFC 7162) + ** if advertised by the server. Mutt's current implementation is basic, + ** used only for initial message fetching and flag updates. + ** .pp + ** Note: this feature is currently experimental. If you experience + ** strange behavior, such as duplicate or missing messages please + ** file a bug report to let us know. + */ { "imap_servernoise", DT_BOOL, R_NONE, &ImapServernoise, true }, /* ** .pp diff --git a/mutt/string.c b/mutt/string.c index a776e41f5..3b3cd7d76 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -277,11 +277,16 @@ int mutt_str_atoul(const char *str, unsigned long *dst) return 0; } -/* NOTE: this function's return value is different from mutt_atol. +/** + * mutt_str_atoull - Convert ASCII string to an unsigned long long + * @param[in] str String to read + * @param[out] dst Store the result + * @retval 1 Successful conversion, with trailing characters + * @retval 0 Successful conversion + * @retval -1 Invalid input * - * returns: 1 - successful conversion, with trailing characters - * 0 - successful conversion - * -1 - invalid input + * @note This function's return value differs from the other functions. + * They return -1 if there is input beyond the number. */ int mutt_str_atoull(const char *str, unsigned long long *dst) { @@ -298,9 +303,9 @@ int mutt_str_atoull(const char *str, unsigned long long *dst) errno = 0; *res = strtoull(str, &e, 10); - if (*res == ULLONG_MAX && errno == ERANGE) + if ((*res == ULLONG_MAX) && (errno == ERANGE)) return -1; - if (e && *e != '\0') + if (e && (*e != '\0')) return 1; return 0; } diff --git a/mutt_account.c b/mutt_account.c index bd7b7d51c..29d697024 100644 --- a/mutt_account.c +++ b/mutt_account.c @@ -46,8 +46,8 @@ char *ImapPass; ///< Config: (imap) Password for the IMAP server char *NntpPass; ///< Config: (nntp) Password for the news server char *NntpUser; ///< Config: (nntp) Username for the news server char *PopOauthRefreshCmd; ///< Config: (pop) External command to generate OAUTH refresh token -char *PopPass; ///< Config: (pop) Password of the POP server -char *PopUser; ///< Config: (pop) Username of the POP server +char *PopPass; ///< Config: (pop) Password of the POP server +char *PopUser; ///< Config: (pop) Username of the POP server char *SmtpOauthRefreshCmd; ///< Config: (smtp) External command to generate OAUTH refresh token char *SmtpPass; ///< Config: (smtp) Password for the SMTP server diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 38b57e41f..4c7302d99 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -332,9 +332,9 @@ static int pgp_check_pgp_decryption_okay_regex(FILE *fpin) * pgp_check_decryption_okay - Check GPG output for status codes * @param fpin File to read from * @retval 1 - no patterns were matched (if delegated to decryption_okay_regex) - * @retval 0 - DECRYPTION_OKAY was seen, with no PLAINTEXT outside. + * @retval 0 - DECRYPTION_OKAY was seen, with no PLAINTEXT outside * @retval -1 - No decryption status codes were encountered - * @retval -2 - PLAINTEXT was encountered outside of DECRYPTION delimeters. + * @retval -2 - PLAINTEXT was encountered outside of DECRYPTION delimeters * @retval -3 - DECRYPTION_FAILED was encountered * * Checks GnuPGP status fd output for various status codes indicating diff --git a/pop/pop.c b/pop/pop.c index e204720f6..62fc18f7c 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -67,7 +67,7 @@ struct BodyCache; short PopCheckinterval; ///< Config: (pop) Interval between checks for new mail unsigned char PopDelete; ///< Config: (pop) After downloading POP messages, delete them on the server char *PopHost; ///< Config: (pop) Url of the POP server -bool PopLast; ///< Config: (pop) Use the 'LAST' command to fetch new mail +bool PopLast; ///< Config: (pop) Use the 'LAST' command to fetch new mail #ifdef USE_HCACHE #define HC_FNAME "neomutt" /* filename for hcache as POP lacks paths */ diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 568f5c694..afddbca53 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -361,10 +361,11 @@ static enum PopAuthRes pop_auth_oauth(struct PopData *pop_data, const char *meth snprintf(auth_cmd, auth_cmd_len, "AUTH OAUTHBEARER %s\r\n", oauthbearer); FREE(&oauthbearer); - ret = pop_query_d(pop_data, auth_cmd, strlen(auth_cmd), + ret = + pop_query_d(pop_data, auth_cmd, strlen(auth_cmd), #ifdef DEBUG - /* don't print the bearer token unless we're at the ungodly debugging level */ - (DebugLevel < MUTT_SOCK_LOG_FULL) ? "AUTH OAUTHBEARER *\r\n" : + /* don't print the bearer token unless we're at the ungodly debugging level */ + (DebugLevel < MUTT_SOCK_LOG_FULL) ? "AUTH OAUTHBEARER *\r\n" : #endif NULL); FREE(&auth_cmd); -- 2.40.0