case OP_MAIN_MODIFY_TAGS:
case OP_MAIN_MODIFY_TAGS_THEN_HIDE:
{
- if (!Context || ((Context->magic != MUTT_NOTMUCH) && (Context->magic != MUTT_IMAP)))
+ if (!Context || !mx_tags_is_supported(Context))
{
- mutt_message(_("No virtual folder, aborting."));
+ mutt_message(_("Folder doesn't support tagging, aborting."));
break;
}
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
- rc = driver_tags_editor(Context, tag ? NULL : driver_tags_get_with_hidden(CURHDR), buf, sizeof(buf));
+ rc = mx_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);
- driver_tags_commit(Context, Context->hdrs[Context->v2r[j]], buf);
+ mx_tags_commit(Context, Context->hdrs[Context->v2r[j]], buf);
if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
{
bool still_queried = false;
}
else
{
- if (driver_tags_commit(Context, CURHDR, buf))
+ if (mx_tags_commit(Context, CURHDR, buf))
{
mutt_message(_("Failed to modify tags, aborting."));
break;
#include "config.h"
#include "mutt_tags.h"
-#include "context.h"
#include "globals.h"
#include "lib/hash.h"
#include "lib/string2.h"
}
return 1;
}
-
-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);
-
- mutt_message(_("Folder doesn't support tagging, aborting."));
- return -1;
-}
-
-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);
-
- mutt_message(_("Folder doesn't support tagging, aborting."));
- return -1;
-}
#define _MUTT_TAG_H
#include "header.h"
-#include "context.h"
/**
* struct TagList - Mail Header Tags
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 */
}
/* not reached */
}
+
+/**
+ * mx_tags_editor - start the tag editor of the mailbox
+ * @retval -1 Error
+ */
+int mx_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);
+
+ mutt_message(_("Folder doesn't support tagging, aborting."));
+ return -1;
+}
+
+/**
+ * mx_tags_commit - save tags to the mailbox
+ */
+int mx_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);
+
+ mutt_message(_("Folder doesn't support tagging, aborting."));
+ return -1;
+}
+
+/**
+ * mx_tags_is_supported - return true if mailbox support tagging
+ */
+int mx_tags_is_supported(struct Context *ctx)
+{
+ return ctx->mx_ops->commit_msg_tags && ctx->mx_ops->edit_msg_tags;
+}
bool mx_is_notmuch(const char *p);
#endif
+int mx_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen);
+int mx_tags_commit(struct Context *ctx, struct Header *h, char *tags);
+int mx_tags_is_supported(struct Context *ctx);
+
FILE *maildir_open_find_message(const char *folder, const char *msg, char **newname);
int mbox_strict_cmp_headers(const struct Header *h1, const struct Header *h2);