mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added account_get_login_presence to account
This commit is contained in:
parent
b54c273e57
commit
9aa6a39cd6
@ -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)
|
||||
{
|
||||
|
@ -52,5 +52,6 @@ void accounts_set_server(const char * const account_name, const char * const val
|
||||
void accounts_set_resource(const char * const account_name, const char * const value);
|
||||
void accounts_set_last_presence(const char * const account_name, const char * const value);
|
||||
void accounts_set_login_presence(const char * const account_name, const char * const value);
|
||||
void account_get_login_presence(const char * const account_name, char *str);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user