]> git.notmuchmail.org Git - notmuch/blobdiff - message.cc
Cut the enthusiasm a bit.
[notmuch] / message.cc
index 281da4f55c34388c3ac54a6cea2a7f8707a75e38..b304a22e73c2c3051665136abc3f3e25ff00d073 100644 (file)
@@ -41,6 +41,13 @@ struct _notmuch_thread_ids {
     char *next;
 };
 
+/* "128 bits of thread-id ought to be enough for anybody" */
+#define NOTMUCH_THREAD_ID_BITS  128
+#define NOTMUCH_THREAD_ID_DIGITS (NOTMUCH_THREAD_ID_BITS / 4)
+typedef struct _thread_id {
+    char str[NOTMUCH_THREAD_ID_DIGITS + 1];
+} thread_id_t;
+
 #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
 
 /* These prefix values are specifically chosen to be compatible
@@ -75,7 +82,8 @@ prefix_t BOOLEAN_PREFIX[] = {
     { "attachment_extension", "O" },
     { "msgid", "Q" },
     { "thread", "H" },
-    { "ref", "R" }
+    { "ref", "R" },
+    { "timestamp", "KTS" },
 };
 
 const char *
@@ -91,6 +99,9 @@ _find_prefix (const char *name)
        if (strcmp (name, BOOLEAN_PREFIX[i].name) == 0)
            return BOOLEAN_PREFIX[i].prefix;
 
+    fprintf (stderr, "Internal error: No prefix exists for '%s'\n", name);
+    exit (1);
+
     return "";
 }
 
@@ -208,10 +219,11 @@ notmuch_message_get_message_id (notmuch_message_t *message)
     i = message->doc.termlist_begin ();
     i.skip_to (_find_prefix ("msgid"));
 
-    /* XXX: This should really be an internal error, but we'll need to
-     * fix the add_message side of things first. */
-    if (i == message->doc.termlist_end ())
-       return NULL;
+    if (i == message->doc.termlist_end ()) {
+       fprintf (stderr, "Internal error: Message with document ID of %d has no message ID.\n",
+                message->doc_id);
+       exit (1);
+    }
 
     message->message_id = talloc_strdup (message, (*i).c_str () + 1);
     return message->message_id;
@@ -514,7 +526,7 @@ notmuch_tags_has_more (notmuch_tags_t *tags)
        return FALSE;
 
     s = *tags->iterator;
-    if (s.size () && s[0] == 'L')
+    if (! s.empty () && s[0] == 'L')
        return TRUE;
     else
        return FALSE;