aboutsummaryrefslogtreecommitdiff
path: root/database.cc
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-26 21:44:05 -0700
committerCarl Worth <cworth@cworth.org>2009-10-26 21:44:05 -0700
commitae0bd3f503c8815affa733f48498bb77d023680b (patch)
tree4e6ee130d878eb784020a6a2f50059b37566b5d2 /database.cc
parentd07dd49aac0f337d3f631504f521311a9685bd1f (diff)
add_message: Add an optional parameter for getting the just-added message.
We use this to implement the addition of "inbox" and "unread" tags for all messages added by "notmuch new".
Diffstat (limited to 'database.cc')
-rw-r--r--database.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/database.cc b/database.cc
index eab24991..ad91a7d7 100644
--- a/database.cc
+++ b/database.cc
@@ -821,7 +821,8 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,
notmuch_status_t
notmuch_database_add_message (notmuch_database_t *notmuch,
- const char *filename)
+ const char *filename,
+ notmuch_message_t **message_ret)
{
notmuch_message_file_t *message_file;
notmuch_message_t *message;
@@ -926,8 +927,13 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
}
DONE:
- if (message)
- notmuch_message_destroy (message);
+ if (message) {
+ if (message_ret)
+ *message_ret = message;
+ else
+ notmuch_message_destroy (message);
+ }
+
if (message_file)
notmuch_message_file_close (message_file);