diff options
author | Carl Worth <cworth@cworth.org> | 2010-04-12 14:41:34 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-04-12 14:41:34 -0700 |
commit | af49741228ec1582c83e266dbb8d6551f015d610 (patch) | |
tree | ed34e11b0874699b016a66d01be4d965436f0a29 /lib | |
parent | f8dc5c08e4479c244e0835e87d4b487a436042e0 (diff) |
lib: Fix line-wrapping in _notmuch_database_link_message.
This function had some excessively long lines due to nested
expressions. It's simple enough to un-nest these and have readable
line lengths.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/database.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/database.cc b/lib/database.cc index 2511caec..39cbc683 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1376,17 +1376,27 @@ _notmuch_database_link_message (notmuch_database_t *notmuch, notmuch_message_file_t *message_file) { notmuch_status_t status; - const char *thread_id = NULL; - char *metadata_key = _get_metadata_thread_id_key (message, - notmuch_message_get_message_id (message)); + const char *message_id, *thread_id = NULL; + char *metadata_key; + string stored_id; + + message_id = notmuch_message_get_message_id (message); + metadata_key = _get_metadata_thread_id_key (message, message_id); + /* Check if we have already seen related messages to this one. * If we have then use the thread_id that we stored at that time. */ - string stored_id = notmuch->xapian_db->get_metadata (metadata_key); - if (!stored_id.empty()) { - Xapian::WritableDatabase *db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db); + stored_id = notmuch->xapian_db->get_metadata (metadata_key); + if (! stored_id.empty()) { + Xapian::WritableDatabase *db; + + db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db); + + /* Clear the metadata for this message ID. We don't need it + * anymore. */ db->set_metadata (metadata_key, ""); thread_id = stored_id.c_str(); + _notmuch_message_add_term (message, "thread", thread_id); } talloc_free (metadata_key); |