[PATCH 11/11] lib: add recipients to database
Jameson Graef Rollins
jrollins at finestructure.net
Sun Aug 19 18:52:50 PDT 2012
This adds just the "to" recipients, but probably "cc"s should be
included as well.
---
lib/database.cc | 2 +-
lib/message.cc | 4 ++++
lib/notmuch-private.h | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/database.cc b/lib/database.cc
index 761dc1a..4c1d578 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1814,7 +1814,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
goto DONE;
date = notmuch_message_file_get_header (message_file, "date");
- _notmuch_message_set_header_values (message, date, from, subject);
+ _notmuch_message_set_header_values (message, date, from, to, subject);
_notmuch_message_index_file (message, filename);
} else {
diff --git a/lib/message.cc b/lib/message.cc
index fa28073..cc5c8a0 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -420,6 +420,8 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header)
* available */
if (strcasecmp (header, "from") == 0)
value = message->doc.get_value (NOTMUCH_VALUE_FROM);
+ if (strcasecmp (header, "to") == 0)
+ value = message->doc.get_value (NOTMUCH_VALUE_TO);
else if (strcasecmp (header, "subject") == 0)
value = message->doc.get_value (NOTMUCH_VALUE_SUBJECT);
else if (strcasecmp (header, "message-id") == 0)
@@ -830,6 +832,7 @@ void
_notmuch_message_set_header_values (notmuch_message_t *message,
const char *date,
const char *from,
+ const char *to,
const char *subject)
{
time_t time_value;
@@ -844,6 +847,7 @@ _notmuch_message_set_header_values (notmuch_message_t *message,
message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
Xapian::sortable_serialise (time_value));
message->doc.add_value (NOTMUCH_VALUE_FROM, from);
+ message->doc.add_value (NOTMUCH_VALUE_TO, to);
message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);
}
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 32d1523..f56c580 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -95,6 +95,7 @@ typedef enum {
NOTMUCH_VALUE_TIMESTAMP = 0,
NOTMUCH_VALUE_MESSAGE_ID,
NOTMUCH_VALUE_FROM,
+ NOTMUCH_VALUE_TO,
NOTMUCH_VALUE_SUBJECT
} notmuch_value_t;
@@ -291,6 +292,7 @@ void
_notmuch_message_set_header_values (notmuch_message_t *message,
const char *date,
const char *from,
+ const char *to,
const char *subject);
void
_notmuch_message_sync (notmuch_message_t *message);
--
1.7.10.4
More information about the notmuch
mailing list