mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
iofixed
This commit is contained in:
parent
401835f32a
commit
b4f37b9e31
@ -1268,6 +1268,7 @@ cmd_init(void)
|
||||
|
||||
account_clear_ac = autocomplete_new();
|
||||
autocomplete_add(account_clear_ac, "password");
|
||||
autocomplete_add(account_clear_ac, "eval_password");
|
||||
autocomplete_add(account_clear_ac, "server");
|
||||
autocomplete_add(account_clear_ac, "port");
|
||||
autocomplete_add(account_clear_ac, "otr");
|
||||
|
@ -340,13 +340,21 @@ cmd_account(gchar **args, struct cmd_help_t help)
|
||||
cons_show("Updated resource for account %s: %s", account_name, value);
|
||||
cons_show("");
|
||||
} else if (strcmp(property, "password") == 0) {
|
||||
if(accounts_get_account(account_name)->eval_password != NULL) {
|
||||
cons_show("Cannot set password when eval_password is set.");
|
||||
} else {
|
||||
accounts_set_password(account_name, value);
|
||||
cons_show("Updated password for account %s", account_name);
|
||||
cons_show("");
|
||||
}
|
||||
} else if (strcmp(property, "eval_password") == 0) {
|
||||
if(accounts_get_account(account_name)->password != NULL) {
|
||||
cons_show("Cannot set eval_password when password is set.");
|
||||
} else {
|
||||
accounts_set_eval_password(account_name, value);
|
||||
cons_show("Updated eval_password for account %s", account_name);
|
||||
cons_show("");
|
||||
}
|
||||
} else if (strcmp(property, "muc") == 0) {
|
||||
accounts_set_muc_service(account_name, value);
|
||||
cons_show("Updated muc service for account %s: %s", account_name, value);
|
||||
@ -431,6 +439,10 @@ cmd_account(gchar **args, struct cmd_help_t help)
|
||||
accounts_clear_password(account_name);
|
||||
cons_show("Removed password for account %s", account_name);
|
||||
cons_show("");
|
||||
} else if (strcmp(property, "eval_password") == 0) {
|
||||
accounts_clear_password(account_name);
|
||||
cons_show("Removed password for account %s", account_name);
|
||||
cons_show("");
|
||||
} else if (strcmp(property, "server") == 0) {
|
||||
accounts_clear_server(account_name);
|
||||
cons_show("Removed server for account %s", account_name);
|
||||
|
@ -61,6 +61,7 @@ static gchar *string_keys[] = {
|
||||
"port",
|
||||
"resource",
|
||||
"password",
|
||||
"eval_password",
|
||||
"presence.last",
|
||||
"presence.login",
|
||||
"muc.service",
|
||||
@ -227,8 +228,9 @@ accounts_get_account(const char * const name)
|
||||
gchar *password = g_key_file_get_string(accounts, name, "password", NULL);
|
||||
gchar *eval_password = g_key_file_get_string(accounts, name, "eval_password", NULL);
|
||||
if (eval_password != NULL) {
|
||||
FILE *evaled_password = popen(eval_password, "r");
|
||||
fscanf(evaled_password, "%s", password);
|
||||
FILE *stream = popen(eval_password, "r");
|
||||
password = g_malloc(100);
|
||||
fgets(password, 100, stream);
|
||||
}
|
||||
gboolean enabled = g_key_file_get_boolean(accounts, name, "enabled", NULL);
|
||||
|
||||
@ -466,6 +468,15 @@ accounts_clear_password(const char * const account_name)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
accounts_clear_eval_password(const char * const account_name)
|
||||
{
|
||||
if (accounts_account_exists(account_name)) {
|
||||
g_key_file_remove_key(accounts, account_name, "eval_password", NULL);
|
||||
_save_accounts();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
accounts_clear_server(const char * const account_name)
|
||||
{
|
||||
|
@ -78,6 +78,7 @@ void accounts_set_priority_all(const char * const account_name, const gint value
|
||||
gint accounts_get_priority_for_presence_type(const char * const account_name,
|
||||
resource_presence_t presence_type);
|
||||
void accounts_clear_password(const char * const account_name);
|
||||
void accounts_clear_eval_password(const char * const account_name);
|
||||
void accounts_clear_server(const char * const account_name);
|
||||
void accounts_clear_port(const char * const account_name);
|
||||
void accounts_clear_otr(const char * const account_name);
|
||||
|
Loading…
Reference in New Issue
Block a user