Skip to content
Snippets Groups Projects
Commit 160ac4c0 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Added boolean settings parser.

parent ba49af27
No related branches found
No related tags found
No related merge requests found
......@@ -102,3 +102,30 @@ bool sieve_setting_get_size_value
return TRUE;
}
bool sieve_setting_get_bool_value
(struct sieve_instance *svinst, const char *setting,
bool *value_r)
{
const char *str_value;
char *endp;
str_value = sieve_setting_get(svinst, setting);
if ( str_value == NULL || *str_value == '\0' )
return FALSE;
if ( strcasecmp(str_value, "yes" ) == 0) {
*value_r = TRUE;
return TRUE;
}
if ( strcasecmp(str_value, "no" ) == 0) {
*value_r = FALSE;
return TRUE;
}
sieve_sys_warning("invalid boolean value for setting '%s': '%s'",
setting, str_value);
return FALSE;
}
......@@ -22,16 +22,17 @@ static inline const char *sieve_setting_get
}
bool sieve_setting_get_uint_value
(struct sieve_instance *svinst, const char *setting,
unsigned long long int *value_r);
(struct sieve_instance *svinst, const char *setting,
unsigned long long int *value_r);
bool sieve_setting_get_int_value
(struct sieve_instance *svinst, const char *setting,
long long int *value_r);
(struct sieve_instance *svinst, const char *setting,
long long int *value_r);
bool sieve_setting_get_size_value
(struct sieve_instance *svinst, const char *setting,
size_t *value_r);
(struct sieve_instance *svinst, const char *setting,
size_t *value_r);
bool sieve_setting_get_bool_value
(struct sieve_instance *svinst, const char *setting,
bool *value_r);
/*
* Home directory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.