[notmuch] [PATCH] Allow saved queries for searching.
Add a "query:foo" term to the notmuch search syntax. Queries are "saved searches", and are written in the config file: [queries] foo=from:jrosenthal and to:notmuchmail and queries bar=tag:personal or (tag:unread and from:whomever) Then, if you search with the query `tag:inbox or query:foo' it will be passed along to notmuch as `tag:inbox and (from:jrosenthal and to:notmuchmail and queries)'. At the moment, when you ask for a query that doesn't exist it just treats it as blank. This seems more consistent than bailing out with an error (since no other search term will do that, short of running out of memory). This does mean, though, that non-existent queries, entered by themselves, will lead to a blank-search-term error. It should be pretty simple to improve this behavior, but I wanted to get the initial functionality out there. Note that this changed the arguments to query_string_from_args to include the hash-table of saved queries -- and since a lot functions call that one, this patch affects all of them. --- notmuch-client.h | 11 --- notmuch-config.c | 38 ++ notmuch-count.c |7 ++- notmuch-reply.c |7 ++- notmuch-search-tags.c |7 ++- notmuch-search.c |8 +++- notmuch-show.c|7 ++- notmuch-tag.c | 20 +--- query-string.c| 21 +++-- 9 files changed, 109 insertions(+), 17 deletions(-) diff --git a/notmuch-client.h b/notmuch-client.h index c80b39c..daecbf4 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -116,9 +116,6 @@ notmuch_time_print_formatted_seconds (double seconds); double notmuch_time_elapsed (struct timeval start, struct timeval end); -char * -query_string_from_args (void *ctx, int argc, char *argv[]); - notmuch_status_t show_message_body (const char *filename, void (*show_part) (GMimeObject *part, int *part_count)); @@ -135,6 +132,10 @@ notmuch_config_open (void *ctx, const char *filename, notmuch_bool_t *is_new_ret); +char * +query_string_from_args (void *ctx, GHashTable *queries_hash, + int argc, char *argv[]); + void notmuch_config_close (notmuch_config_t *config); @@ -162,6 +163,10 @@ void notmuch_config_set_user_primary_email (notmuch_config_t *config, const char *primary_email); +void +notmuch_config_get_queries (notmuch_config_t *config, + GHashTable *queries_hash); + char ** notmuch_config_get_user_other_email (notmuch_config_t *config, size_t *length); diff --git a/notmuch-config.c b/notmuch-config.c index 95430db..ad81c25 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -62,6 +62,8 @@ struct _notmuch_config { char *user_primary_email; char **user_other_email; size_t user_other_email_length; + +GHashTable *queries_hash; }; static int @@ -70,6 +72,8 @@ notmuch_config_destructor (notmuch_config_t *config) if (config->key_file) g_key_file_free (config->key_file); +g_hash_table_unref (config->queries_hash); + return 0; } @@ -200,6 +204,11 @@ notmuch_config_open (void *ctx, config->user_other_email = NULL; config->user_other_email_length = 0; +config->queries_hash = g_hash_table_new_full (g_str_hash, + g_str_equal, + free, + NULL); + if (! g_key_file_load_from_file (config->key_file, config->filename, G_KEY_FILE_KEEP_COMMENTS, @@ -264,6 +273,8 @@ notmuch_config_open (void *ctx, } } +notmuch_config_get_queries (config, config->queries_hash); + /* When we create a new configuration file here, we add some * comments to help the user understand what can be done. */ if (is_new) { @@ -342,6 +353,33 @@ notmuch_config_get_database_path (notmuch_config_t *config) return config->database_path; } + +void +notmuch_config_get_queries (notmuch_config_t *config, + GHashTable *queries_hash) +{ +char **keys; +gsize size; +keys = g_key_file_get_keys (config->key_file, + "queries", + , + NULL); +gsize i; +for (i = 0; i < size; i++) { + char *value; + value = g_key_file_get_string (config->key_file, + "queries", + keys[i], + NULL); + + g_hash_table_insert (queries_hash, +keys[i], +value); +} +} + + + void notmuch_config_set_database_path (notmuch_config_t
[notmuch] [PATCH 3/4] Add maildir-based mailstore
On 14:35, Tue 23 Mar 10, Michal Sojka wrote: > On Tue, 23 Mar 2010, Ruben Pollan wrote: > > On 16:39, Thu 18 Mar 10, Michal Sojka wrote: > > > This mailstore allows bi-directional synchronization between maildir > > > flags and certain tags. The flag-to-tag mapping is defined by flag2tag > > > array. > > > > I'm trying it, the synchronization from my maildir to notmuch seems to work > > fine > > except for the "unread" tag, it is never set. I use normally my maildir with > > mutt, so the unread messages are on mail_folder/new. Could that be the > > problem? > > is it a bug or something I do wrong? > > Yes, that's a bug. Messages in your mail_folder/new probably don't have > any 'info' (flags) in their filename, which is correct with respect to > http://cr.yp.to/proto/maildir.html. My patch incorrectly ignores the > files without 'info'. I didn't catch this error because is seems that > offlineimap puts 'info' part even to messages in new/. True, I use fetchmail for download my email, it put the email in the new folder without 'info'. > I think that the correct fix for this is to change how notmuch new > works: Whenever a message in new/ is found, it will be moved to cur/ and > in there is no info part it will be appended and the message will be > tagged accordingly. I think is better if new keeps the email where it is, only updates the database, and when you remove the unread tag move the message from folder to folder. Some mail readers (at least mutt) handles different the emails on the new folder than the ones with no "S" flag con cur folder. > I'll try to implement it and send a new patch. That will be nice. -- Rub?n Poll?n | jabber:meskio at jabber.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Nos vamos a Croatan. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100323/7716eb75/attachment.pgp>
[notmuch] [PATCH] Name thread based on matching msgs instead of first msg.
On Tue, 23 Mar 2010 13:31:09 -0400, James Vasile wrote: > Just out of curiosity, what are Aw, Sv and Vs used for? Are they just > "re" in different languages? Yep -- these were the only common ones I came across. If anyone knows of any others in common use, I can add 'em in.
[notmuch] [PATCH 4/4] Tests for maildir-based mailstore
On Tue, 23 Mar 2010, Ruben Pollan wrote: > On 16:39, Thu 18 Mar 10, Michal Sojka wrote: > > Signed-off-by: Michal Sojka > > --- > > test/t0006-maildir.sh | 113 > > + > > test/test-lib.sh |7 ++- > > 2 files changed, 118 insertions(+), 2 deletions(-) > > create mode 100755 test/t0006-maildir.sh > > This patch is not applicable on HEAD. The file test/test-lib.sh don't exists. Yes, you need to apply patches also patches for the test framework. The whole patch series can be seen at http://rtime.felk.cvut.cz/gitweb/notmuch.git/shortlog/refs/heads/mailstore-abstraction-v1 and can be merged by git pull git://rtime.felk.cvut.cz/notmuch.git mailstore-abstraction-v1 I have to (try to) finish relicencing of the git's test framework from GPLv2 to GPLv>=2, so that it can be merged to notmuch. -M
[notmuch] [PATCH 3/4] Add maildir-based mailstore
On Tue, 23 Mar 2010, Ruben Pollan wrote: > On 16:39, Thu 18 Mar 10, Michal Sojka wrote: > > This mailstore allows bi-directional synchronization between maildir > > flags and certain tags. The flag-to-tag mapping is defined by flag2tag > > array. > > I'm trying it, the synchronization from my maildir to notmuch seems to work > fine > except for the "unread" tag, it is never set. I use normally my maildir with > mutt, so the unread messages are on mail_folder/new. Could that be the > problem? > is it a bug or something I do wrong? Yes, that's a bug. Messages in your mail_folder/new probably don't have any 'info' (flags) in their filename, which is correct with respect to http://cr.yp.to/proto/maildir.html. My patch incorrectly ignores the files without 'info'. I didn't catch this error because is seems that offlineimap puts 'info' part even to messages in new/. I think that the correct fix for this is to change how notmuch new works: Whenever a message in new/ is found, it will be moved to cur/ and in there is no info part it will be appended and the message will be tagged accordingly. I'll try to implement it and send a new patch. -Michal
[notmuch] Using notmuch as an address book for tab-completion
On Sat, 20 Mar 2010 22:35:42 -0400, Jesse Rosenthal wrote: > There was some talk on IRC ages ago about using notmuch as an > address-book for tab-completion in emacs message mode. Thanks to some > great recent work (Ingmar Vanhassel's shared lib and Sebastians's > cnotmuch python lib) I have been able to take a first step in that > direction. I've written a python script (with some help and suggestions > from spaetz) which can perform the address-book functionality, and a > backend for emacs's EUDC address-lookup functionality to access the > script. Just testing the integration. First comment: When I search for "Seb", the first 2 hits, I get are: Sebastian Spaeth Sebastian Spaeth I think the version I sent you, lower-cased all email addresses. Is it intentional to have these as 2 separate email addresses? Sebastian
[notmuch] [PATCH] Name thread based on matching msgs instead of first msg.
On Mon, 22 Mar 2010 23:09:15 -0400, Jesse Rosenthal wrote: > Reply prefixes ("Re: ", "Aw: ", "Sv: ", "Vs: ") are ignored Just out of curiosity, what are Aw, Sv and Vs used for? Are they just "re" in different languages? Thanks.
[notmuch] [PATCH 4/4] Tests for maildir-based mailstore
On 16:39, Thu 18 Mar 10, Michal Sojka wrote: > Signed-off-by: Michal Sojka > --- > test/t0006-maildir.sh | 113 > + > test/test-lib.sh |7 ++- > 2 files changed, 118 insertions(+), 2 deletions(-) > create mode 100755 test/t0006-maildir.sh This patch is not applicable on HEAD. The file test/test-lib.sh don't exists. -- Rub?n Poll?n | jabber:meskio at jabber.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- No vamos a reivindicar nada, no vamos a pedir nada. Tomaremos, okuparemos. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100323/9c786bad/attachment.pgp>
[notmuch] [PATCH 3/4] Add maildir-based mailstore
On 16:39, Thu 18 Mar 10, Michal Sojka wrote: > This mailstore allows bi-directional synchronization between maildir > flags and certain tags. The flag-to-tag mapping is defined by flag2tag > array. I'm trying it, the synchronization from my maildir to notmuch seems to work fine except for the "unread" tag, it is never set. I use normally my maildir with mutt, so the unread messages are on mail_folder/new. Could that be the problem? is it a bug or something I do wrong? Thanks for your patch. -- Rub?n Poll?n | jabber:meskio at jabber.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Hay un mundo a la vuelta de la esquina de tu mente, donde la realidad es un intruso y los sue?os se hacen realidad. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100323/821104a9/attachment.pgp>
[notmuch] [PATCH] notmuch-new: Parse some maildir flags for labels
> if I remember, there has been at least three different patches for this, > so you are the fourth :-) You're right that it helps a lot with initial > import. To promote my work a little bit, I use bidirectional > synchronization between maildir flags and notmuch tags, which I sent in > id:1268926780-20045-4-git-send-email-sojkam1 at fel.cvut.cz. I use IMAP > clients from time to time and this helps me a lot because the IMAP > server has almost never outdated status. And it shows the need for such a patch :-). It doesn't hurt people who stop using IMAP flags, and it helps those who still can't use notmuch locally all the time... So +1 from me to get one of the patches into mainline. Sebastian
[notmuch] [PATCH] Name thread based on matching msgs instead of first msg.
At the moment all threads are named based on the name of the first message in the thread. However, this can cause problems if people either start new threads by replying-all (as unfortunately, many out there do) or change the subject of their mails to reflect a shift in a thread on a list. This patch names threads based on matches for the query, and the search order. If the search order is oldest-first (as in the default inbox) it chooses the oldest matching message as the subject. If the search order is newest-first it chooses the newest one. Reply prefixes ("Re: ", "Aw: ", "Sv: ", "Vs: ") are ignored (case-insensitively) so a Re: won't change the subject. Note that this adds a "sort" argument to _notmuch_thread_create and _thread_add_matched_message, so that when constructing the thread we can be aware of the sort order. --- lib/notmuch-private.h |3 ++- lib/query.cc |3 ++- lib/thread.cc | 30 +++--- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index d52d84d..94cce1b 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -205,7 +205,8 @@ notmuch_thread_t * _notmuch_thread_create (void *ctx, notmuch_database_t *notmuch, const char *thread_id, - const char *query_string); + const char *query_string, + notmuch_sort_t sort); /* message.cc */ diff --git a/lib/query.cc b/lib/query.cc index 9266d35..946f367 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -297,7 +297,8 @@ notmuch_threads_get (notmuch_threads_t *threads) return _notmuch_thread_create (threads->query, threads->query->notmuch, threads->thread_id, - threads->query->query_string); + threads->query->query_string, + threads->query->sort); } void diff --git a/lib/thread.cc b/lib/thread.cc index ec80f85..9ba7b70 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -129,7 +129,8 @@ _thread_add_message (notmuch_thread_t *thread, static void _thread_add_matched_message (notmuch_thread_t *thread, -notmuch_message_t *message) +notmuch_message_t *message, +notmuch_sort_t sort) { time_t date; notmuch_message_t *hashed_message; @@ -142,6 +143,28 @@ _thread_add_matched_message (notmuch_thread_t *thread, if (date > thread->newest || ! thread->matched_messages) thread->newest = date; +const char *subject; +const char *cleaned_subject; + +subject = notmuch_message_get_header (message, "subject"); + +if ((strncasecmp (subject, "Re: ", 4) == 0) || + (strncasecmp (subject, "Aw: ", 4) == 0) || + (strncasecmp (subject, "Vs: ", 4) == 0) || + (strncasecmp (subject, "Sv: ", 4) == 0)) { + + cleaned_subject = talloc_strndup (thread, + subject + 4, + strlen(subject) - 4); +} else { + cleaned_subject = talloc_strdup (thread, subject); +} + +if ((sort == NOTMUCH_SORT_OLDEST_FIRST && date <= thread->newest) || + (sort != NOTMUCH_SORT_OLDEST_FIRST && date == thread->newest)) { + thread->subject = talloc_strdup (thread, cleaned_subject); +} + thread->matched_messages++; if (g_hash_table_lookup_extended (thread->message_hash, @@ -209,7 +232,8 @@ notmuch_thread_t * _notmuch_thread_create (void *ctx, notmuch_database_t *notmuch, const char *thread_id, - const char *query_string) + const char *query_string, + notmuch_sort_t sort) { notmuch_thread_t *thread; const char *thread_id_query_string, *matched_query_string; @@ -284,7 +308,7 @@ _notmuch_thread_create (void *ctx, notmuch_messages_move_to_next (messages)) { message = notmuch_messages_get (messages); - _thread_add_matched_message (thread, message); + _thread_add_matched_message (thread, message, sort); _notmuch_message_close (message); } -- 1.6.3.3
Re: [notmuch] [PATCH] notmuch-new: Parse some maildir flags for labels
if I remember, there has been at least three different patches for this, so you are the fourth :-) You're right that it helps a lot with initial import. To promote my work a little bit, I use bidirectional synchronization between maildir flags and notmuch tags, which I sent in id:1268926780-20045-4-git-send-email-sojk...@fel.cvut.cz. I use IMAP clients from time to time and this helps me a lot because the IMAP server has almost never outdated status. And it shows the need for such a patch :-). It doesn't hurt people who stop using IMAP flags, and it helps those who still can't use notmuch locally all the time... So +1 from me to get one of the patches into mainline. Sebastian ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH 3/4] Add maildir-based mailstore
On 16:39, Thu 18 Mar 10, Michal Sojka wrote: This mailstore allows bi-directional synchronization between maildir flags and certain tags. The flag-to-tag mapping is defined by flag2tag array. I'm trying it, the synchronization from my maildir to notmuch seems to work fine except for the unread tag, it is never set. I use normally my maildir with mutt, so the unread messages are on mail_folder/new. Could that be the problem? is it a bug or something I do wrong? Thanks for your patch. -- Rubén Pollán | jabber:mes...@jabber.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Hay un mundo a la vuelta de la esquina de tu mente, donde la realidad es un intruso y los sueños se hacen realidad. signature.asc Description: Digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH 4/4] Tests for maildir-based mailstore
On 16:39, Thu 18 Mar 10, Michal Sojka wrote: Signed-off-by: Michal Sojka sojk...@fel.cvut.cz --- test/t0006-maildir.sh | 113 + test/test-lib.sh |7 ++- 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100755 test/t0006-maildir.sh This patch is not applicable on HEAD. The file test/test-lib.sh don't exists. -- Rubén Pollán | jabber:mes...@jabber.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- No vamos a reivindicar nada, no vamos a pedir nada. Tomaremos, okuparemos. signature.asc Description: Digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH 4/4] Tests for maildir-based mailstore
On Tue, 23 Mar 2010, Ruben Pollan wrote: On 16:39, Thu 18 Mar 10, Michal Sojka wrote: Signed-off-by: Michal Sojka sojk...@fel.cvut.cz --- test/t0006-maildir.sh | 113 + test/test-lib.sh |7 ++- 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100755 test/t0006-maildir.sh This patch is not applicable on HEAD. The file test/test-lib.sh don't exists. Yes, you need to apply patches also patches for the test framework. The whole patch series can be seen at http://rtime.felk.cvut.cz/gitweb/notmuch.git/shortlog/refs/heads/mailstore-abstraction-v1 and can be merged by git pull git://rtime.felk.cvut.cz/notmuch.git mailstore-abstraction-v1 I have to (try to) finish relicencing of the git's test framework from GPLv2 to GPLv=2, so that it can be merged to notmuch. -M ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH 3/4] Add maildir-based mailstore
On 14:35, Tue 23 Mar 10, Michal Sojka wrote: On Tue, 23 Mar 2010, Ruben Pollan wrote: On 16:39, Thu 18 Mar 10, Michal Sojka wrote: This mailstore allows bi-directional synchronization between maildir flags and certain tags. The flag-to-tag mapping is defined by flag2tag array. I'm trying it, the synchronization from my maildir to notmuch seems to work fine except for the unread tag, it is never set. I use normally my maildir with mutt, so the unread messages are on mail_folder/new. Could that be the problem? is it a bug or something I do wrong? Yes, that's a bug. Messages in your mail_folder/new probably don't have any 'info' (flags) in their filename, which is correct with respect to http://cr.yp.to/proto/maildir.html. My patch incorrectly ignores the files without 'info'. I didn't catch this error because is seems that offlineimap puts 'info' part even to messages in new/. True, I use fetchmail for download my email, it put the email in the new folder without 'info'. I think that the correct fix for this is to change how notmuch new works: Whenever a message in new/ is found, it will be moved to cur/ and in there is no info part it will be appended and the message will be tagged accordingly. I think is better if new keeps the email where it is, only updates the database, and when you remove the unread tag move the message from folder to folder. Some mail readers (at least mutt) handles different the emails on the new folder than the ones with no S flag con cur folder. I'll try to implement it and send a new patch. That will be nice. -- Rubén Pollán | jabber:mes...@jabber.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Nos vamos a Croatan. signature.asc Description: Digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH] Name thread based on matching msgs instead of first msg.
On Mon, 22 Mar 2010 23:09:15 -0400, Jesse Rosenthal jrosent...@jhu.edu wrote: Reply prefixes (Re: , Aw: , Sv: , Vs: ) are ignored Just out of curiosity, what are Aw, Sv and Vs used for? Are they just re in different languages? Thanks. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH] Name thread based on matching msgs instead of first msg.
On Tue, 23 Mar 2010 13:31:09 -0400, James Vasile ja...@hackervisions.org wrote: Just out of curiosity, what are Aw, Sv and Vs used for? Are they just re in different languages? That’s right. http://en.wikipedia.org/wiki/List_of_e-mail_subject_abbreviations Sandra ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH] Name thread based on matching msgs instead of first msg.
On Tue, 23 Mar 2010 13:31:09 -0400, James Vasile ja...@hackervisions.org wrote: Just out of curiosity, what are Aw, Sv and Vs used for? Are they just re in different languages? Yep -- these were the only common ones I came across. If anyone knows of any others in common use, I can add 'em in. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[notmuch] [PATCH] Allow saved queries for searching.
Add a query:foo term to the notmuch search syntax. Queries are saved searches, and are written in the config file: [queries] foo=from:jrosenthal and to:notmuchmail and queries bar=tag:personal or (tag:unread and from:whomever) Then, if you search with the query `tag:inbox or query:foo' it will be passed along to notmuch as `tag:inbox and (from:jrosenthal and to:notmuchmail and queries)'. At the moment, when you ask for a query that doesn't exist it just treats it as blank. This seems more consistent than bailing out with an error (since no other search term will do that, short of running out of memory). This does mean, though, that non-existent queries, entered by themselves, will lead to a blank-search-term error. It should be pretty simple to improve this behavior, but I wanted to get the initial functionality out there. Note that this changed the arguments to query_string_from_args to include the hash-table of saved queries -- and since a lot functions call that one, this patch affects all of them. --- notmuch-client.h | 11 --- notmuch-config.c | 38 ++ notmuch-count.c |7 ++- notmuch-reply.c |7 ++- notmuch-search-tags.c |7 ++- notmuch-search.c |8 +++- notmuch-show.c|7 ++- notmuch-tag.c | 20 +--- query-string.c| 21 +++-- 9 files changed, 109 insertions(+), 17 deletions(-) diff --git a/notmuch-client.h b/notmuch-client.h index c80b39c..daecbf4 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -116,9 +116,6 @@ notmuch_time_print_formatted_seconds (double seconds); double notmuch_time_elapsed (struct timeval start, struct timeval end); -char * -query_string_from_args (void *ctx, int argc, char *argv[]); - notmuch_status_t show_message_body (const char *filename, void (*show_part) (GMimeObject *part, int *part_count)); @@ -135,6 +132,10 @@ notmuch_config_open (void *ctx, const char *filename, notmuch_bool_t *is_new_ret); +char * +query_string_from_args (void *ctx, GHashTable *queries_hash, + int argc, char *argv[]); + void notmuch_config_close (notmuch_config_t *config); @@ -162,6 +163,10 @@ void notmuch_config_set_user_primary_email (notmuch_config_t *config, const char *primary_email); +void +notmuch_config_get_queries (notmuch_config_t *config, + GHashTable *queries_hash); + char ** notmuch_config_get_user_other_email (notmuch_config_t *config, size_t *length); diff --git a/notmuch-config.c b/notmuch-config.c index 95430db..ad81c25 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -62,6 +62,8 @@ struct _notmuch_config { char *user_primary_email; char **user_other_email; size_t user_other_email_length; + +GHashTable *queries_hash; }; static int @@ -70,6 +72,8 @@ notmuch_config_destructor (notmuch_config_t *config) if (config-key_file) g_key_file_free (config-key_file); +g_hash_table_unref (config-queries_hash); + return 0; } @@ -200,6 +204,11 @@ notmuch_config_open (void *ctx, config-user_other_email = NULL; config-user_other_email_length = 0; +config-queries_hash = g_hash_table_new_full (g_str_hash, + g_str_equal, + free, + NULL); + if (! g_key_file_load_from_file (config-key_file, config-filename, G_KEY_FILE_KEEP_COMMENTS, @@ -264,6 +273,8 @@ notmuch_config_open (void *ctx, } } +notmuch_config_get_queries (config, config-queries_hash); + /* When we create a new configuration file here, we add some * comments to help the user understand what can be done. */ if (is_new) { @@ -342,6 +353,33 @@ notmuch_config_get_database_path (notmuch_config_t *config) return config-database_path; } + +void +notmuch_config_get_queries (notmuch_config_t *config, + GHashTable *queries_hash) +{ +char **keys; +gsize size; +keys = g_key_file_get_keys (config-key_file, + queries, + size, + NULL); +gsize i; +for (i = 0; i size; i++) { + char *value; + value = g_key_file_get_string (config-key_file, + queries, + keys[i], + NULL); + + g_hash_table_insert (queries_hash, +keys[i], +value); +} +} + + + void notmuch_config_set_database_path (notmuch_config_t *config,
Re: [notmuch] Mailstore abstraction maildir synchronization
On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka sojk...@fel.cvut.cz wrote: - Only file-based storage is suported. Notmuch access the files directly, and not via the mailstore interface. It'll be great when this is fixed... should be trivial to add a git backend then. (i have in no way been looking at tags in git though... doesn't really interest me and git aint a database) - (maildir) Viewing/storing of attachments of unread messages doesn't work. The reason is that when you view the message it its unread tag is removed which leads to rename of the file, but Emacs still uses the original name to access the attachment. What about migrating from a maildir that's turned into notmuch back to this maildir backend? What will be authoritive: maildir or notmuch database? -- Stewart Smith ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch