Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

50%
+0 −0
Q&A How to get a mailto: URI out of abook(1)

There's no such feature. But it's easy to write. Apply this patch: From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar <alx@kernel.org> Date: S...

posted 8mo ago by alx‭  ·  edited 8mo ago by alx‭

Answer
#4: Post edited by user avatar alx‭ · 2023-09-30T15:58:53Z (8 months ago)
  • There's no such feature. But it's easy to write. Apply this patch:
  • ```diff
  • From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
  • From: Alejandro Colomar <alx@kernel.org>
  • Date: Sat, 30 Sep 2023 17:44:03 +0200
  • Subject: [PATCH] query: outformat: Add "mailto" format
  • Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • ---
  • filter.c | 18 ++++++++++++++++++
  • 1 file changed, 18 insertions(+)
  • diff --git a/filter.c b/filter.c
  • index d5b18dd..a441615 100644
  • --- a/filter.c
  • +++ b/filter.c
  • @@ -80,6 +80,7 @@ static int custom_export_database(FILE *out, struct db_enumerator e);
  • void vcard_export_item(FILE *out, int item);
  • void muttq_print_item(FILE *file, int item);
  • +void mailto_print_item(FILE *file, int item);
  • void custom_print_item(FILE *out, int item);
  • /*
  • @@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
  • struct abook_output_item_filter u_filters[] = {
  • { "vcard", N_("vCard 2 file"), vcard_export_item },
  • { "muttq", N_("mutt alias"), muttq_print_item },
  • + { "mailto", N_("mailto address"), mailto_print_item },
  • { "custom", N_("Custom format"), custom_print_item },
  • { "\0", NULL }
  • };
  • @@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  • * end of mutt alias export filter
  • */
  • +void mailto_print_item(FILE *file, int item)
  • +{
  • + abook_list *emails, *e;
  • + char *tmp = db_email_get(item);
  • +
  • + emails = csv_to_abook_list(tmp);
  • + free(tmp);
  • +
  • + for(e = emails; e; e = e->next) {
  • + fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
  • + if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
  • + break;
  • + }
  • + abook_list_free(&emails);
  • +}
  • +
  • /*
  • * printable export filter
  • --
  • 2.40.1
  • ```
  • Then, build abook:
  • ```sh
  • ./configure && make
  • ```
  • And now you can do this:
  • ```sh
  • $ ./abook --mutt-query alx --outformat mailto
  • Alejandro Colomar <alx@kernel.org>
  • Alejandro Colomar <alx.manpages@gmail.com>
  • ```
  • (I'll send this patch to the project soon, so hopefully this feature will be available soon.)
  • There's no such feature. But it's easy to write. Apply this patch:
  • ```diff
  • From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
  • From: Alejandro Colomar <alx@kernel.org>
  • Date: Sat, 30 Sep 2023 17:44:03 +0200
  • Subject: [PATCH] query: outformat: Add "mailto" format
  • Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • ---
  • filter.c | 18 ++++++++++++++++++
  • 1 file changed, 18 insertions(+)
  • diff --git a/filter.c b/filter.c
  • index d5b18dd..a441615 100644
  • --- a/filter.c
  • +++ b/filter.c
  • @@ -80,6 +80,7 @@ static int custom_export_database(FILE *out, struct db_enumerator e);
  • void vcard_export_item(FILE *out, int item);
  • void muttq_print_item(FILE *file, int item);
  • +void mailto_print_item(FILE *file, int item);
  • void custom_print_item(FILE *out, int item);
  • /*
  • @@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
  • struct abook_output_item_filter u_filters[] = {
  • { "vcard", N_("vCard 2 file"), vcard_export_item },
  • { "muttq", N_("mutt alias"), muttq_print_item },
  • + { "mailto", N_("mailto address"), mailto_print_item },
  • { "custom", N_("Custom format"), custom_print_item },
  • { "\0", NULL }
  • };
  • @@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  • * end of mutt alias export filter
  • */
  • +void mailto_print_item(FILE *file, int item)
  • +{
  • + abook_list *emails, *e;
  • + char *tmp = db_email_get(item);
  • +
  • + emails = csv_to_abook_list(tmp);
  • + free(tmp);
  • +
  • + for(e = emails; e; e = e->next) {
  • + fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
  • + if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
  • + break;
  • + }
  • + abook_list_free(&emails);
  • +}
  • +
  • /*
  • * printable export filter
  • --
  • 2.40.1
  • ```
  • Then, build abook:
  • ```sh
  • ./configure && make
  • ```
  • And now you can do this:
  • ```sh
  • $ ./abook --mutt-query=alx --outformat=mailto
  • Alejandro Colomar <alx@kernel.org>
  • Alejandro Colomar <alx.manpages@gmail.com>
  • ```
  • (I'll send this patch to the project soon, so hopefully this feature will be available soon.)
#3: Post edited by user avatar alx‭ · 2023-09-30T15:58:27Z (8 months ago)
  • There's no such feature. But it's easy to write. Apply this patch:
  • ```diff
  • From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
  • From: Alejandro Colomar <alx@kernel.org>
  • Date: Sat, 30 Sep 2023 17:44:03 +0200
  • Subject: [PATCH] query: outformat: Add "mailto" format
  • Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • ---
  • filter.c | 18 ++++++++++++++++++
  • 1 file changed, 18 insertions(+)
  • diff --git a/filter.c b/filter.c
  • index d5b18dd..a441615 100644
  • --- a/filter.c
  • +++ b/filter.c
  • @@ -80,6 +80,7 @@ static int custom_export_database(FILE *out, struct db_enumerator e);
  • void vcard_export_item(FILE *out, int item);
  • void muttq_print_item(FILE *file, int item);
  • +void mailto_print_item(FILE *file, int item);
  • void custom_print_item(FILE *out, int item);
  • /*
  • @@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
  • struct abook_output_item_filter u_filters[] = {
  • { "vcard", N_("vCard 2 file"), vcard_export_item },
  • { "muttq", N_("mutt alias"), muttq_print_item },
  • + { "mailto", N_("mailto address"), mailto_print_item },
  • { "custom", N_("Custom format"), custom_print_item },
  • { "\0", NULL }
  • };
  • @@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  • * end of mutt alias export filter
  • */
  • +void mailto_print_item(FILE *file, int item)
  • +{
  • + abook_list *emails, *e;
  • + char *tmp = db_email_get(item);
  • +
  • + emails = csv_to_abook_list(tmp);
  • + free(tmp);
  • +
  • + for(e = emails; e; e = e->next) {
  • + fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
  • + if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
  • + break;
  • + }
  • + abook_list_free(&emails);
  • +}
  • +
  • /*
  • * printable export filter
  • --
  • 2.40.1
  • ```
  • Then, build abook:
  • ```sh
  • ./configure && make
  • ```
  • And now you can do this:
  • ```sh
  • $ ./abook --mutt-query alx --outformat mailto
  • Alejandro Colomar Andres <alx@kernel.org>
  • Alejandro Colomar Andres <alx.manpages@gmail.com>
  • ```
  • (I'll send this patch to the project soon, so hopefully this feature will be available soon.)
  • There's no such feature. But it's easy to write. Apply this patch:
  • ```diff
  • From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
  • From: Alejandro Colomar <alx@kernel.org>
  • Date: Sat, 30 Sep 2023 17:44:03 +0200
  • Subject: [PATCH] query: outformat: Add "mailto" format
  • Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • ---
  • filter.c | 18 ++++++++++++++++++
  • 1 file changed, 18 insertions(+)
  • diff --git a/filter.c b/filter.c
  • index d5b18dd..a441615 100644
  • --- a/filter.c
  • +++ b/filter.c
  • @@ -80,6 +80,7 @@ static int custom_export_database(FILE *out, struct db_enumerator e);
  • void vcard_export_item(FILE *out, int item);
  • void muttq_print_item(FILE *file, int item);
  • +void mailto_print_item(FILE *file, int item);
  • void custom_print_item(FILE *out, int item);
  • /*
  • @@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
  • struct abook_output_item_filter u_filters[] = {
  • { "vcard", N_("vCard 2 file"), vcard_export_item },
  • { "muttq", N_("mutt alias"), muttq_print_item },
  • + { "mailto", N_("mailto address"), mailto_print_item },
  • { "custom", N_("Custom format"), custom_print_item },
  • { "\0", NULL }
  • };
  • @@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  • * end of mutt alias export filter
  • */
  • +void mailto_print_item(FILE *file, int item)
  • +{
  • + abook_list *emails, *e;
  • + char *tmp = db_email_get(item);
  • +
  • + emails = csv_to_abook_list(tmp);
  • + free(tmp);
  • +
  • + for(e = emails; e; e = e->next) {
  • + fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
  • + if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
  • + break;
  • + }
  • + abook_list_free(&emails);
  • +}
  • +
  • /*
  • * printable export filter
  • --
  • 2.40.1
  • ```
  • Then, build abook:
  • ```sh
  • ./configure && make
  • ```
  • And now you can do this:
  • ```sh
  • $ ./abook --mutt-query alx --outformat mailto
  • Alejandro Colomar <alx@kernel.org>
  • Alejandro Colomar <alx.manpages@gmail.com>
  • ```
  • (I'll send this patch to the project soon, so hopefully this feature will be available soon.)
#2: Post edited by user avatar alx‭ · 2023-09-30T15:49:58Z (8 months ago)
  • There's no such feature. But it's easy to write. Apply this patch:
  • ```diff
  • From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
  • From: Alejandro Colomar <alx@kernel.org>
  • Date: Sat, 30 Sep 2023 17:44:03 +0200
  • Subject: [PATCH] query: outformat: Add "mailto" format
  • Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • ---
  • filter.c | 18 ++++++++++++++++++
  • 1 file changed, 18 insertions(+)
  • diff --git a/filter.c b/filter.c
  • index d5b18dd..a441615 100644
  • --- a/filter.c
  • +++ b/filter.c
  • @@ -80,6 +80,7 @@ static int custom_export_database(FILE *out, struct db_enumerator e);
  • void vcard_export_item(FILE *out, int item);
  • void muttq_print_item(FILE *file, int item);
  • +void mailto_print_item(FILE *file, int item);
  • void custom_print_item(FILE *out, int item);
  • /*
  • @@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
  • struct abook_output_item_filter u_filters[] = {
  • { "vcard", N_("vCard 2 file"), vcard_export_item },
  • { "muttq", N_("mutt alias"), muttq_print_item },
  • + { "mailto", N_("mailto address"), mailto_print_item },
  • { "custom", N_("Custom format"), custom_print_item },
  • { "\0", NULL }
  • };
  • @@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  • * end of mutt alias export filter
  • */
  • +void mailto_print_item(FILE *file, int item)
  • +{
  • + abook_list *emails, *e;
  • + char *tmp = db_email_get(item);
  • +
  • + emails = csv_to_abook_list(tmp);
  • + free(tmp);
  • +
  • + for(e = emails; e; e = e->next) {
  • + fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
  • + if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
  • + break;
  • + }
  • + abook_list_free(&emails);
  • +}
  • +
  • /*
  • * printable export filter
  • --
  • 2.40.1
  • ```
  • Then, build abook:
  • ```sh
  • ./configure && make
  • ```
  • And now you can do this:
  • ```sh
  • $ ./abook --mutt-query alx --outformat mailto
  • Alejandro Colomar Andres <alx@kernel.org>
  • Alejandro Colomar Andres <alx.manpages@gmail.com>
  • Alejandro Colomar Andres <alx.mailinglists@gmail.com>
  • Alejandro Colomar Andres <alejandro.colomar@gmail.com>
  • Alejandro Colomar Andres <1903716@gmail.com>
  • Alejandro Colomar Andres <colomar.6.4.3@gmail.com>
  • ```
  • (I'll send this patch to the project soon, so hopefully this feature will be available soon.)
  • There's no such feature. But it's easy to write. Apply this patch:
  • ```diff
  • From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
  • From: Alejandro Colomar <alx@kernel.org>
  • Date: Sat, 30 Sep 2023 17:44:03 +0200
  • Subject: [PATCH] query: outformat: Add "mailto" format
  • Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • ---
  • filter.c | 18 ++++++++++++++++++
  • 1 file changed, 18 insertions(+)
  • diff --git a/filter.c b/filter.c
  • index d5b18dd..a441615 100644
  • --- a/filter.c
  • +++ b/filter.c
  • @@ -80,6 +80,7 @@ static int custom_export_database(FILE *out, struct db_enumerator e);
  • void vcard_export_item(FILE *out, int item);
  • void muttq_print_item(FILE *file, int item);
  • +void mailto_print_item(FILE *file, int item);
  • void custom_print_item(FILE *out, int item);
  • /*
  • @@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
  • struct abook_output_item_filter u_filters[] = {
  • { "vcard", N_("vCard 2 file"), vcard_export_item },
  • { "muttq", N_("mutt alias"), muttq_print_item },
  • + { "mailto", N_("mailto address"), mailto_print_item },
  • { "custom", N_("Custom format"), custom_print_item },
  • { "\0", NULL }
  • };
  • @@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  • * end of mutt alias export filter
  • */
  • +void mailto_print_item(FILE *file, int item)
  • +{
  • + abook_list *emails, *e;
  • + char *tmp = db_email_get(item);
  • +
  • + emails = csv_to_abook_list(tmp);
  • + free(tmp);
  • +
  • + for(e = emails; e; e = e->next) {
  • + fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
  • + if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
  • + break;
  • + }
  • + abook_list_free(&emails);
  • +}
  • +
  • /*
  • * printable export filter
  • --
  • 2.40.1
  • ```
  • Then, build abook:
  • ```sh
  • ./configure && make
  • ```
  • And now you can do this:
  • ```sh
  • $ ./abook --mutt-query alx --outformat mailto
  • Alejandro Colomar Andres <alx@kernel.org>
  • Alejandro Colomar Andres <alx.manpages@gmail.com>
  • ```
  • (I'll send this patch to the project soon, so hopefully this feature will be available soon.)
#1: Initial revision by user avatar alx‭ · 2023-09-30T15:49:09Z (8 months ago)
There's no such feature.  But it's easy to write.  Apply this patch:

```diff
From 8ea7d1cf4933ca24006308ac61aa50fb8ab33b02 Mon Sep 17 00:00:00 2001
From: Alejandro Colomar <alx@kernel.org>
Date: Sat, 30 Sep 2023 17:44:03 +0200
Subject: [PATCH] query: outformat: Add "mailto" format

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 filter.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/filter.c b/filter.c
index d5b18dd..a441615 100644
--- a/filter.c
+++ b/filter.c
@@ -80,6 +80,7 @@ static int    custom_export_database(FILE *out, struct db_enumerator e);
 
 void vcard_export_item(FILE *out, int item);
 void muttq_print_item(FILE *file, int item);
+void mailto_print_item(FILE *file, int item);
 void custom_print_item(FILE *out, int item);
 
 /*
@@ -121,6 +122,7 @@ struct abook_output_filter e_filters[] = {
 struct abook_output_item_filter u_filters[] = {
        { "vcard", N_("vCard 2 file"), vcard_export_item },
        { "muttq", N_("mutt alias"), muttq_print_item },
+       { "mailto", N_("mailto address"), mailto_print_item },
        { "custom", N_("Custom format"), custom_print_item },
        { "\0", NULL }
 };
@@ -2300,6 +2302,22 @@ mutt_query_export_database(FILE *out, struct db_enumerator e)
  * end of mutt alias export filter
  */
 
+void mailto_print_item(FILE *file, int item)
+{
+       abook_list *emails, *e;
+       char *tmp = db_email_get(item);
+
+       emails = csv_to_abook_list(tmp);
+       free(tmp);
+
+       for(e = emails; e; e = e->next) {
+               fprintf(file, "%s <%s>\n", db_name_get(item), e->data);
+               if(!opt_get_bool(BOOL_MUTT_RETURN_ALL_EMAILS))
+                       break;
+       }
+       abook_list_free(&emails);
+}
+
 
 /*
  * printable export filter
-- 
2.40.1

```

Then, build abook:

```sh
./configure && make
```

And now you can do this:

```sh
$ ./abook --mutt-query alx --outformat mailto
Alejandro Colomar Andres <alx@kernel.org>
Alejandro Colomar Andres <alx.manpages@gmail.com>
Alejandro Colomar Andres <alx.mailinglists@gmail.com>
Alejandro Colomar Andres <alejandro.colomar@gmail.com>
Alejandro Colomar Andres <1903716@gmail.com>
Alejandro Colomar Andres <colomar.6.4.3@gmail.com>
```

(I'll send this patch to the project soon, so hopefully this feature will be available soon.)