about summary refs log tree commit diff stats
path: root/src/accounts.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-30 22:59:09 +0000
committerJames Booth <boothj5@gmail.com>2013-01-30 22:59:09 +0000
commit9aa6a39cd6a263ed18aa91f178a318133e9ba27c (patch)
treeff15cf6f421b295be7084a7d090bfeb1d7474e05 /src/accounts.c
parentb54c273e579f5772a23a6f58e3637f5d78903992 (diff)
downloadprofani-tty-9aa6a39cd6a263ed18aa91f178a318133e9ba27c.tar.gz
Added account_get_login_presence to account
Diffstat (limited to 'src/accounts.c')
-rw-r--r--src/accounts.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/accounts.c b/src/accounts.c
index 7e21b8fa..568391bf 100644
--- a/src/accounts.c
+++ b/src/accounts.c
@@ -31,6 +31,7 @@
 #include "files.h"
 #include "jid.h"
 #include "log.h"
+#include "xmpp.h"
 
 static gchar *accounts_loc;
 static GKeyFile *accounts;
@@ -318,6 +319,22 @@ accounts_set_login_presence(const char * const account_name, const char * const
     }
 }
 
+void
+account_get_login_presence(const char * const account_name, char *str)
+{
+    static char *online = "online";
+    gchar *setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL);
+    if (setting == NULL) {
+        str = online;
+    } else if (!presence_valid_string(setting)) {
+        log_warning("Error reading presence.login for account: '%s', value: '%s', defaulting to 'online'",
+            account_name, setting);
+        str = online;
+    } else {
+        str = setting;
+    }
+}
+
 static void
 _fix_legacy_accounts(const char * const account_name)
 {