The config system stores empty strings as NULL.
Config variables must not be set directly, but using the config system
(this gives us validation and notifications).
*/
static void recode_buf(char *buf, size_t buflen)
{
- if (!C_ConfigCharset || !*C_ConfigCharset || !C_Charset)
+ if (!C_ConfigCharset || !C_Charset)
return;
char *s = mutt_str_strdup(buf);
struct Url url = { U_UNKNOWN };
int len;
- if (!account || !C_MessageCachedir || !*C_MessageCachedir || !dst || (dstlen == 0))
+ if (!account || !C_MessageCachedir || !dst || (dstlen == 0))
return -1;
/* make up a Url we can turn into a string */
return 0;
}
- if (C_DisplayFilter && *C_DisplayFilter)
+ if (C_DisplayFilter)
{
fp_filter_out = fp_out;
fp_out = NULL;
if (!m || !el)
return;
- if (C_Print && (!C_PrintCommand || !*C_PrintCommand))
+ if (C_Print && !C_PrintCommand)
{
mutt_message(_("No printing command has been defined"));
return;
}
if (((WithCrypto & APPLICATION_SMIME) != 0) && (msg->security & APPLICATION_SMIME) &&
- (msg->security & SEC_ENCRYPT) && C_SmimeEncryptWith && *C_SmimeEncryptWith)
+ (msg->security & SEC_ENCRYPT) && C_SmimeEncryptWith)
{
SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, HDR_CRYPTINFO, 40, "%s", _("Encrypt with: "));
s++;
for (i = 0; *s && (i < (sizeof(buf) - 1)); i++, s++)
{
- if (C_AssumedCharset && *C_AssumedCharset)
+ if (C_AssumedCharset)
{
/* As iso-2022-* has a character of '"' with non-ascii state,
* ignore it. */
if (!pc)
{
mutt_param_set(&ct->parameter, "charset",
- (C_AssumedCharset && *C_AssumedCharset) ?
- (const char *) mutt_ch_get_default_charset() :
- "us-ascii");
+ (C_AssumedCharset) ? (const char *) mutt_ch_get_default_charset() :
+ "us-ascii");
}
}
}
/* Add non-encoded part */
{
- if (C_AssumedCharset && *C_AssumedCharset)
+ if (C_AssumedCharset)
{
char *conv = mutt_str_substr_dup(s, s + holelen);
mutt_ch_convert_nonmime_string(&conv);
{
while (a)
{
- if (a->personal && ((strstr(a->personal, "=?")) || (C_AssumedCharset && *C_AssumedCharset)))
+ if (a->personal && ((strstr(a->personal, "=?")) || C_AssumedCharset))
{
rfc2047_decode(&a->personal);
}
if (C_Rfc2047Parameters && np->value && strstr(np->value, "=?"))
rfc2047_decode(&np->value);
- else if (C_AssumedCharset && *C_AssumedCharset)
+ else if (C_AssumedCharset)
mutt_ch_convert_nonmime_string(&np->value);
}
else if (*(s + 1) == '\0')
if (istext && s->flags & MUTT_CHARCONV)
{
char *charset = mutt_param_get(&b->parameter, "charset");
- if (!charset && C_AssumedCharset && *C_AssumedCharset)
+ if (!charset && C_AssumedCharset)
charset = mutt_ch_get_default_charset();
if (charset && C_Charset)
cd = mutt_ch_iconv_open(C_Charset, charset, MUTT_ICONV_HOOK_FROM);
{
int rc = IMAP_AUTH_FAILURE;
- if (C_ImapAuthenticators && *C_ImapAuthenticators)
+ if (C_ImapAuthenticators)
{
mutt_debug(LL_DEBUG2, "Trying user-defined imap_authenticators\n");
}
/* If they did not explicitly request or configure oauth then fail quietly */
- if (!(method || (C_ImapOauthRefreshCommand && *C_ImapOauthRefreshCommand)))
+ if (!method && !C_ImapOauthRefreshCommand)
return IMAP_AUTH_UNAVAIL;
mutt_message(_("Authenticating (OAUTHBEARER)..."));
mutt_buffer_init(&token);
while ((linebuf = mutt_file_read_line(linebuf, &buflen, fp, &line, MUTT_CONT)))
{
- const bool conv = C_ConfigCharset && (*C_ConfigCharset) && C_Charset;
+ const bool conv = C_ConfigCharset && C_Charset;
if (conv)
{
currentline = mutt_str_strdup(linebuf);
{
enum ConnectionType conn_type;
- if (C_Tunnel && *C_Tunnel)
+ if (C_Tunnel)
conn_type = MUTT_CONNECTION_TUNNEL;
else if (account->flags & MUTT_ACCT_SSL)
conn_type = MUTT_CONNECTION_SSL;
}
else if (mb_type == MUTT_NOTMUCH)
mutt_buffer_strcpy(p, NONULL(C_Folder));
- else if (C_Folder && *C_Folder && (C_Folder[strlen(C_Folder) - 1] == '/'))
+ else if (C_Folder && (C_Folder[strlen(C_Folder) - 1] == '/'))
mutt_buffer_strcpy(p, NONULL(C_Folder));
else
mutt_buffer_printf(p, "%s/", NONULL(C_Folder));
bool mutt_should_hide_protected_subject(struct Email *e)
{
if (C_CryptProtectedHeadersWrite && (e->security & SEC_ENCRYPT) &&
- !(e->security & SEC_INLINE) && C_CryptProtectedHeadersSubject && *C_CryptProtectedHeadersSubject)
+ !(e->security & SEC_INLINE) && C_CryptProtectedHeadersSubject)
{
return true;
}
cctx.need_passphrase = need_passphrase;
cctx.fname = fname;
cctx.sig_fname = sig_fname;
- if (C_PgpSignAs && *C_PgpSignAs)
+ if (C_PgpSignAs)
cctx.signas = C_PgpSignAs;
else
cctx.signas = C_PgpDefaultKey;
mutt_buffer_quote_filename(buf_fname, fname, true);
cctx.fname = mutt_b2s(buf_fname);
- if (C_PgpSignAs && *C_PgpSignAs)
+ if (C_PgpSignAs)
cctx.signas = C_PgpSignAs;
else
cctx.signas = C_PgpDefaultKey;
struct Address *t = NULL;
bool found = false;
- if (C_SmimeDecryptUseDefaultKey && C_SmimeDefaultKey && *C_SmimeDefaultKey)
+ if (C_SmimeDecryptUseDefaultKey && C_SmimeDefaultKey)
{
snprintf(SmimeKeyToUse, sizeof(SmimeKeyToUse), "%s/%s", NONULL(C_SmimeKeys),
C_SmimeDefaultKey);
pid_t pid;
char *intermediates = NULL;
- char *signas = (C_SmimeSignAs && *C_SmimeSignAs) ? C_SmimeSignAs : C_SmimeDefaultKey;
+ char *signas = C_SmimeSignAs ? C_SmimeSignAs : C_SmimeDefaultKey;
if (!signas || !*signas)
{
mutt_error(_("Can't sign: No key specified. Use Sign As."));
if (folder->ff->nd->desc)
{
char *desc = mutt_str_strdup(folder->ff->nd->desc);
- if (C_NewsgroupsCharset && *C_NewsgroupsCharset)
+ if (C_NewsgroupsCharset)
mutt_ch_convert_string(&desc, C_NewsgroupsCharset, C_Charset, MUTT_ICONV_HOOK_FROM);
mutt_mb_filter_unprintable(&desc);
/* try to create cache directory and enable caching */
adata->cacheable = false;
- if ((rc >= 0) && C_NewsCacheDir && *C_NewsCacheDir)
+ if ((rc >= 0) && C_NewsCacheDir)
{
cache_expand(file, sizeof(file), &conn->account, NULL);
if (mutt_file_mkdir(file, S_IRWXU) < 0)
}
/* get list of authenticators */
- if (C_NntpAuthenticators && *C_NntpAuthenticators)
+ if (C_NntpAuthenticators)
mutt_str_strfcpy(authenticators, C_NntpAuthenticators, sizeof(authenticators));
else if (adata->hasCAPABILITIES)
{
*/
static void apply_exclude_tags(notmuch_query_t *query)
{
- if (!C_NmExcludeTags || !query || !*C_NmExcludeTags)
+ if (!C_NmExcludeTags || !query)
return;
char *end = NULL, *tag = NULL;
static enum PopAuthRes pop_auth_oauth(struct PopAccountData *adata, const char *method)
{
/* If they did not explicitly request or configure oauth then fail quietly */
- if (!(method || (C_PopOauthRefreshCommand && *C_PopOauthRefreshCommand)))
+ if (!method && !C_PopOauthRefreshCommand)
return POP_A_UNAVAIL;
mutt_message(_("Authenticating (OAUTHBEARER)..."));
return -3;
}
- if (C_PopAuthenticators && *C_PopAuthenticators)
+ if (C_PopAuthenticators)
{
/* Try user-specified list of authentication methods */
methods = mutt_str_strdup(C_PopAuthenticators);
char *encrypt_as = NULL;
struct Body *clear_content = NULL;
- if (!(C_Postponed && *C_Postponed))
+ if (!C_Postponed)
{
mutt_error(_("Can't postpone. $postponed is unset"));
return -1;
if (b && (b->type == TYPE_TEXT) && (!b->noconv && !b->force_charset))
{
char *chs = mutt_param_get(&b->parameter, "charset");
- char *fchs = b->use_disp ?
- ((C_AttachCharset && *C_AttachCharset) ? C_AttachCharset : C_Charset) :
- C_Charset;
+ char *fchs = b->use_disp ? (C_AttachCharset ? C_AttachCharset : C_Charset) : C_Charset;
if (C_Charset && (chs || C_SendCharset) &&
(convert_file_from_to(fp, fchs, chs ? chs : C_SendCharset, &fromcode,
&tocode, info) != (size_t)(-1)))
struct Body *att = mutt_body_new();
att->filename = mutt_str_strdup(path);
- if (C_MimeTypeQueryCommand && *C_MimeTypeQueryCommand && C_MimeTypeQueryFirst)
+ if (C_MimeTypeQueryCommand && C_MimeTypeQueryFirst)
run_mime_type_query(att);
/* Attempt to determine the appropriate content-type based on the filename
if (!att->subtype)
mutt_lookup_mime_type(att, path);
- if (!att->subtype && C_MimeTypeQueryCommand && *C_MimeTypeQueryCommand && !C_MimeTypeQueryFirst)
+ if (!att->subtype && C_MimeTypeQueryCommand && !C_MimeTypeQueryFirst)
{
run_mime_type_query(att);
}
if (e->security & SEC_SIGN)
{
fputc('S', msg->fp);
- if (C_PgpSignAs && *C_PgpSignAs)
+ if (C_PgpSignAs)
fprintf(msg->fp, "<%s>", C_PgpSignAs);
}
if (e->security & SEC_INLINE)
if (e->security & SEC_ENCRYPT)
{
fputc('E', msg->fp);
- if (C_SmimeEncryptWith && *C_SmimeEncryptWith)
+ if (C_SmimeEncryptWith)
fprintf(msg->fp, "C<%s>", C_SmimeEncryptWith);
}
if (e->security & SEC_OPPENCRYPT)
if (e->security & SEC_SIGN)
{
fputc('S', msg->fp);
- if (C_SmimeSignAs && *C_SmimeSignAs)
+ if (C_SmimeSignAs)
fprintf(msg->fp, "<%s>", C_SmimeSignAs);
}
if (e->security & SEC_INLINE)
{
int r = SMTP_AUTH_UNAVAIL;
- if (C_SmtpAuthenticators && *C_SmtpAuthenticators)
+ if (C_SmtpAuthenticators)
{
char *methods = mutt_str_strdup(C_SmtpAuthenticators);
char *method = NULL;