about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-11-07 23:36:04 +0000
committerJames Booth <boothj5@gmail.com>2013-11-07 23:36:04 +0000
commitbe653667e4d250c7ec28f2eab5026e63e95f5453 (patch)
treee1daf946ee375eb6d9cb3f459fb2c925e0203c47 /src
parent2b0108e6cc21e0ac0da62b105e36b7842edda22d (diff)
downloadprofani-tty-be653667e4d250c7ec28f2eab5026e63e95f5453.tar.gz
Added /account set <account> password <password>
Diffstat (limited to 'src')
-rw-r--r--src/command/command.c5
-rw-r--r--src/config/accounts.c9
-rw-r--r--src/config/accounts.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 95f16f93..f7737464 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -759,6 +759,7 @@ static struct cmd_t command_defs[] =
           "online|chat|away",
           "|xa|dnd          : Priority for the specified presence.",
           "resource         : The resource to be used.",
+          "password         : Password for the account, note this is currently stored in plaintext if set.",
           "muc              : The default MUC chat service to use.",
           "nick             : The default nickname to use when joining chat rooms.",
           "",
@@ -1518,6 +1519,10 @@ _cmd_account(gchar **args, struct cmd_help_t help)
                     accounts_set_resource(account_name, value);
                     cons_show("Updated resource for account %s: %s", account_name, value);
                     cons_show("");
+                } else if (strcmp(property, "password") == 0) {
+                    accounts_set_password(account_name, value);
+                    cons_show("Updated 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);
diff --git a/src/config/accounts.c b/src/config/accounts.c
index ff140769..6bfc7bef 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -435,6 +435,15 @@ accounts_set_resource(const char * const account_name, const char * const value)
 }
 
 void
+accounts_set_password(const char * const account_name, const char * const value)
+{
+    if (accounts_account_exists(account_name)) {
+        g_key_file_set_string(accounts, account_name, "password", value);
+        _save_accounts();
+    }
+}
+
+void
 accounts_set_muc_service(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
diff --git a/src/config/accounts.h b/src/config/accounts.h
index f28067f1..118b5c80 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -65,6 +65,7 @@ gboolean accounts_account_exists(const char * const account_name);
 void accounts_set_jid(const char * const account_name, const char * const value);
 void accounts_set_server(const char * const account_name, const char * const value);
 void accounts_set_resource(const char * const account_name, const char * const value);
+void accounts_set_password(const char * const account_name, const char * const value);
 void accounts_set_muc_service(const char * const account_name, const char * const value);
 void accounts_set_muc_nick(const char * const account_name, const char * const value);
 void accounts_set_last_presence(const char * const account_name, const char * const value);