1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-01 06:06:45 +02:00

Add password_eval option to skip password prompt

Runs a command and uses its output as the password. This can be used for
getting the password from a password manager such as pass.
This commit is contained in:
Antoine Kaufmann
2016-01-19 13:45:52 -08:00
parent 74416b4b58
commit ac6d8ff89c
4 changed files with 70 additions and 3 deletions

View File

@ -158,11 +158,13 @@ static const struct tox_strings {
const char* download_path;
const char* chatlogs_path;
const char* avatar_path;
const char* password_eval;
} tox_strings = {
"tox",
"download_path",
"chatlogs_path",
"avatar_path",
"password_eval",
};
static void tox_defaults(struct user_settings* settings)
@ -170,6 +172,7 @@ static void tox_defaults(struct user_settings* settings)
strcpy(settings->download_path, "");
strcpy(settings->chatlogs_path, "");
strcpy(settings->avatar_path, "");
strcpy(settings->password_eval, "");
}
#ifdef AUDIO
@ -359,6 +362,14 @@ int settings_load(struct user_settings *s, const char *patharg)
if (len >= sizeof(s->avatar_path))
s->avatar_path[0] = '\0';
}
if ( config_setting_lookup_string(setting, tox_strings.password_eval, &str) ) {
snprintf(s->password_eval, sizeof(s->password_eval), "%s", str);
int len = strlen(str);
if (len >= sizeof(s->password_eval))
s->password_eval[0] = '\0';
}
}
/* keys */