From bfccf0c7292dcca0ced4c5585dff4ed86a82cdf1 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sun, 1 Apr 2018 18:48:49 +0100 Subject: [PATCH] rename rfc822 functions --- buffy.c | 2 +- handler.c | 2 +- header.c | 4 ++-- imap/message.c | 10 +++++----- main.c | 2 +- mbox.c | 4 ++-- mh.c | 2 +- nntp.c | 8 ++++---- parse.c | 24 ++++++++++++------------ pattern.c | 2 +- pop.c | 4 ++-- postpone.c | 2 +- protos.h | 10 +++++----- send.c | 4 ++-- sendlib.c | 14 +++++++------- url.c | 4 ++-- 16 files changed, 49 insertions(+), 49 deletions(-) diff --git a/buffy.c b/buffy.c index 030aede89..652f4ebd5 100644 --- a/buffy.c +++ b/buffy.c @@ -124,7 +124,7 @@ static int test_last_status_new(FILE *f) return 0; hdr = mutt_header_new(); - tmp_envelope = mutt_read_rfc822_header(f, hdr, 0, 0); + tmp_envelope = mutt_rfc822_read_header(f, hdr, 0, 0); if (!(hdr->read || hdr->old)) result = 1; diff --git a/handler.c b/handler.c index 3919ce623..9609925e5 100644 --- a/handler.c +++ b/handler.c @@ -1196,7 +1196,7 @@ static int message_handler(struct Body *a, struct State *s) fstat(fileno(s->fpin), &st); b = mutt_body_new(); b->length = (LOFF_T) st.st_size; - b->parts = mutt_parse_message_rfc822(s->fpin, b); + b->parts = mutt_rfc822_parse_message(s->fpin, b); } else b = a; diff --git a/header.c b/header.c index 212127cc7..6ac9a7698 100644 --- a/header.c +++ b/header.c @@ -60,7 +60,7 @@ void mutt_edit_headers(const char *editor, const char *body, struct Header *msg, } mutt_env_to_local(msg->env); - mutt_write_rfc822_header(ofp, msg->env, NULL, 1, 0); + mutt_rfc822_write_header(ofp, msg->env, NULL, 1, 0); fputc('\n', ofp); /* tie off the header. */ /* now copy the body of the message. */ @@ -115,7 +115,7 @@ void mutt_edit_headers(const char *editor, const char *body, struct Header *msg, return; } - n = mutt_read_rfc822_header(ifp, NULL, 1, 0); + n = mutt_rfc822_read_header(ifp, NULL, 1, 0); while ((i = fread(buffer, 1, sizeof(buffer), ifp)) > 0) fwrite(buffer, 1, i, ofp); mutt_file_fclose(&ofp); diff --git a/imap/message.c b/imap/message.c index 5ad3b32ce..263ce1f82 100644 --- a/imap/message.c +++ b/imap/message.c @@ -883,10 +883,10 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i maxuid = h.data->uid; rewind(fp); - /* NOTE: if Date: header is missing, mutt_read_rfc822_header depends + /* NOTE: if Date: header is missing, mutt_rfc822_read_header depends * on h.received being set */ - ctx->hdrs[idx]->env = mutt_read_rfc822_header(fp, ctx->hdrs[idx], 0, 0); - /* content built as a side-effect of mutt_read_rfc822_header */ + ctx->hdrs[idx]->env = mutt_rfc822_read_header(fp, ctx->hdrs[idx], 0, 0); + /* content built as a side-effect of mutt_rfc822_read_header */ ctx->hdrs[idx]->content->length = h.content_length; ctx->size += h.content_length; @@ -1156,10 +1156,10 @@ parsemsg: /* It may be that the Status header indicates a message is read, but the * IMAP server doesn't know the message has been \Seen. So we capture * 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 + * picked up in mutt_rfc822_read_header, we mark the message (and context * changed). Another possibility: ignore Status on IMAP? */ read = h->read; - newenv = mutt_read_rfc822_header(msg->fp, h, 0, 0); + newenv = mutt_rfc822_read_header(msg->fp, h, 0, 0); mutt_env_merge(h->env, &newenv); /* see above. We want the new status in h->read, so we unset it manually diff --git a/main.c b/main.c index f57d6b9d9..c33a86796 100644 --- a/main.c +++ b/main.c @@ -923,7 +923,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_env_to_intl(msg->env, NULL, NULL); } - mutt_write_rfc822_header(fout, msg->env, msg->content, -1, 0); + mutt_rfc822_write_header(fout, msg->env, msg->content, -1, 0); if (ResumeEditedDraftFiles) fprintf(fout, "X-Mutt-Resume-Draft: 1\n"); fputc('\n', fout); diff --git a/mbox.c b/mbox.c index a72f462c3..6a846771e 100644 --- a/mbox.c +++ b/mbox.c @@ -169,7 +169,7 @@ static int mmdf_parse_mailbox(struct Context *ctx) else hdr->received = t - mutt_date_local_tz(t); - hdr->env = mutt_read_rfc822_header(ctx->fp, hdr, 0, 0); + hdr->env = mutt_rfc822_read_header(ctx->fp, hdr, 0, 0); loc = ftello(ctx->fp); if (loc < 0) @@ -314,7 +314,7 @@ static int mbox_parse_mailbox(struct Context *ctx) curhdr->offset = loc; curhdr->index = ctx->msgcount; - curhdr->env = mutt_read_rfc822_header(ctx->fp, curhdr, 0, 0); + curhdr->env = mutt_rfc822_read_header(ctx->fp, curhdr, 0, 0); /* if we know how long this message is, either just skip over the body, * or if we don't know how many lines there are, count them now (this will diff --git a/mh.c b/mh.c index 57c0a1204..b97d06e45 100644 --- a/mh.c +++ b/mh.c @@ -784,7 +784,7 @@ struct Header *maildir_parse_stream(int magic, FILE *f, const char *fname, if (!h) h = mutt_header_new(); - h->env = mutt_read_rfc822_header(f, h, 0, 0); + h->env = mutt_rfc822_read_header(f, h, 0, 0); fstat(fileno(f), &st); diff --git a/nntp.c b/nntp.c index 61363e78d..5fbc286ed 100644 --- a/nntp.c +++ b/nntp.c @@ -1134,7 +1134,7 @@ static int parse_overview_line(char *line, void *data) /* parse header */ hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new(); - hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0); + hdr->env = mutt_rfc822_read_header(fp, hdr, 0, 0); hdr->env->newsgroups = mutt_str_strdup(nntp_data->group); hdr->received = hdr->date_sent; mutt_file_fclose(&fp); @@ -1387,7 +1387,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, /* parse header */ hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new(); - hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0); + hdr->env = mutt_rfc822_read_header(fp, hdr, 0, 0); hdr->received = hdr->date_sent; mutt_file_fclose(&fp); unlink(tempfile); @@ -1667,7 +1667,7 @@ static int nntp_open_message(struct Context *ctx, struct Message *msg, int msgno mutt_hash_delete(ctx->subj_hash, hdr->env->real_subj, hdr); mutt_env_free(&hdr->env); - hdr->env = mutt_read_rfc822_header(msg->fp, hdr, 0, 0); + hdr->env = mutt_rfc822_read_header(msg->fp, hdr, 0, 0); if (ctx->id_hash && hdr->env->message_id) mutt_hash_insert(ctx->id_hash, hdr->env->message_id, hdr); @@ -2391,7 +2391,7 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid) mx_alloc_memory(ctx); hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new(); hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData)); - hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0); + hdr->env = mutt_rfc822_read_header(fp, hdr, 0, 0); mutt_file_fclose(&fp); unlink(tempfile); diff --git a/parse.c b/parse.c index bf80ab4ec..5b04b120f 100644 --- a/parse.c +++ b/parse.c @@ -45,13 +45,13 @@ struct Context; /** - * mutt_read_rfc822_line - Read a header line from a file + * mutt_rfc822_read_line - Read a header line from a file * * Reads an arbitrarily long header field, and looks ahead for continuation * lines. ``line'' must point to a dynamically allocated string; it is * increased if more space is required to fit the whole line. */ -char *mutt_read_rfc822_line(FILE *f, char *line, size_t *linelen) +char *mutt_rfc822_read_line(FILE *f, char *line, size_t *linelen) { char *buf = line; int ch; @@ -427,7 +427,7 @@ struct Body *mutt_read_mime_header(FILE *fp, int digest) p->type = digest ? TYPEMESSAGE : TYPETEXT; p->disposition = DISPINLINE; - while (*(line = mutt_read_rfc822_line(fp, line, &linelen)) != 0) + while (*(line = mutt_rfc822_read_line(fp, line, &linelen)) != 0) { /* Find the value of the current header */ c = strchr(line, ':'); @@ -513,7 +513,7 @@ void mutt_parse_part(FILE *fp, struct Body *b) { fseeko(fp, b->offset, SEEK_SET); if (mutt_is_message_type(b->type, b->subtype)) - b->parts = mutt_parse_message_rfc822(fp, b); + b->parts = mutt_rfc822_parse_message(fp, b); else if (mutt_str_strcasecmp(b->subtype, "external-body") == 0) b->parts = mutt_read_mime_header(fp, 0); else @@ -534,19 +534,19 @@ void mutt_parse_part(FILE *fp, struct Body *b) } /** - * mutt_parse_message_rfc822 - parse a Message/RFC822 body + * mutt_rfc822_parse_message - parse a Message/RFC822 body * @param fp stream to read from * @param parent info about the message/rfc822 body part * * NOTE: this assumes that `parent->length' has been set! */ -struct Body *mutt_parse_message_rfc822(FILE *fp, struct Body *parent) +struct Body *mutt_rfc822_parse_message(FILE *fp, struct Body *parent) { struct Body *msg = NULL; parent->hdr = mutt_header_new(); parent->hdr->offset = ftello(fp); - parent->hdr->env = mutt_read_rfc822_header(fp, parent->hdr, 0, 0); + parent->hdr->env = mutt_rfc822_read_header(fp, parent->hdr, 0, 0); msg = parent->hdr->content; /* ignore the length given in the content-length since it could be wrong @@ -756,7 +756,7 @@ void mutt_parse_mime_message(struct Context *ctx, struct Header *cur) cur->attach_valid = false; } -int mutt_parse_rfc822_line(struct Envelope *e, struct Header *hdr, char *line, +int mutt_rfc822_parse_line(struct Envelope *e, struct Header *hdr, char *line, char *p, short user_hdrs, short weed, short do_2047) { int matched = 0; @@ -1135,7 +1135,7 @@ int mutt_parse_rfc822_line(struct Envelope *e, struct Header *hdr, char *line, } /** - * mutt_read_rfc822_header - parses an RFC822 header + * mutt_rfc822_read_header - parses an RFC822 header * @param f Stream to read from * @param hdr Header structure of current message (optional) * @param user_hdrs If set, store user headers @@ -1147,7 +1147,7 @@ int mutt_parse_rfc822_line(struct Envelope *e, struct Header *hdr, char *line, * * Caller should free the Envelope using mutt_env_free(). */ -struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, +struct Envelope *mutt_rfc822_read_header(FILE *f, struct Header *hdr, short user_hdrs, short weed) { struct Envelope *e = mutt_env_new(); @@ -1176,7 +1176,7 @@ struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, while ((loc = ftello(f)) != -1) { - line = mutt_read_rfc822_line(f, line, &linelen); + line = mutt_rfc822_read_line(f, line, &linelen); if (*line == '\0') break; p = strpbrk(line, ": \t"); @@ -1247,7 +1247,7 @@ struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, if (!*p) continue; /* skip empty header fields */ - mutt_parse_rfc822_line(e, hdr, line, p, user_hdrs, weed, 1); + mutt_rfc822_parse_line(e, hdr, line, p, user_hdrs, weed, 1); } FREE(&line); diff --git a/pattern.c b/pattern.c index 6a49d03f3..b38700101 100644 --- a/pattern.c +++ b/pattern.c @@ -1014,7 +1014,7 @@ static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno) { if (pat->op == MUTT_HEADER) { - buf = mutt_read_rfc822_line(fp, buf, &blen); + buf = mutt_rfc822_read_line(fp, buf, &blen); if (*buf == '\0') break; } diff --git a/pop.c b/pop.c index df6275b23..c53128cd6 100644 --- a/pop.c +++ b/pop.c @@ -129,7 +129,7 @@ static int pop_read_header(struct PopData *pop_data, struct Header *h) case 0: { rewind(f); - h->env = mutt_read_rfc822_header(f, h, 0, 0); + h->env = mutt_rfc822_read_header(f, h, 0, 0); h->content->length = length - h->content->offset + 1; rewind(f); while (!feof(f)) @@ -658,7 +658,7 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno mutt_hash_delete(ctx->subj_hash, h->env->real_subj, h); mutt_label_hash_remove(ctx, h); mutt_env_free(&h->env); - h->env = mutt_read_rfc822_header(msg->fp, h, 0, 0); + h->env = mutt_rfc822_read_header(msg->fp, h, 0, 0); if (ctx->subj_hash && h->env->real_subj) mutt_hash_insert(ctx->subj_hash, h->env->real_subj, h); mutt_label_hash_add(ctx, h); diff --git a/postpone.c b/postpone.c index ca34158f0..08473288c 100644 --- a/postpone.c +++ b/postpone.c @@ -557,7 +557,7 @@ int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr, fseeko(fp, hdr->offset, SEEK_SET); newhdr->offset = hdr->offset; /* enable header weeding for resent messages */ - newhdr->env = mutt_read_rfc822_header(fp, newhdr, 1, resend); + newhdr->env = mutt_rfc822_read_header(fp, newhdr, 1, resend); newhdr->content->length = hdr->content->length; mutt_parse_part(fp, newhdr->content); diff --git a/protos.h b/protos.h index 514cb1532..4ede8ca42 100644 --- a/protos.h +++ b/protos.h @@ -108,13 +108,13 @@ struct Body *mutt_make_message_attach(struct Context *ctx, struct Header *hdr, i struct Body *mutt_remove_multipart(struct Body *b); struct Body *mutt_make_multipart(struct Body *b); struct Body *mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off, int digest); -struct Body *mutt_parse_message_rfc822(FILE *fp, struct Body *parent); +struct Body *mutt_rfc822_parse_message(FILE *fp, struct Body *parent); struct Body *mutt_read_mime_header(FILE *fp, int digest); struct Content *mutt_get_content_info(const char *fname, struct Body *b); -char *mutt_read_rfc822_line(FILE *f, char *line, size_t *linelen); -struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, short user_hdrs, short weed); +char *mutt_rfc822_read_line(FILE *f, char *line, size_t *linelen); +struct Envelope *mutt_rfc822_read_header(FILE *f, struct Header *hdr, short user_hdrs, short weed); int is_from(const char *s, char *path, size_t pathlen, time_t *tp); @@ -295,7 +295,7 @@ int mutt_parse_mono(struct Buffer *buf, struct Buffer *s, unsigned long data, st int mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); int mutt_parse_push(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); int mutt_parse_rc_line(/* const */ char *line, struct Buffer *token, struct Buffer *err); -int mutt_parse_rfc822_line(struct Envelope *e, struct Header *hdr, char *line, char *p, +int mutt_rfc822_parse_line(struct Envelope *e, struct Header *hdr, char *line, char *p, short user_hdrs, short weed, short do_2047); int mutt_parse_score(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); int mutt_parse_unscore(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); @@ -325,7 +325,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f); int mutt_write_mime_header(struct Body *a, FILE *f); int mutt_write_one_header(FILE *fp, const char *tag, const char *value, const char *pfx, int wraplen, int flags); -int mutt_write_rfc822_header(FILE *fp, struct Envelope *env, struct Body *attach, int mode, int privacy); +int mutt_rfc822_write_header(FILE *fp, struct Envelope *env, struct Body *attach, int mode, int privacy); void mutt_write_references(const struct ListHead *r, FILE *f, size_t trim); int mutt_yesorno(const char *msg, int def); void mutt_set_header_color(struct Context *ctx, struct Header *curhdr); diff --git a/send.c b/send.c index 5819450b9..8da3b80c1 100644 --- a/send.c +++ b/send.c @@ -1075,10 +1075,10 @@ static int send_message(struct Header *msg) WriteBcc = false; #endif #ifdef MIXMASTER - mutt_write_rfc822_header(tempfp, msg->env, msg->content, 0, !STAILQ_EMPTY(&msg->chain)); + mutt_rfc822_write_header(tempfp, msg->env, msg->content, 0, !STAILQ_EMPTY(&msg->chain)); #endif #ifndef MIXMASTER - mutt_write_rfc822_header(tempfp, msg->env, msg->content, 0, 0); + mutt_rfc822_write_header(tempfp, msg->env, msg->content, 0, 0); #endif #ifdef USE_SMTP if (old_write_bcc) diff --git a/sendlib.c b/sendlib.c index 8d07332dc..fbfbbf9b8 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1192,7 +1192,7 @@ void mutt_message_to_7bit(struct Body *a, FILE *fp) goto cleanup; fseeko(fpin, a->offset, SEEK_SET); - a->parts = mutt_parse_message_rfc822(fpin, a); + a->parts = mutt_rfc822_parse_message(fpin, a); transform_to_7bit(a->parts, fpin); @@ -1418,7 +1418,7 @@ struct Body *mutt_make_message_attach(struct Context *ctx, struct Header *hdr, i body->hdr = mutt_header_new(); body->hdr->offset = 0; /* we don't need the user headers here */ - body->hdr->env = mutt_read_rfc822_header(fp, body->hdr, 0, 0); + body->hdr->env = mutt_rfc822_read_header(fp, body->hdr, 0, 0); if (WithCrypto) body->hdr->security = pgp; mutt_update_encoding(body); @@ -2007,7 +2007,7 @@ out: * anonymous remailer chains. */ -int mutt_write_rfc822_header(FILE *fp, struct Envelope *env, +int mutt_rfc822_write_header(FILE *fp, struct Envelope *env, struct Body *attach, int mode, int privacy) { char buffer[LONG_STRING]; @@ -2976,10 +2976,10 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid, goto done; } - /* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header() - * post == 0 => Normal mode. Set mode = 0 in mutt_write_rfc822_header() + /* post == 1 => postpone message. Set mode = -1 in mutt_rfc822_write_header() + * post == 0 => Normal mode. Set mode = 0 in mutt_rfc822_write_header() * */ - mutt_write_rfc822_header(msg->fp, hdr->env, hdr->content, post ? -post : 0, 0); + mutt_rfc822_write_header(msg->fp, hdr->env, hdr->content, post ? -post : 0, 0); /* (postponement) if this was a reply of some sort, contains the * Message-ID: of message replied to. Save it using a special X-Mutt- @@ -2999,7 +2999,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid, if (f.magic == MUTT_MMDF || f.magic == MUTT_MBOX) fprintf(msg->fp, "Status: RO\n"); - /* mutt_write_rfc822_header() only writes out a Date: header with + /* mutt_rfc822_write_header() only writes out a Date: header with * mode == 0, i.e. _not_ postponement; so write out one ourself */ if (post) fprintf(msg->fp, "%s", mutt_date_make_date(buf, sizeof(buf))); diff --git a/url.c b/url.c index 2ac66cf04..186dfbb80 100644 --- a/url.c +++ b/url.c @@ -412,9 +412,9 @@ int url_parse_mailto(struct Envelope *e, char **body, const char *src) size_t taglen = mutt_str_strlen(tag); safe_asprintf(&scratch, "%s: %s", tag, value); - scratch[taglen] = 0; /* overwrite the colon as mutt_parse_rfc822_line expects */ + scratch[taglen] = 0; /* overwrite the colon as mutt_rfc822_parse_line expects */ value = mutt_str_skip_email_wsp(&scratch[taglen + 1]); - mutt_parse_rfc822_line(e, NULL, scratch, value, 1, 0, 1); + mutt_rfc822_parse_line(e, NULL, scratch, value, 1, 0, 1); FREE(&scratch); } } -- 2.40.0