mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 07:36:21 +00:00
Added auto xa option, tidied autoaway code
This commit is contained in:
@@ -761,6 +761,19 @@ accounts_set_last_presence(const char * const account_name, const char * const v
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
accounts_set_last_status(const char * const account_name, const char * const value)
|
||||
{
|
||||
if (accounts_account_exists(account_name)) {
|
||||
if (value) {
|
||||
g_key_file_set_string(accounts, account_name, "presence.laststatus", value);
|
||||
} else {
|
||||
g_key_file_remove_key(accounts, account_name, "presence.laststatus", NULL);
|
||||
}
|
||||
_save_accounts();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
accounts_set_last_activity(const char * const account_name)
|
||||
{
|
||||
@@ -815,6 +828,12 @@ accounts_get_last_presence(const char * const account_name)
|
||||
return result;
|
||||
}
|
||||
|
||||
char *
|
||||
accounts_get_last_status(const char * const account_name)
|
||||
{
|
||||
return g_key_file_get_string(accounts, account_name, "presence.laststatus", NULL);
|
||||
}
|
||||
|
||||
resource_presence_t
|
||||
accounts_get_login_presence(const char * const account_name)
|
||||
{
|
||||
|
||||
@@ -66,9 +66,11 @@ void accounts_set_muc_service(const char * const account_name, const char * cons
|
||||
void accounts_set_muc_nick(const char * const account_name, const char * const value);
|
||||
void accounts_set_otr_policy(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_last_status(const char * const account_name, const char * const value);
|
||||
void accounts_set_last_activity(const char * const account_name);
|
||||
void accounts_set_login_presence(const char * const account_name, const char * const value);
|
||||
resource_presence_t accounts_get_login_presence(const char * const account_name);
|
||||
char * accounts_get_last_status(const char * const account_name);
|
||||
resource_presence_t accounts_get_last_presence(const char * const account_name);
|
||||
void accounts_set_priority_online(const char * const account_name, const gint value);
|
||||
void accounts_set_priority_chat(const char * const account_name, const gint value);
|
||||
|
||||
@@ -93,6 +93,21 @@ prefs_load(void)
|
||||
g_error_free(err);
|
||||
}
|
||||
|
||||
// move pre 0.4.8 autoaway.time to autoaway.awaytime
|
||||
if (g_key_file_has_key(prefs, PREF_GROUP_PRESENCE, "autoaway.time", NULL)) {
|
||||
gint time = g_key_file_get_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.time", NULL);
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.awaytime", time);
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_PRESENCE, "autoaway.time", NULL);
|
||||
}
|
||||
|
||||
// move pre 0.4.8 autoaway.message to autoaway.awaymessage
|
||||
if (g_key_file_has_key(prefs, PREF_GROUP_PRESENCE, "autoaway.message", NULL)) {
|
||||
char *message = g_key_file_get_string(prefs, PREF_GROUP_PRESENCE, "autoaway.message", NULL);
|
||||
g_key_file_set_string(prefs, PREF_GROUP_PRESENCE, "autoaway.awaymessage", message);
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_PRESENCE, "autoaway.message", NULL);
|
||||
prefs_free_string(message);
|
||||
}
|
||||
|
||||
// move pre 0.4.7 otr.warn to enc.warn
|
||||
err = NULL;
|
||||
gboolean otr_warn = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "otr.warn", &err);
|
||||
@@ -322,7 +337,7 @@ prefs_set_autoping(gint value)
|
||||
gint
|
||||
prefs_get_autoaway_time(void)
|
||||
{
|
||||
gint result = g_key_file_get_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.time", NULL);
|
||||
gint result = g_key_file_get_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.awaytime", NULL);
|
||||
|
||||
if (result == 0) {
|
||||
return 15;
|
||||
@@ -331,10 +346,23 @@ prefs_get_autoaway_time(void)
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
prefs_get_autoxa_time(void)
|
||||
{
|
||||
return g_key_file_get_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.xatime", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_autoaway_time(gint value)
|
||||
{
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.time", value);
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.awaytime", value);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_autoxa_time(gint value)
|
||||
{
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_PRESENCE, "autoaway.xatime", value);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
@@ -606,6 +634,7 @@ _get_group(preference_t pref)
|
||||
case PREF_AUTOAWAY_CHECK:
|
||||
case PREF_AUTOAWAY_MODE:
|
||||
case PREF_AUTOAWAY_MESSAGE:
|
||||
case PREF_AUTOXA_MESSAGE:
|
||||
return PREF_GROUP_PRESENCE;
|
||||
case PREF_CONNECT_ACCOUNT:
|
||||
case PREF_DEFAULT_ACCOUNT:
|
||||
@@ -702,7 +731,9 @@ _get_key(preference_t pref)
|
||||
case PREF_AUTOAWAY_MODE:
|
||||
return "autoaway.mode";
|
||||
case PREF_AUTOAWAY_MESSAGE:
|
||||
return "autoaway.message";
|
||||
return "autoaway.awaymessage";
|
||||
case PREF_AUTOXA_MESSAGE:
|
||||
return "autoaway.xamessage";
|
||||
case PREF_CONNECT_ACCOUNT:
|
||||
return "account";
|
||||
case PREF_DEFAULT_ACCOUNT:
|
||||
|
||||
@@ -93,6 +93,7 @@ typedef enum {
|
||||
PREF_AUTOAWAY_CHECK,
|
||||
PREF_AUTOAWAY_MODE,
|
||||
PREF_AUTOAWAY_MESSAGE,
|
||||
PREF_AUTOXA_MESSAGE,
|
||||
PREF_CONNECT_ACCOUNT,
|
||||
PREF_DEFAULT_ACCOUNT,
|
||||
PREF_LOG_ROTATE,
|
||||
@@ -143,6 +144,8 @@ gint prefs_get_roster_size(void);
|
||||
|
||||
gint prefs_get_autoaway_time(void);
|
||||
void prefs_set_autoaway_time(gint value);
|
||||
gint prefs_get_autoxa_time(void);
|
||||
void prefs_set_autoxa_time(gint value);
|
||||
|
||||
char prefs_get_otr_char(void);
|
||||
void prefs_set_otr_char(char ch);
|
||||
|
||||
Reference in New Issue
Block a user