]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-reply.c
test: add initial ruby tests
[notmuch] / notmuch-reply.c
index 47993d223090ee423b7c42126122dcd688215c8b..4464741fe3567e974e6f07038b93f6446b744150 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include "notmuch-client.h"
+#include "string-util.h"
 #include "sprinter.h"
 
 static void
@@ -465,14 +466,21 @@ guess_from_in_received_headers (notmuch_config_t *config,
                                notmuch_message_t *message)
 {
     const char *received, *addr;
+    char *sanitized;
 
     received = notmuch_message_get_header (message, "received");
     if (! received)
        return NULL;
 
-    addr = guess_from_in_received_for (config, received);
+    sanitized = sanitize_string (NULL, received);
+    if (! sanitized)
+       return NULL;
+
+    addr = guess_from_in_received_for (config, sanitized);
     if (! addr)
-       addr = guess_from_in_received_by (config, received);
+       addr = guess_from_in_received_by (config, sanitized);
+
+    talloc_free (sanitized);
 
     return addr;
 }
@@ -761,7 +769,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
        .part = -1,
        .crypto = {
            .verify = FALSE,
-           .decrypt = FALSE
+           .decrypt = FALSE,
+           .gpgpath = NULL
        }
     };
     int format = FORMAT_DEFAULT;
@@ -781,6 +790,7 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
                                  { "sender", FALSE },
                                  { 0, 0 } } },
        { NOTMUCH_OPT_BOOLEAN, &params.crypto.decrypt, "decrypt", 'd', 0 },
+       { NOTMUCH_OPT_INHERIT, (void *) &notmuch_shared_options, NULL, 0, 0 },
        { 0, 0, 0, 0, 0 }
     };
 
@@ -788,6 +798,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
     if (opt_index < 0)
        return EXIT_FAILURE;
 
+    notmuch_process_shared_options (argv[0]);
+
     if (format == FORMAT_HEADERS_ONLY) {
        reply_format_func = notmuch_reply_format_headers_only;
     } else if (format == FORMAT_JSON) {
@@ -813,6 +825,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
        return EXIT_FAILURE;
     }
 
+    params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config);
+
     if (notmuch_database_open (notmuch_config_get_database_path (config),
                               NOTMUCH_DATABASE_MODE_READ_ONLY, &notmuch))
        return EXIT_FAILURE;