summaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-12-21 12:08:46 -0800
committerCarl Worth <cworth@cworth.org>2010-01-06 10:32:05 -0800
commit1376a90db622b71e0997fca52c50ccf34faeed22 (patch)
tree7856e32d496e361e74a7d01ca03899ba0f42815e /lib/database.cc
parent6ca6c089e9df7affe6bee0392197509a24ab2546 (diff)
database: Allowing storing multiple filenames for a single message ID.
The library interface is unchanged so far, (still just notmuch_database_add_message), but internally, the old _set_filename function is now _add_filename instead.
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/database.cc b/lib/database.cc
index 7d09119..553c9f8 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -843,7 +843,6 @@ notmuch_database_get_directory_mtime (notmuch_database_t *notmuch,
notmuch_private_status_t status;
const char *db_path = NULL;
time_t ret = 0;
- void *local = talloc_new (notmuch);
db_path = directory_db_path (path);
@@ -1188,23 +1187,24 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
goto DONE;
}
+ _notmuch_message_add_filename (message, filename);
+
/* Is this a newly created message object? */
if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {
- _notmuch_message_set_filename (message, filename);
_notmuch_message_add_term (message, "type", "mail");
- } else {
- ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
- goto DONE;
- }
- ret = _notmuch_database_link_message (notmuch, message, message_file);
- if (ret)
- goto DONE;
+ ret = _notmuch_database_link_message (notmuch, message,
+ message_file);
+ if (ret)
+ goto DONE;
- date = notmuch_message_file_get_header (message_file, "date");
- _notmuch_message_set_date (message, date);
+ date = notmuch_message_file_get_header (message_file, "date");
+ _notmuch_message_set_date (message, date);
- _notmuch_message_index_file (message, filename);
+ _notmuch_message_index_file (message, filename);
+ } else {
+ ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
+ }
_notmuch_message_sync (message);
} catch (const Xapian::Error &error) {