diff options
author | Michael Vetter <jubalh@iodoru.org> | 2023-04-18 14:43:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 14:43:01 +0200 |
commit | 4933d4e4f3d1cc8ee308c1bb6bfc4c13ec64ac57 (patch) | |
tree | 1fed6ab534a857572c0732fe5c9dad73af4617dd /src/config/accounts.c | |
parent | f51dc019bc08e41fa4564d465136522648a7a663 (diff) | |
parent | bed5c02c0dde0fe3cd8eb6018322a78b4441e22a (diff) | |
download | profani-tty-4933d4e4f3d1cc8ee308c1bb6bfc4c13ec64ac57.tar.gz |
Merge pull request #1827 from H3rnand3zzz/feature/sessions-alarm
New Feature: Session Alarm
Diffstat (limited to 'src/config/accounts.c')
-rw-r--r-- | src/config/accounts.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c index f7e6e456..d5747cbf 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -347,13 +347,15 @@ accounts_get_account(const char* const name) gchar* auth_policy = g_key_file_get_string(accounts, name, "auth.policy", NULL); + int max_sessions = g_key_file_get_integer(accounts, name, "max.sessions", 0); + ProfAccount* new_account = account_new(g_strdup(name), jid, password, eval_password, enabled, server, port, resource, last_presence, login_presence, priority_online, priority_chat, priority_away, priority_xa, priority_dnd, muc_service, muc_nick, otr_policy, otr_manual, otr_opportunistic, otr_always, omemo_policy, omemo_enabled, omemo_disabled, ox_enabled, pgp_enabled, pgp_keyid, - startscript, theme, tls_policy, auth_policy, client); + startscript, theme, tls_policy, auth_policy, client, max_sessions); return new_account; } @@ -569,6 +571,12 @@ accounts_set_theme(const char* const account_name, const char* const value) } void +accounts_set_max_sessions(const char* const account_name, const int value) +{ + _accounts_set_int_option(account_name, "max.sessions", value); +} + +void accounts_clear_password(const char* const account_name) { _accounts_clear_string_option(account_name, "password"); @@ -635,6 +643,12 @@ accounts_clear_otr(const char* const account_name) } void +accounts_clear_max_sessions(const char* const account_name) +{ + _accounts_clear_string_option(account_name, "max.sessions"); +} + +void accounts_add_otr_policy(const char* const account_name, const char* const contact_jid, const char* const policy) { if (accounts_account_exists(account_name)) { @@ -865,6 +879,24 @@ accounts_get_last_activity(const char* const account_name) } } +char* +accounts_get_resource(const char* const account_name) +{ + if (!accounts_account_exists(account_name)) { + return NULL; + } + return g_key_file_get_string(accounts, account_name, "resource", NULL); +} + +int +accounts_get_max_sessions(const char* const account_name) +{ + if (!accounts_account_exists(account_name)) { + return 0; + } + return g_key_file_get_integer(accounts, account_name, "max.sessions", 0); +} + void accounts_set_login_presence(const char* const account_name, const char* const value) { |