diff options
author | James Booth <boothj5@gmail.com> | 2014-05-11 13:13:25 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-05-11 13:13:25 +0100 |
commit | ddbb4872b3ac8e362b37bfa565f80c888718cf7a (patch) | |
tree | aba9e690e18b4a0526ef45c2d4ab5c1f5a1a8e8f /src/config | |
parent | acdda9a82cdb470496acdde9a0bc18c668f53a65 (diff) | |
download | profani-tty-ddbb4872b3ac8e362b37bfa565f80c888718cf7a.tar.gz |
Moved global OTR settings to [otr] group
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/preferences.c | 37 | ||||
-rw-r--r-- | src/config/preferences.h | 4 |
2 files changed, 31 insertions, 10 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index 5bbb36a2..5ba7d1dc 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -45,7 +45,7 @@ #define PREF_GROUP_PRESENCE "presence" #define PREF_GROUP_CONNECTION "connection" #define PREF_GROUP_ALIAS "alias" -#define PREF_GROUP_OTR_POLICY "policy" +#define PREF_GROUP_OTR "otr" static gchar *prefs_loc; static GKeyFile *prefs; @@ -79,6 +79,27 @@ prefs_load(void) g_error_free(err); } + // move pre 0.4.1 OTR preferences to [otr] group + err = NULL; + gboolean ui_otr_warn = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "otr.warn", &err); + if (!err) { + g_key_file_set_boolean(prefs, PREF_GROUP_OTR, _get_key(PREF_OTR_WARN), ui_otr_warn); + g_key_file_remove_key(prefs, PREF_GROUP_UI, "otr.warn", NULL); + } + err = NULL; + gchar *ui_otr_log = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "otr", &err); + if (!err) { + g_key_file_set_string(prefs, PREF_GROUP_OTR, _get_key(PREF_OTR_LOG), ui_otr_log); + g_key_file_remove_key(prefs, PREF_GROUP_LOGGING, "otr", NULL); + } + err = NULL; + gchar *ui_otr_policy = g_key_file_get_string(prefs, "policy", "otr.policy", &err); + if (!err) { + g_key_file_set_string(prefs, PREF_GROUP_OTR, _get_key(PREF_OTR_POLICY), ui_otr_policy); + g_key_file_remove_group(prefs, "policy", NULL); + } + _save_prefs(); + boolean_choice_ac = autocomplete_new(); autocomplete_add(boolean_choice_ac, "on"); autocomplete_add(boolean_choice_ac, "off"); @@ -374,7 +395,6 @@ _get_group(preference_t pref) case PREF_STATUSES_CONSOLE: case PREF_STATUSES_CHAT: case PREF_STATUSES_MUC: - case PREF_OTR_WARN: return PREF_GROUP_UI; case PREF_STATES: case PREF_OUTTYPE: @@ -386,18 +406,19 @@ _get_group(preference_t pref) return PREF_GROUP_NOTIFICATIONS; case PREF_CHLOG: case PREF_GRLOG: - case PREF_OTR_LOG: case PREF_LOG_ROTATE: case PREF_LOG_SHARED: return PREF_GROUP_LOGGING; - case PREF_OTR_POLICY: - return PREF_GROUP_OTR_POLICY; case PREF_AUTOAWAY_CHECK: case PREF_AUTOAWAY_MODE: case PREF_AUTOAWAY_MESSAGE: return PREF_GROUP_PRESENCE; case PREF_CONNECT_ACCOUNT: return PREF_GROUP_CONNECTION; + case PREF_OTR_WARN: + case PREF_OTR_LOG: + case PREF_OTR_POLICY: + return PREF_GROUP_OTR; default: return NULL; } @@ -459,11 +480,11 @@ _get_key(preference_t pref) case PREF_CONNECT_ACCOUNT: return "account"; case PREF_OTR_LOG: - return "otr"; + return "log"; case PREF_OTR_WARN: - return "otr.warn"; + return "warn"; case PREF_OTR_POLICY: - return "otr.policy"; + return "policy"; case PREF_LOG_ROTATE: return "rotate"; case PREF_LOG_SHARED: diff --git a/src/config/preferences.h b/src/config/preferences.h index 3d2f6023..fb11d873 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -61,10 +61,10 @@ typedef enum { PREF_AUTOAWAY_MODE, PREF_AUTOAWAY_MESSAGE, PREF_CONNECT_ACCOUNT, - PREF_OTR_LOG, - PREF_OTR_WARN, PREF_LOG_ROTATE, PREF_LOG_SHARED, + PREF_OTR_LOG, + PREF_OTR_WARN, PREF_OTR_POLICY } preference_t; |