Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id A6B0A418C25 for ; Sat, 24 Apr 2010 11:21:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OrzSW+JSebEc for ; Sat, 24 Apr 2010 11:21:11 -0700 (PDT) Received: from mail.hohndel.org (mail.hohndel.org [65.23.157.147]) by olra.theworths.org (Postfix) with ESMTP id BB889418C38 for ; Sat, 24 Apr 2010 11:21:10 -0700 (PDT) Received: by mail.hohndel.org (Postfix, from userid 112) id 675AB340FA; Sat, 24 Apr 2010 14:21:10 -0400 (EDT) Received: from x200.gr8dns.org (unknown [65.23.157.147]) by mail.hohndel.org (Postfix) with ESMTP id 3D7C1340F4; Sat, 24 Apr 2010 14:21:01 -0400 (EDT) Received: by x200.gr8dns.org (Postfix, from userid 500) id ED8AFCC59A; Sat, 24 Apr 2010 11:21:00 -0700 (PDT) From: Dirk Hohndel To: Subject: [PATCH 1/5] Add authors member to message Date: Sat, 24 Apr 2010 11:20:53 -0700 Message-Id: <1272133257-15708-2-git-send-email-hohndel@infradead.org> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1272133257-15708-1-git-send-email-hohndel@infradead.org> References: <1272133257-15708-1-git-send-email-hohndel@infradead.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2010 18:21:16 -0000 message->authors contains the author's name (as we want to print it) get / set methods are declared in notmuch-private.h Signed-off-by: Dirk Hohndel --- lib/message.cc | 18 ++++++++++++++++++ lib/notmuch-private.h | 10 ++++++++++ 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 721c9a6..4b2f98f 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -35,6 +35,7 @@ struct _notmuch_message { char *thread_id; char *in_reply_to; char *filename; + char *author; notmuch_message_file_t *message_file; notmuch_message_list_t *replies; unsigned long flags; @@ -110,6 +111,7 @@ _notmuch_message_create (const void *talloc_owner, message->in_reply_to = NULL; message->filename = NULL; message->message_file = NULL; + message->author = NULL; message->replies = _notmuch_message_list_create (message); if (unlikely (message->replies == NULL)) { @@ -533,6 +535,22 @@ notmuch_message_get_tags (notmuch_message_t *message) return _notmuch_convert_tags(message, i, end); } +const char * +notmuch_message_get_author (notmuch_message_t *message) +{ + return message->author; +} + +void +notmuch_message_set_author (notmuch_message_t *message, + const char *author) +{ + if (message->author) + talloc_free(message->author); + message->author = talloc_strdup(message, author); + return; +} + void _notmuch_message_set_date (notmuch_message_t *message, const char *date) diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 94cce1b..6e83cc3 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -275,6 +275,16 @@ _notmuch_message_talloc_copy_data (notmuch_message_t *message); void _notmuch_message_clear_data (notmuch_message_t *message); +/* Set the author member of 'message' - this is the representation used + * when displaying the message */ +void +notmuch_message_set_author (notmuch_message_t *message, const char *author); + +/* Get the author member of 'message' */ +const char * +notmuch_message_get_author (notmuch_message_t *message); + + /* index.cc */ notmuch_status_t -- 1.6.6.1