]> git.notmuchmail.org Git - notmuch/blob - test/corpora/lkml/cur/1354585346.000261:2,
Import notmuch_0.28.2.orig.tar.gz
[notmuch] / test / corpora / lkml / cur / 1354585346.000261:2,
1 Return-Path: <stefan@datenfreihafen.org>
2 X-Original-To: notmuch@notmuchmail.org
3 Delivered-To: notmuch@notmuchmail.org
4 Received: from localhost (localhost [127.0.0.1])
5         by olra.theworths.org (Postfix) with ESMTP id E4203431FBF
6         for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 16:11:31 -0800 (PST)
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
8 Received: from olra.theworths.org ([127.0.0.1])
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
10         with ESMTP id k6PahtnYXl0O for <notmuch@notmuchmail.org>;
11         Sat, 21 Nov 2009 16:11:30 -0800 (PST)
12 Received: from sirius.lasnet.de (sirius.lasnet.de [78.47.116.19])
13         by olra.theworths.org (Postfix) with ESMTP id 1BAB6431FBC
14         for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 16:11:30 -0800 (PST)
15 Received: from p5b034af6.dip.t-dialin.net ([91.3.74.246] helo=excalibur)
16         by sirius.lasnet.de with esmtpsa 
17         (Cipher TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63 #1)
18         id 1NC02v-0000t5-LF by authid <stefan@sostec.de> with cram_md5;
19         Sun, 22 Nov 2009 01:11:29 +0100
20 Received: from stefan by excalibur with local (Exim 4.69)
21         (envelope-from <stefan@excalibur.local>)
22         id 1NC02u-0001Dj-V9; Sun, 22 Nov 2009 01:11:16 +0100
23 From: Stefan Schmidt <stefan@datenfreihafen.org>
24 To: notmuch@notmuchmail.org
25 Date: Sun, 22 Nov 2009 01:11:00 +0100
26 Message-Id: <1258848661-4660-1-git-send-email-stefan@datenfreihafen.org>
27 X-Mailer: git-send-email 1.6.5.3
28 In-Reply-To: <yes>
29 References: <yes>
30 Subject: [notmuch] [PATCH 1/2] lib/message: Add function to get maildir
31         flags.
32 X-BeenThere: notmuch@notmuchmail.org
33 X-Mailman-Version: 2.1.12
34 Precedence: list
35 List-Id: "Use and development of the notmuch mail system."
36         <notmuch.notmuchmail.org>
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
40 List-Post: <mailto:notmuch@notmuchmail.org>
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
44 X-List-Received-Date: Sun, 22 Nov 2009 00:11:32 -0000
45
46 With notmuch_message_get_flags() we gain the information if the message was
47 flagged as read, draft, trashed, etc. Handy for big mail spooles that were used
48 with another mailer.
49
50 Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
51 ---
52  lib/message.cc |   26 ++++++++++++++++++++++++++
53  lib/notmuch.h  |   10 ++++++++++
54  2 files changed, 36 insertions(+), 0 deletions(-)
55
56 diff --git a/lib/message.cc b/lib/message.cc
57 index 069cedb..9bec61e 100644
58 --- a/lib/message.cc
59 +++ b/lib/message.cc
60 @@ -35,6 +35,7 @@ struct _notmuch_message {
61      char *thread_id;
62      char *in_reply_to;
63      char *filename;
64 +    char *flags;
65      notmuch_message_file_t *message_file;
66      notmuch_message_list_t *replies;
67  
68 @@ -114,6 +115,7 @@ _notmuch_message_create (const void *talloc_owner,
69      message->thread_id = NULL;
70      message->in_reply_to = NULL;
71      message->filename = NULL;
72 +    message->flags = NULL;
73      message->message_file = NULL;
74  
75      message->replies = _notmuch_message_list_create (message);
76 @@ -438,6 +440,30 @@ notmuch_message_get_filename (notmuch_message_t *message)
77      return message->filename;
78  }
79  
80 +const char *
81 +notmuch_message_get_flags (notmuch_message_t *message)
82 +{
83 +    std::string filename_str, flags;
84 +    size_t position;
85 +    const char *db_path;
86 +
87 +    if (message->flags)
88 +       return message->flags;
89 +
90 +    filename_str = message->doc.get_data ();
91 +    db_path = notmuch_database_get_path (message->notmuch);
92 +
93 +    if (filename_str[0] != '/')
94 +       filename_str.insert (0, db_path);
95 +
96 +    /* Flags are everything behind ":" */
97 +    position = filename_str.find (":");
98 +    flags = filename_str.substr (position + 3); /* We don't want :2, */
99 +    message->flags = talloc_strdup (message, flags.c_str ());
100 +
101 +    return message->flags;
102 +}
103 +
104  time_t
105  notmuch_message_get_date (notmuch_message_t *message)
106  {
107 diff --git a/lib/notmuch.h b/lib/notmuch.h
108 index a61cd02..1da5dfd 100644
109 --- a/lib/notmuch.h
110 +++ b/lib/notmuch.h
111 @@ -694,6 +694,16 @@ notmuch_message_get_replies (notmuch_message_t *message);
112  const char *
113  notmuch_message_get_filename (notmuch_message_t *message);
114  
115 +/* Get the maildir flags for the email corresponding to 'message'.
116 + *
117 + * The returned flags will be a string of ascii format flags.
118 + *
119 + * The returned string belongs to the message so should not be
120 + * modified or freed by the caller (nor should it be referenced after
121 + * the message is destroyed). */
122 +const char *
123 +notmuch_message_get_flags (notmuch_message_t *message);
124 +
125  /* Get the date of 'message' as a time_t value.
126   *
127   * For the original textual representation of the Date header from the
128 -- 
129 1.6.5.3
130
131