X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=message.cc;h=154efa0fd47ebde90460ed1516256715b902f723;hp=e2f1cd31843541f43002cd77eb0bc4576ca7ade4;hb=fa226a7a10ba95f8d8a7ff92dbfc44f6404d9d4d;hpb=90a0ef4ac4a023f11f82b037c635b4b22762b12f diff --git a/message.cc b/message.cc index e2f1cd31..154efa0f 100644 --- a/message.cc +++ b/message.cc @@ -21,6 +21,8 @@ #include "notmuch-private.h" #include "database-private.h" +#include + #include struct _notmuch_message { @@ -370,6 +372,21 @@ notmuch_message_get_filename (notmuch_message_t *message) return message->filename; } +time_t +notmuch_message_get_date (notmuch_message_t *message) +{ + std::string value; + + try { + value = message->doc.get_value (NOTMUCH_VALUE_TIMESTAMP); + } catch (Xapian::Error &error) { + INTERNAL_ERROR ("Failed to read timestamp value from document."); + return 0; + } + + return Xapian::sortable_unserialise (value); +} + notmuch_tags_t * notmuch_message_get_tags (notmuch_message_t *message) { @@ -413,7 +430,7 @@ _notmuch_message_set_date (notmuch_message_t *message, { time_t time_value; - time_value = notmuch_parse_date (date, NULL); + time_value = g_mime_utils_header_decode_date (date, NULL); message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP, Xapian::sortable_serialise (time_value));