[PATCH 05/11] lib: add ability to store recipients in message structure

Jameson Graef Rollins jrollins at finestructure.net
Sun Aug 19 18:52:44 PDT 2012


Added as a string, in parallel to the authors element.
---
 lib/message.cc        |   18 ++++++++++++++++++
 lib/notmuch-private.h |    9 +++++++++
 2 files changed, 27 insertions(+)

diff --git a/lib/message.cc b/lib/message.cc
index 978de06..fa28073 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -36,6 +36,7 @@ struct visible _notmuch_message {
     notmuch_string_list_t *filename_term_list;
     notmuch_string_list_t *filename_list;
     char *author;
+    char *recipients;
     notmuch_message_file_t *message_file;
     notmuch_message_list_t *replies;
     unsigned long flags;
@@ -109,6 +110,7 @@ _notmuch_message_create_for_document (const void *talloc_owner,
     message->filename_list = NULL;
     message->message_file = NULL;
     message->author = NULL;
+    message->recipients = NULL;
 
     message->replies = _notmuch_message_list_create (message);
     if (unlikely (message->replies == NULL)) {
@@ -808,6 +810,22 @@ notmuch_message_set_author (notmuch_message_t *message,
     return;
 }
 
+const char *
+notmuch_message_get_recipients (notmuch_message_t *message)
+{
+    return message->recipients;
+}
+
+void
+notmuch_message_set_recipients (notmuch_message_t *message,
+				const char *recipients)
+{
+    if (message->recipients)
+	talloc_free(message->recipients);
+    message->recipients = talloc_strdup(message, recipients);
+    return;
+}
+
 void
 _notmuch_message_set_header_values (notmuch_message_t *message,
 				    const char *date,
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index bfb4111..27a41b6 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -325,6 +325,15 @@ notmuch_message_set_author (notmuch_message_t *message, const char *author);
 const char *
 notmuch_message_get_author (notmuch_message_t *message);
 
+/* Set the recipients of 'message' - this is the representation used
+ * when displaying the message */
+void
+notmuch_message_set_recipients (notmuch_message_t *message, const char *recipients);
+
+/* Get the authors of 'message' */
+const char *
+notmuch_message_get_recipients (notmuch_message_t *message);
+
 
 /* index.cc */
 
-- 
1.7.10.4



More information about the notmuch mailing list