- tags = xstrndup (line + match[2].rm_so,
- match[2].rm_eo - match[2].rm_so);
+ file_tags = xstrndup (line + match[2].rm_so,
+ match[2].rm_eo - match[2].rm_so);
+
+ status = notmuch_database_find_message (notmuch, message_id, &message);
+ if (status || message == NULL) {
+ fprintf (stderr, "Warning: Cannot apply tags to %smessage: %s\n",
+ message ? "" : "missing ", message_id);
+ if (status)
+ fprintf (stderr, "%s\n",
+ notmuch_status_to_string(status));
+ goto NEXT_LINE;
+ }
+
+ db_tags_str = NULL;
+ for (db_tags = notmuch_message_get_tags (message);
+ notmuch_tags_valid (db_tags);
+ notmuch_tags_move_to_next (db_tags))
+ {
+ const char *tag = notmuch_tags_get (db_tags);