- /* XXX: Should generate a message_id here, (such as a SHA1
- * sum of the message itself) */
- message_id = NULL;
+ /* No message-id at all, let's generate one by taking a
+ * hash over the file's contents. */
+ char *sha1 = notmuch_sha1_of_file (filename);
+
+ /* If that failed too, something is really wrong. Give up. */
+ if (sha1 == NULL) {
+ ret = NOTMUCH_STATUS_FILE_ERROR;
+ goto DONE;
+ }
+
+ message_id = g_strdup_printf ("notmuch-sha1-%s", sha1);
+ free (sha1);