]> git.notmuchmail.org Git - notmuch/blobdiff - lib/message.cc
lib: Move message ID compression to _notmuch_message_create_for_message_id
[notmuch] / lib / message.cc
index 68f7e68d8810e61b2fb397d62390615afdee9729..bbfc2500bd92f12dfade22db471fb6b22bf9613b 100644 (file)
@@ -226,6 +226,10 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
     else if (*status_ret)
        return NULL;
 
+    /* If the message ID is too long, substitute its sha1 instead. */
+    if (strlen (message_id) > NOTMUCH_MESSAGE_ID_MAX)
+       message_id = _notmuch_message_id_compressed (message, message_id);
+
     term = talloc_asprintf (NULL, "%s%s",
                            _find_prefix ("id"), message_id);
     if (term == NULL) {
@@ -1497,7 +1501,7 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message)
     talloc_free (to_set);
     talloc_free (to_clear);
 
-    return NOTMUCH_STATUS_SUCCESS;
+    return status;
 }
 
 notmuch_status_t