[Patch v2 09/17] tag-util.[ch]: New files for common tagging routines
Tomi Ollila
tomi.ollila at iki.fi
Sat Nov 24 15:27:28 PST 2012
On Sat, Nov 24 2012, david at tethera.net wrote:
> From: David Bremner <bremner at debian.org>
>
> These are meant to be shared between notmuch-tag and notmuch-restore.
>
> The bulk of the routines implement a "tag operation list" abstract
> data type act as a structured representation of a set of tag
> operations (typically coming from a single tag command or line of
> input).
> ---
dumping all except beginning of tag-util.h...
> tag-util.h | 120 ++++++++++++++++++++++++++
> diff --git a/tag-util.h b/tag-util.h
> new file mode 100644
> index 0000000..508806f
> --- /dev/null
> +++ b/tag-util.h
> @@ -0,0 +1,120 @@
> +#ifndef _TAG_UTIL_H
> +#define _TAG_UTIL_H
> +
> +#include "notmuch-client.h"
> +
> +typedef struct _tag_operation_t tag_operation_t;
> +typedef struct _tag_op_list_t tag_op_list_t;
> +
> +#define TAG_OP_LIST_INITIAL_SIZE 10
> +
> +/* Use powers of 2 */
> +typedef enum { TAG_FLAG_NONE = 0,
> + /* Operations are synced to maildir, if possible */
> +
> + TAG_FLAG_MAILDIR_SYNC = 1,
> +
> + /* Remove all tags from message before applying
> + * list */
> +
> + TAG_FLAG_REMOVE_ALL = 2,
> +
> + /* Don't try to avoid database operations. Useful
> + * when we know that message passed needs these
> + * operations. */
> +
> + TAG_FLAG_PRE_OPTIMIZED = 4,
> +
> + /* Accept strange tags that might be user error;
> + intended for use by notmuch-restore.
> + */
> +
> + TAG_FLAG_BE_GENEROUS = 8} tag_op_flag_t;
> +
Maybe something like the following formatted and consistency-tuned version:
typedef enum {
TAG_FLAG_NONE = 0,
/* Operations are synced to maildir, if possible.
*/
TAG_FLAG_MAILDIR_SYNC = (1 << 0),
/* Remove all tags from message before applying list.
*/
TAG_FLAG_REMOVE_ALL = (1 << 1),
/* Don't try to avoid database operations. Useful when we
* know that message passed needs these operations.
*/
TAG_FLAG_PRE_OPTIMIZED = (1 << 2),
/* Accept strange tags that might be user error;
* intended for use by notmuch-restore.
*/
TAG_FLAG_BE_GENEROUS = (1 << 3)
} tag_op_flag_t;
Tomi
More information about the notmuch
mailing list