To avoid confusion about hdr_tags and tags in X-Label headers.
This renames all hdr_tags_* in drvier_tags_*.
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);
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)
{
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;
}
else
{
- if (hdr_tags_commit(Context, CURHDR, buf))
+ if (driver_tags_commit(Context, CURHDR, buf))
{
mutt_message(_("Failed to modify tags, aborting."));
break;
{
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;
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 : "");
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;
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 */
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
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);
/* 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)
/* 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;
}
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;
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;
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
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");
}
/* 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;
}
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
{
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;
{
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);
}
#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;
}
/**
- * 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
* 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;
}
/**
- * 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
* 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;
}
/**
- * 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
* 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;
}
/**
- * 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
*
* 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;
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;
}
/**
- * 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;
}
/**
- * 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
*
* 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;
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);
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);
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 */
#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);
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: