From: Mehdi Abaakouk Date: Wed, 20 Sep 2017 12:29:22 +0000 (+0200) Subject: tags: rename hdr_tags to driver_tags X-Git-Tag: neomutt-20171006~8^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9cbb67fce10a1d90c0d5ebf657efbf5bf22f9347;p=neomutt tags: rename hdr_tags to driver_tags To avoid confusion about hdr_tags and tags in X-Label headers. This renames all hdr_tags_* in drvier_tags_*. --- diff --git a/copy.c b/copy.c index 0934b48a6..c4300c5d6 100644 --- a/copy.c +++ b/copy.c @@ -465,7 +465,7 @@ int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const cha fputs(buf, out); fputc('\n', out); } - const char *tags = hdr_tags_get(h); + const char *tags = driver_tags_get(h); if (tags && !(option(OPT_WEED) && mutt_matches_ignore("tags"))) { fputs("Tags: ", out); diff --git a/curs_main.c b/curs_main.c index 2f522c4d4..d33d3ded7 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1866,7 +1866,7 @@ int mutt_index_menu(void) CHECK_VISIBLE; CHECK_READONLY; - rc = hdr_tags_editor(Context, tag ? NULL : hdr_tags_get_with_hidden(CURHDR), buf, sizeof(buf)); + rc = driver_tags_editor(Context, tag ? NULL : driver_tags_get_with_hidden(CURHDR), buf, sizeof(buf)); if (rc < 0) break; else if (rc == 0) @@ -1897,7 +1897,7 @@ int mutt_index_menu(void) { if (!Context->quiet) mutt_progress_update(&progress, ++px, -1); - hdr_tags_commit(Context, Context->hdrs[Context->v2r[j]], buf); + driver_tags_commit(Context, Context->hdrs[Context->v2r[j]], buf); if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE) { bool still_queried = false; @@ -1919,7 +1919,7 @@ int mutt_index_menu(void) } else { - if (hdr_tags_commit(Context, CURHDR, buf)) + if (driver_tags_commit(Context, CURHDR, buf)) { mutt_message(_("Failed to modify tags, aborting.")); break; diff --git a/hdrline.c b/hdrline.c index 734378b2a..d3bd88e67 100644 --- a/hdrline.c +++ b/hdrline.c @@ -845,10 +845,10 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co { colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_TAGS); mutt_format_s(dest + colorlen, destlen - colorlen, prefix, - hdr_tags_get_transformed(hdr)); + driver_tags_get_transformed(hdr)); add_index_color(dest + colorlen, destlen - colorlen, flags, MT_COLOR_INDEX); } - else if (!hdr_tags_get_transformed(hdr)) + else if (!driver_tags_get_transformed(hdr)) optional = 0; break; @@ -866,7 +866,7 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co tag = hash_find(TagFormats, format); if (tag) { - tag_transformed = hdr_tags_get_transformed_for(tag, hdr); + tag_transformed = driver_tags_get_transformed_for(tag, hdr); colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_TAG); mutt_format_s(dest + colorlen, destlen - colorlen, prefix, (tag_transformed) ? tag_transformed : ""); @@ -882,7 +882,7 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co tag = hash_find(TagFormats, format); if (tag) - if (hdr_tags_get_transformed_for(tag, hdr) == NULL) + if (driver_tags_get_transformed_for(tag, hdr) == NULL) optional = 0; } break; @@ -904,7 +904,7 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co break; case 'J':; - const char *tags = hdr_tags_get_transformed(hdr); + const char *tags = driver_tags_get_transformed(hdr); if (tags) { i = 1; /* reduce reuse recycle */ @@ -912,13 +912,13 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co if (flags & MUTT_FORMAT_TREE && (hdr->thread->prev && hdr->thread->prev->message && - hdr_tags_get_transformed(hdr->thread->prev->message))) + driver_tags_get_transformed(hdr->thread->prev->message))) htmp = hdr->thread->prev->message; else if (flags & MUTT_FORMAT_TREE && (hdr->thread->parent && hdr->thread->parent->message && - hdr_tags_get_transformed(hdr->thread->parent->message))) + driver_tags_get_transformed(hdr->thread->parent->message))) htmp = hdr->thread->parent->message; - if (htmp && mutt_strcasecmp(tags, hdr_tags_get_transformed(htmp)) == 0) + if (htmp && mutt_strcasecmp(tags, driver_tags_get_transformed(htmp)) == 0) i = 0; } else diff --git a/imap/imap.c b/imap/imap.c index f18a1cc7a..5cc37763e 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1172,8 +1172,8 @@ int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, if (HEADER_DATA(hdr)->flags_system) safe_strcat(flags, sizeof(flags), HEADER_DATA(hdr)->flags_system); /* set custom flags */ - if (hdr_tags_get_with_hidden(hdr)) - safe_strcat(flags, sizeof(flags), hdr_tags_get_with_hidden(hdr)); + if (driver_tags_get_with_hidden(hdr)) + safe_strcat(flags, sizeof(flags), driver_tags_get_with_hidden(hdr)); } mutt_remove_trailing_ws(flags); @@ -1221,7 +1221,7 @@ int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, /* server have now the updated flags */ FREE(&HEADER_DATA(hdr)->flags_remote); - HEADER_DATA(hdr)->flags_remote = safe_strdup(hdr_tags_get_with_hidden(hdr)); + HEADER_DATA(hdr)->flags_remote = safe_strdup(driver_tags_get_with_hidden(hdr)); hdr->active = true; if (hdr->deleted == HEADER_DATA(hdr)->deleted) @@ -1427,9 +1427,9 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char /* We are good sync them */ mutt_debug(1, "NEW TAGS: %d\n", tags); - hdr_tags_replace(h, tags); + driver_tags_replace(h, tags); FREE(&HEADER_DATA(h)->flags_remote); - HEADER_DATA(h)->flags_remote = safe_strdup(hdr_tags_get_with_hidden(h)); + HEADER_DATA(h)->flags_remote = safe_strdup(driver_tags_get_with_hidden(h)); return 0; } diff --git a/imap/message.c b/imap/message.c index c3c5c9729..60aef1ca7 100644 --- a/imap/message.c +++ b/imap/message.c @@ -636,8 +636,8 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i ctx->hdrs[idx]->changed = h.data->changed; /* ctx->hdrs[msgno]->received is restored from mutt_hcache_restore */ ctx->hdrs[idx]->data = (void *) (h.data); - hdr_tags_init(ctx->hdrs[idx]); - hdr_tags_replace(ctx->hdrs[idx], safe_strdup(h.data->flags_remote)); + driver_tags_init(ctx->hdrs[idx]); + driver_tags_replace(ctx->hdrs[idx], safe_strdup(h.data->flags_remote)); ctx->msgcount++; ctx->size += ctx->hdrs[idx]->content->length; @@ -756,8 +756,8 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i ctx->hdrs[idx]->changed = h.data->changed; ctx->hdrs[idx]->received = h.received; ctx->hdrs[idx]->data = (void *) (h.data); - hdr_tags_init(ctx->hdrs[idx]); - hdr_tags_replace(ctx->hdrs[idx], safe_strdup(h.data->flags_remote)); + driver_tags_init(ctx->hdrs[idx]); + driver_tags_replace(ctx->hdrs[idx], safe_strdup(h.data->flags_remote)); if (maxuid < h.data->uid) maxuid = h.data->uid; @@ -1480,7 +1480,7 @@ char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *ser return NULL; /* Update tags system */ - hdr_tags_replace(h, safe_strdup(hd->flags_remote)); + driver_tags_replace(h, safe_strdup(hd->flags_remote)); /* YAUH (yet another ugly hack): temporarily set context to * read-write even if it's read-only, so *server* updates of diff --git a/mutt_notmuch.c b/mutt_notmuch.c index 83171924c..7e80bafd2 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -856,7 +856,7 @@ static int update_header_tags(struct Header *h, notmuch_message_t *msg) mutt_str_append_item(&new_tags, t, ' '); } - if (hdr_tags_get(h) && new_tags && (strcmp(hdr_tags_get(h), new_tags) == 0)) + if (driver_tags_get(h) && new_tags && (strcmp(driver_tags_get(h), new_tags) == 0)) { FREE(&new_tags); mutt_debug(2, "nm: tags unchanged\n"); @@ -864,9 +864,9 @@ static int update_header_tags(struct Header *h, notmuch_message_t *msg) } /* new version */ - hdr_tags_replace(h, new_tags); - mutt_debug(2, "nm: new tags: '%s'\n", hdr_tags_get(h)); - mutt_debug(2, "nm: new tag transforms: '%s'\n", hdr_tags_get_transformed(h)); + driver_tags_replace(h, new_tags); + mutt_debug(2, "nm: new tags: '%s'\n", driver_tags_get(h)); + mutt_debug(2, "nm: new tag transforms: '%s'\n", driver_tags_get_transformed(h)); return 0; } @@ -962,7 +962,7 @@ static int init_header(struct Header *h, const char *path, notmuch_message_t *ms h->data = safe_calloc(1, sizeof(struct NmHdrData)); h->free_cb = deinit_header; - hdr_tags_init(h); + driver_tags_init(h); /* * Notmuch ensures that message Id exists (if not notmuch Notmuch will @@ -1597,7 +1597,7 @@ static int rename_filename(struct NmCtxData *data, const char *old, { notmuch_message_maildir_flags_to_tags(msg); update_header_tags(h, msg); - update_tags(msg, hdr_tags_get(h)); + update_tags(msg, driver_tags_get(h)); } rc = 0; @@ -2117,7 +2117,7 @@ int nm_record_message(struct Context *ctx, char *path, struct Header *h) { notmuch_message_maildir_flags_to_tags(msg); if (h) - update_tags(msg, hdr_tags_get(h)); + update_tags(msg, driver_tags_get(h)); if (NmRecordTags) update_tags(msg, NmRecordTags); } diff --git a/mutt_tags.c b/mutt_tags.c index 36011946f..4fc60a047 100644 --- a/mutt_tags.c +++ b/mutt_tags.c @@ -30,12 +30,12 @@ #include "mx.h" /** - * hdr_tags_free_tag_list - free tag + * driver_tags_free_tag_list - free tag * @param[in] h: pointer to a Header struct * * Free tag */ -static void hdr_tags_free_tag_list(struct TagList **kw_list) +static void driver_tags_free_tag_list(struct TagList **kw_list) { struct TagList *tmp = NULL; @@ -51,24 +51,24 @@ static void hdr_tags_free_tag_list(struct TagList **kw_list) } /** - * hdr_tags_free - Free tags from a header + * driver_tags_free - Free tags from a header * @param[in] h: pointer to a header struct * * Free the whole tags structure */ -void hdr_tags_free(struct Header *h) +void driver_tags_free(struct Header *h) { if (!h->tags) return; FREE(&h->tags->tags); FREE(&h->tags->tags_transformed); FREE(&h->tags->tags_with_hidden); - hdr_tags_free_tag_list(&h->tags->tag_list); + driver_tags_free_tag_list(&h->tags->tag_list); FREE(h->tags); } /** - * hdr_tags_get_transformed - Get transformed tags from a header + * driver_tags_get_transformed - Get transformed tags from a header * @param[in] h: pointer to a header struct * * @return string transformed tags @@ -76,7 +76,7 @@ void hdr_tags_free(struct Header *h) * Return a string containing all transformed tags separated by space * without hidden tags */ -const char *hdr_tags_get_transformed(struct Header *h) +const char *driver_tags_get_transformed(struct Header *h) { if (!h || !h->tags) return NULL; @@ -86,7 +86,7 @@ const char *hdr_tags_get_transformed(struct Header *h) } /** - * hdr_tags_get - Get tags from a header + * driver_tags_get - Get tags from a header * @param[in] h: pointer to a header struct * * @return string tags @@ -94,7 +94,7 @@ const char *hdr_tags_get_transformed(struct Header *h) * Return a string containing all tags separated by space with * hidden tags */ -const char *hdr_tags_get(struct Header *h) +const char *driver_tags_get(struct Header *h) { if (!h || !h->tags || !h->tags->tags) return NULL; @@ -102,7 +102,7 @@ const char *hdr_tags_get(struct Header *h) } /** - * hdr_tags_get_with_hidden - Get tags with hiddens from a header + * driver_tags_get_with_hidden - Get tags with hiddens from a header * @param[in] h: pointer to a header struct * * @return string tags @@ -110,7 +110,7 @@ const char *hdr_tags_get(struct Header *h) * Return a string containing all tags separated by space * even the hiddens. */ -const char *hdr_tags_get_with_hidden(struct Header *h) +const char *driver_tags_get_with_hidden(struct Header *h) { if (!h || !h->tags || !h->tags->tags_with_hidden) return NULL; @@ -118,7 +118,7 @@ const char *hdr_tags_get_with_hidden(struct Header *h) } /** - * hdr_tags_get_transformed_for - Get tranformed tag for a tag name from a header + * driver_tags_get_transformed_for - Get tranformed tag for a tag name from a header * @param[in] tag: char* to the tag to get the transformed version * @param[in] h: pointer to a header struct * @@ -127,7 +127,7 @@ const char *hdr_tags_get_with_hidden(struct Header *h) * Return a string containing transformed tag that match the tag * even if this is a hidden tags */ -const char *hdr_tags_get_transformed_for(char *name, struct Header *h) +const char *driver_tags_get_transformed_for(char *name, struct Header *h) { if (!h || !h->tags || !h->tags->tag_list) return NULL; @@ -146,7 +146,7 @@ const char *hdr_tags_get_transformed_for(char *name, struct Header *h) return NULL; } -void hdr_tags_init(struct Header *h) +void driver_tags_init(struct Header *h) { h->tags = safe_calloc(1, sizeof(struct HeaderTags)); h->tags->tags = NULL; @@ -156,13 +156,13 @@ void hdr_tags_init(struct Header *h) } /** - * hdr_tags_add - Add a tag to header + * driver_tags_add - Add a tag to header * @param[in] h: pointer to a header struct * @param[in] new_tag: string representing the new tag * * Add a tag to the header tags */ -static void hdr_tags_add(struct Header *h, char *new_tag) +static void driver_tags_add(struct Header *h, char *new_tag) { struct TagList *ttmp = NULL; char *new_tag_transformed = NULL; @@ -201,7 +201,7 @@ static void hdr_tags_add(struct Header *h, char *new_tag) } /** - * hdr_tags_replace - Replace all tags + * driver_tags_replace - Replace all tags * @param[in] h: pointer to a header struct * @param[in] tags: string of all tags separated by space * @@ -211,7 +211,7 @@ static void hdr_tags_add(struct Header *h, char *new_tag) * Free current tags structures and replace it by * new tags */ -int hdr_tags_replace(struct Header *h, char *tags) +int driver_tags_replace(struct Header *h, char *tags) { if (!h) return 0; @@ -219,20 +219,20 @@ int hdr_tags_replace(struct Header *h, char *tags) mutt_strcmp(h->tags->tags, tags) == 0) return 0; - hdr_tags_free(h); - hdr_tags_init(h); + driver_tags_free(h); + driver_tags_init(h); if (tags) { char *tag; while ((tag = strsep(&tags, " "))) - hdr_tags_add(h, tag); + driver_tags_add(h, tag); FREE(&tags); } return 1; } -int hdr_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen) +int driver_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen) { if (ctx->mx_ops->edit_msg_tags) return ctx->mx_ops->edit_msg_tags(ctx, tags, buf, buflen); @@ -241,7 +241,7 @@ int hdr_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buf return -1; } -int hdr_tags_commit(struct Context *ctx, struct Header *h, char *tags) +int driver_tags_commit(struct Context *ctx, struct Header *h, char *tags) { if (ctx->mx_ops->commit_msg_tags) return ctx->mx_ops->commit_msg_tags(ctx, h, tags); diff --git a/mutt_tags.h b/mutt_tags.h index 8f2521d48..708ea1a0f 100644 --- a/mutt_tags.h +++ b/mutt_tags.h @@ -57,14 +57,14 @@ struct HeaderTags struct TagList *tag_list; }; -void hdr_tags_free(struct Header *h); -const char *hdr_tags_get(struct Header *h); -const char *hdr_tags_get_with_hidden(struct Header *h); -const char *hdr_tags_get_transformed(struct Header *h); -const char *hdr_tags_get_transformed_for(char *name, struct Header *h); -void hdr_tags_init(struct Header *h); -int hdr_tags_replace(struct Header *h, char *tags); -int hdr_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen); -int hdr_tags_commit(struct Context *ctx, struct Header *h, char *tags); +void driver_tags_free(struct Header *h); +const char *driver_tags_get(struct Header *h); +const char *driver_tags_get_with_hidden(struct Header *h); +const char *driver_tags_get_transformed(struct Header *h); +const char *driver_tags_get_transformed_for(char *name, struct Header *h); +void driver_tags_init(struct Header *h); +int driver_tags_replace(struct Header *h, char *tags); +int driver_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen); +int driver_tags_commit(struct Context *ctx, struct Header *h, char *tags); #endif /* _MUTT_TAG_H */ diff --git a/muttlib.c b/muttlib.c index 5b0970dbc..06e3e61ee 100644 --- a/muttlib.c +++ b/muttlib.c @@ -167,7 +167,7 @@ void mutt_free_header(struct Header **h) #ifdef MIXMASTER mutt_list_free(&(*h)->chain); #endif - hdr_tags_free(*h); + driver_tags_free(*h); #if defined(USE_POP) || defined(USE_IMAP) || defined(USE_NNTP) || defined(USE_NOTMUCH) if ((*h)->free_cb) (*h)->free_cb(*h); diff --git a/pattern.c b/pattern.c index d22d5edc9..35ebc3d07 100644 --- a/pattern.c +++ b/pattern.c @@ -1714,7 +1714,7 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, return (pat->not ^ (h->env->x_label && patmatch(pat, h->env->x_label) == 0)); case MUTT_DRIVER_LABEL: { - const char *tags = hdr_tags_get(h); + const char *tags = driver_tags_get(h); return (pat->not ^ (tags && patmatch(pat, tags) == 0)); } case MUTT_HORMEL: