{"thread":{"id":"38750","subject":"[PATCH] imap-send: use cURL automatically when NO_OPENSSL defined","startedAt":"2015-03-08T05:13:55Z","lastAt":"2015-03-08T05:13:55Z","messageCount":1,"participants":["Kyle J. McKay"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"257264","messageId":"66ffbcf60233c62b6f0e443bd7d922c@74d39fa044aa309eaea14b9f57fe79c","threadId":"38750","inReplyTo":null,"subject":"[PATCH] imap-send: use cURL automatically when NO_OPENSSL defined","fromName":"Kyle J. McKay","fromEmail":"mackyle@gmail.com","sentAt":"2015-03-08T05:13:55Z","receivedAt":"2015-03-08T05:13:55Z","isPatch":true,"sender":{"key":"mackyle@gmail.com","avatar":"https://avatars.githubusercontent.com/u/813346?v=4"},"body":"If both USE_CURL_FOR_IMAP_SEND and NO_OPENSSL are defined do\nnot force the user to add --curl to get a working git imap-send\ncommand.\n\nInstead automatically select --curl and warn and ignore the\n--no-curl option.  And while we're in there, correct the\nwarning message when --curl is requested but not supported.\n\nSigned-off-by: Kyle J. McKay <mackyle@gmail.com>\n---\n Documentation/git-imap-send.txt |  3 ++-\n imap-send.c                     | 17 +++++++++++++++--\n 2 files changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt\nindex 77aacf13..5d1e4c80 100644\n--- a/Documentation/git-imap-send.txt\n+++ b/Documentation/git-imap-send.txt\n@@ -44,7 +44,8 @@ OPTIONS\n \n --no-curl::\n \tTalk to the IMAP server using git's own IMAP routines instead of\n-\tusing libcurl.\n+\tusing libcurl.  Ignored if Git was built with the NO_OPENSSL option\n+\tset.\n \n \n CONFIGURATION\ndiff --git a/imap-send.c b/imap-send.c\nindex d69887da..37ac4aa8 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -34,8 +34,16 @@ typedef void *SSL;\n #include \"http.h\"\n #endif\n \n+#if defined(USE_CURL_FOR_IMAP_SEND) && defined(NO_OPENSSL)\n+/* only available option */\n+#define USE_CURL_DEFAULT 1\n+#else\n+/* strictly opt in */\n+#define USE_CURL_DEFAULT 0\n+#endif\n+\n static int verbosity;\n-static int use_curl; /* strictly opt in */\n+static int use_curl = USE_CURL_DEFAULT;\n \n static const char * const imap_send_usage[] = { \"git imap-send [-v] [-q] [--[no-]curl] < <mbox>\", NULL };\n \n@@ -1504,9 +1512,14 @@ int main(int argc, char **argv)\n \n #ifndef USE_CURL_FOR_IMAP_SEND\n \tif (use_curl) {\n-\t\twarning(\"--use-curl not supported in this build\");\n+\t\twarning(\"--curl not supported in this build\");\n \t\tuse_curl = 0;\n \t}\n+#elif defined(NO_OPENSSL)\n+\tif (!use_curl) {\n+\t\twarning(\"--no-curl not supported in this build\");\n+\t\tuse_curl = 1;\n+\t}\n #endif\n \n \tif (!server.port)\n---\n"}]}