From: Pietro Cerutti Date: Mon, 12 Nov 2018 10:38:53 +0000 (+0000) Subject: mutt_str_startswith - smtp.c X-Git-Tag: 2019-10-25~532^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85df03b4a77abf8ed52a8d7001f2f34bba6d5fa4;p=neomutt mutt_str_startswith - smtp.c --- diff --git a/smtp.c b/smtp.c index e5c58138c..77f4effab 100644 --- a/smtp.c +++ b/smtp.c @@ -123,20 +123,22 @@ static int smtp_get_resp(struct Connection *conn) /* read error, or no response code */ return SMTP_ERR_READ; } + const char *s = buf + 4; /* Skip the response code and the space/dash */ + size_t plen; - if (mutt_str_strncasecmp("8BITMIME", buf + 4, 8) == 0) + if (mutt_str_startswith(s, "8BITMIME", CASE_IGNORE)) mutt_bit_set(Capabilities, EIGHTBITMIME); - else if (mutt_str_strncasecmp("AUTH ", buf + 4, 5) == 0) + else if ((plen = mutt_str_startswith(s, "AUTH ", CASE_IGNORE))) { mutt_bit_set(Capabilities, AUTH); FREE(&AuthMechs); - AuthMechs = mutt_str_strdup(buf + 9); + AuthMechs = mutt_str_strdup(s + plen); } - else if (mutt_str_strncasecmp("DSN", buf + 4, 3) == 0) + else if (mutt_str_startswith(s, "DSN", CASE_IGNORE)) mutt_bit_set(Capabilities, DSN); - else if (mutt_str_strncasecmp("STARTTLS", buf + 4, 8) == 0) + else if (mutt_str_startswith(s, "STARTTLS", CASE_IGNORE)) mutt_bit_set(Capabilities, STARTTLS); - else if (mutt_str_strncasecmp("SMTPUTF8", buf + 4, 8) == 0) + else if (mutt_str_startswith(s, "SMTPUTF8", CASE_IGNORE)) mutt_bit_set(Capabilities, SMTPUTF8); if (!valid_smtp_code(buf, n, &n))