about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/config')
-rw-r--r--src/config/account.c48
-rw-r--r--src/config/account.h81
-rw-r--r--src/config/accounts.c252
-rw-r--r--src/config/accounts.h106
-rw-r--r--src/config/color.c591
-rw-r--r--src/config/color.h12
-rw-r--r--src/config/conflists.c22
-rw-r--r--src/config/conflists.h8
-rw-r--r--src/config/files.c70
-rw-r--r--src/config/files.h36
-rw-r--r--src/config/preferences.c1422
-rw-r--r--src/config/preferences.h90
-rw-r--r--src/config/scripts.c45
-rw-r--r--src/config/scripts.h4
-rw-r--r--src/config/theme.c684
-rw-r--r--src/config/theme.h20
-rw-r--r--src/config/tlscerts.c76
-rw-r--r--src/config/tlscerts.h71
18 files changed, 1929 insertions, 1709 deletions
diff --git a/src/config/account.c b/src/config/account.c
index 54d7b18e..c0f508b4 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -46,18 +46,18 @@
 #include "xmpp/resource.h"
 
 ProfAccount*
-account_new(const gchar *const name, const gchar *const jid,
-    const gchar *const password, const gchar *eval_password, gboolean enabled, const gchar *const server,
-    int port, const gchar *const resource, const gchar *const last_presence,
-    const gchar *const login_presence, int priority_online, int priority_chat,
-    int priority_away, int priority_xa, int priority_dnd,
-    const gchar *const muc_service, const gchar *const muc_nick,
-    const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
-    GList *otr_always,  const gchar *const omemo_policy, GList *omemo_enabled,
-    GList *omemo_disabled, const gchar *const pgp_keyid, const char *const startscript,
-    const char *const theme, gchar *tls_policy, gchar *auth_policy)
+account_new(const gchar* const name, const gchar* const jid,
+            const gchar* const password, const gchar* eval_password, gboolean enabled, const gchar* const server,
+            int port, const gchar* const resource, const gchar* const last_presence,
+            const gchar* const login_presence, int priority_online, int priority_chat,
+            int priority_away, int priority_xa, int priority_dnd,
+            const gchar* const muc_service, const gchar* const muc_nick,
+            const gchar* const otr_policy, GList* otr_manual, GList* otr_opportunistic,
+            GList* otr_always, const gchar* const omemo_policy, GList* omemo_enabled,
+            GList* omemo_disabled, const gchar* const pgp_keyid, const char* const startscript,
+            const char* const theme, gchar* tls_policy, gchar* auth_policy)
 {
-    ProfAccount *new_account = malloc(sizeof(ProfAccount));
+    ProfAccount* new_account = malloc(sizeof(ProfAccount));
     memset(new_account, 0, sizeof(ProfAccount));
 
     new_account->name = strdup(name);
@@ -125,7 +125,7 @@ account_new(const gchar *const name, const gchar *const jid,
     }
 
     if (muc_nick == NULL) {
-        Jid *jidp = jid_create(new_account->jid);
+        Jid* jidp = jid_create(new_account->jid);
         new_account->muc_nick = strdup(jidp->domainpart);
         jid_destroy(jidp);
     } else {
@@ -185,7 +185,7 @@ account_new(const gchar *const name, const gchar *const jid,
 }
 
 char*
-account_create_connect_jid(ProfAccount *account)
+account_create_connect_jid(ProfAccount* account)
 {
     if (account->resource) {
         return create_fulljid(account->jid, account->resource);
@@ -195,15 +195,15 @@ account_create_connect_jid(ProfAccount *account)
 }
 
 gboolean
-account_eval_password(ProfAccount *account)
+account_eval_password(ProfAccount* account)
 {
     assert(account != NULL);
     assert(account->eval_password != NULL);
 
-    gchar **output = NULL;
-    gchar **error = NULL;
+    gchar** output = NULL;
+    gchar** error = NULL;
 
-    gchar *argv[] = {"sh", "-c", account->eval_password, NULL};
+    gchar* argv[] = { "sh", "-c", account->eval_password, NULL };
     if (!call_external(argv, &output, &error)) {
         return FALSE;
     }
@@ -228,7 +228,7 @@ account_eval_password(ProfAccount *account)
 }
 
 void
-account_free(ProfAccount *account)
+account_free(ProfAccount* account)
 {
     if (account == NULL) {
         return;
@@ -259,24 +259,28 @@ account_free(ProfAccount *account)
     free(account);
 }
 
-void account_set_server(ProfAccount *account, const char *server)
+void
+account_set_server(ProfAccount* account, const char* server)
 {
     free(account->server);
     account->server = strdup(server);
 }
 
-void account_set_port(ProfAccount *account, int port)
+void
+account_set_port(ProfAccount* account, int port)
 {
     account->port = port;
 }
 
-void account_set_tls_policy(ProfAccount *account, const char *tls_policy)
+void
+account_set_tls_policy(ProfAccount* account, const char* tls_policy)
 {
     free(account->tls_policy);
     account->tls_policy = strdup(tls_policy);
 }
 
-void account_set_auth_policy(ProfAccount *account, const char *auth_policy)
+void
+account_set_auth_policy(ProfAccount* account, const char* auth_policy)
 {
     free(account->auth_policy);
     account->auth_policy = strdup(auth_policy);
diff --git a/src/config/account.h b/src/config/account.h
index deb0e31a..dfc7bc12 100644
--- a/src/config/account.h
+++ b/src/config/account.h
@@ -38,54 +38,55 @@
 
 #include "common.h"
 
-typedef struct prof_account_t {
-    gchar *name;
-    gchar *jid;
-    gchar *password;
-    gchar *eval_password;
-    gchar *resource;
-    gchar *server;
+typedef struct prof_account_t
+{
+    gchar* name;
+    gchar* jid;
+    gchar* password;
+    gchar* eval_password;
+    gchar* resource;
+    gchar* server;
     int port;
-    gchar *last_presence;
-    gchar *login_presence;
+    gchar* last_presence;
+    gchar* login_presence;
     gint priority_online;
     gint priority_chat;
     gint priority_away;
     gint priority_xa;
     gint priority_dnd;
-    gchar *muc_service;
-    gchar *muc_nick;
+    gchar* muc_service;
+    gchar* muc_nick;
     gboolean enabled;
-    gchar *otr_policy;
-    GList *otr_manual;
-    GList *otr_opportunistic;
-    GList *otr_always;
-    gchar *omemo_policy;
-    GList *omemo_enabled;
-    GList *omemo_disabled;
-    gchar *pgp_keyid;
-    gchar *startscript;
-    gchar *theme;
-    gchar *tls_policy;
-    gchar *auth_policy;
+    gchar* otr_policy;
+    GList* otr_manual;
+    GList* otr_opportunistic;
+    GList* otr_always;
+    gchar* omemo_policy;
+    GList* omemo_enabled;
+    GList* omemo_disabled;
+    gchar* pgp_keyid;
+    gchar* startscript;
+    gchar* theme;
+    gchar* tls_policy;
+    gchar* auth_policy;
 } ProfAccount;
 
-ProfAccount* account_new(const gchar *const name, const gchar *const jid,
-    const gchar *const passord, const gchar *eval_password, gboolean enabled, const gchar *const server,
-    int port, const gchar *const resource, const gchar *const last_presence,
-    const gchar *const login_presence, int priority_online, int priority_chat,
-    int priority_away, int priority_xa, int priority_dnd,
-    const gchar *const muc_service, const gchar *const muc_nick,
-    const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
-    GList *otr_always, const gchar *const omemo_policy, GList *omemo_enabled,
-    GList *omemo_disabled, const gchar *const pgp_keyid, const char *const startscript,
-    const char *const theme, gchar *tls_policy, gchar *auth_policy);
-char* account_create_connect_jid(ProfAccount *account);
-gboolean account_eval_password(ProfAccount *account);
-void account_free(ProfAccount *account);
-void account_set_server(ProfAccount *account, const char *server);
-void account_set_port(ProfAccount *account, int port);
-void account_set_tls_policy(ProfAccount *account, const char *tls_policy);
-void account_set_auth_policy(ProfAccount *account, const char *auth_policy);
+ProfAccount* account_new(const gchar* const name, const gchar* const jid,
+                         const gchar* const passord, const gchar* eval_password, gboolean enabled, const gchar* const server,
+                         int port, const gchar* const resource, const gchar* const last_presence,
+                         const gchar* const login_presence, int priority_online, int priority_chat,
+                         int priority_away, int priority_xa, int priority_dnd,
+                         const gchar* const muc_service, const gchar* const muc_nick,
+                         const gchar* const otr_policy, GList* otr_manual, GList* otr_opportunistic,
+                         GList* otr_always, const gchar* const omemo_policy, GList* omemo_enabled,
+                         GList* omemo_disabled, const gchar* const pgp_keyid, const char* const startscript,
+                         const char* const theme, gchar* tls_policy, gchar* auth_policy);
+char* account_create_connect_jid(ProfAccount* account);
+gboolean account_eval_password(ProfAccount* account);
+void account_free(ProfAccount* account);
+void account_set_server(ProfAccount* account, const char* server);
+void account_set_port(ProfAccount* account, int port);
+void account_set_tls_policy(ProfAccount* account, const char* tls_policy);
+void account_set_auth_policy(ProfAccount* account, const char* auth_policy);
 
 #endif
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 92bf19d0..5539919b 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -50,8 +50,8 @@
 #include "xmpp/xmpp.h"
 #include "xmpp/jid.h"
 
-static char *accounts_loc;
-static GKeyFile *accounts;
+static char* accounts_loc;
+static GKeyFile* accounts;
 
 static Autocomplete all_ac;
 static Autocomplete enabled_ac;
@@ -75,7 +75,7 @@ accounts_load(void)
 
     // create the logins searchable list for autocompletion
     gsize naccounts;
-    gchar **account_names = g_key_file_get_groups(accounts, &naccounts);
+    gchar** account_names = g_key_file_get_groups(accounts, &naccounts);
 
     gsize i;
     for (i = 0; i < naccounts; i++) {
@@ -97,13 +97,13 @@ accounts_close(void)
 }
 
 char*
-accounts_find_enabled(const char *const prefix, gboolean previous, void *context)
+accounts_find_enabled(const char* const prefix, gboolean previous, void* context)
 {
     return autocomplete_complete(enabled_ac, prefix, TRUE, previous);
 }
 
 char*
-accounts_find_all(const char *const prefix, gboolean previous, void *context)
+accounts_find_all(const char* const prefix, gboolean previous, void* context)
 {
     return autocomplete_complete(all_ac, prefix, TRUE, previous);
 }
@@ -121,12 +121,12 @@ accounts_reset_enabled_search(void)
 }
 
 void
-accounts_add(const char *account_name, const char *altdomain, const int port, const char *const tls_policy, const char *const auth_policy)
+accounts_add(const char* account_name, const char* altdomain, const int port, const char* const tls_policy, const char* const auth_policy)
 {
     // set account name and resource
-    const char *barejid = account_name;
-    char *resource = jid_random_resource();
-    Jid *jid = jid_create(account_name);
+    const char* barejid = account_name;
+    char* resource = jid_random_resource();
+    Jid* jid = jid_create(account_name);
     if (jid) {
         barejid = jid->barejid;
         if (jid->resourcepart) {
@@ -156,7 +156,7 @@ accounts_add(const char *account_name, const char *altdomain, const int port, co
         g_key_file_set_string(accounts, account_name, "auth.policy", auth_policy);
     }
 
-    Jid *jidp = jid_create(barejid);
+    Jid* jidp = jid_create(barejid);
 
     if (jidp->localpart == NULL) {
         g_key_file_set_string(accounts, account_name, "muc.nick", jidp->domainpart);
@@ -183,7 +183,7 @@ accounts_add(const char *account_name, const char *altdomain, const int port, co
 }
 
 int
-accounts_remove(const char *account_name)
+accounts_remove(const char* account_name)
 {
     int r = g_key_file_remove_group(accounts, account_name, NULL);
     _save_accounts();
@@ -199,12 +199,12 @@ accounts_get_list(void)
 }
 
 ProfAccount*
-accounts_get_account(const char *const name)
+accounts_get_account(const char* const name)
 {
     if (!g_key_file_has_group(accounts, name)) {
         return NULL;
     } else {
-        gchar *jid = g_key_file_get_string(accounts, name, "jid", NULL);
+        gchar* jid = g_key_file_get_string(accounts, name, "jid", NULL);
 
         // fix accounts that have no jid property by setting to name
         if (jid == NULL) {
@@ -212,16 +212,16 @@ accounts_get_account(const char *const name)
             _save_accounts();
         }
 
-        gchar *password = g_key_file_get_string(accounts, name, "password", NULL);
-        gchar *eval_password = g_key_file_get_string(accounts, name, "eval_password", NULL);
+        gchar* password = g_key_file_get_string(accounts, name, "password", NULL);
+        gchar* eval_password = g_key_file_get_string(accounts, name, "eval_password", NULL);
         gboolean enabled = g_key_file_get_boolean(accounts, name, "enabled", NULL);
 
-        gchar *server = g_key_file_get_string(accounts, name, "server", NULL);
-        gchar *resource = g_key_file_get_string(accounts, name, "resource", NULL);
+        gchar* server = g_key_file_get_string(accounts, name, "server", NULL);
+        gchar* resource = g_key_file_get_string(accounts, name, "resource", NULL);
         int port = g_key_file_get_integer(accounts, name, "port", NULL);
 
-        gchar *last_presence = g_key_file_get_string(accounts, name, "presence.last", NULL);
-        gchar *login_presence = g_key_file_get_string(accounts, name, "presence.login", NULL);
+        gchar* last_presence = g_key_file_get_string(accounts, name, "presence.last", NULL);
+        gchar* login_presence = g_key_file_get_string(accounts, name, "presence.login", NULL);
 
         int priority_online = g_key_file_get_integer(accounts, name, "priority.online", NULL);
         int priority_chat = g_key_file_get_integer(accounts, name, "priority.chat", NULL);
@@ -229,7 +229,7 @@ accounts_get_account(const char *const name)
         int priority_xa = g_key_file_get_integer(accounts, name, "priority.xa", NULL);
         int priority_dnd = g_key_file_get_integer(accounts, name, "priority.dnd", NULL);
 
-        gchar *muc_service = NULL;
+        gchar* muc_service = NULL;
         if (g_key_file_has_key(accounts, name, "muc.service", NULL)) {
             muc_service = g_key_file_get_string(accounts, name, "muc.service", NULL);
         } else {
@@ -241,16 +241,16 @@ accounts_get_account(const char *const name)
                 }
             }
         }
-        gchar *muc_nick = g_key_file_get_string(accounts, name, "muc.nick", NULL);
+        gchar* muc_nick = g_key_file_get_string(accounts, name, "muc.nick", NULL);
 
-        gchar *otr_policy = NULL;
+        gchar* otr_policy = NULL;
         if (g_key_file_has_key(accounts, name, "otr.policy", NULL)) {
             otr_policy = g_key_file_get_string(accounts, name, "otr.policy", NULL);
         }
 
         gsize length;
-        GList *otr_manual = NULL;
-        gchar **manual = g_key_file_get_string_list(accounts, name, "otr.manual", &length, NULL);
+        GList* otr_manual = NULL;
+        gchar** manual = g_key_file_get_string_list(accounts, name, "otr.manual", &length, NULL);
         if (manual) {
             int i = 0;
             for (i = 0; i < length; i++) {
@@ -259,8 +259,8 @@ accounts_get_account(const char *const name)
             g_strfreev(manual);
         }
 
-        GList *otr_opportunistic = NULL;
-        gchar **opportunistic = g_key_file_get_string_list(accounts, name, "otr.opportunistic", &length, NULL);
+        GList* otr_opportunistic = NULL;
+        gchar** opportunistic = g_key_file_get_string_list(accounts, name, "otr.opportunistic", &length, NULL);
         if (opportunistic) {
             int i = 0;
             for (i = 0; i < length; i++) {
@@ -269,8 +269,8 @@ accounts_get_account(const char *const name)
             g_strfreev(opportunistic);
         }
 
-        GList *otr_always = NULL;
-        gchar **always = g_key_file_get_string_list(accounts, name, "otr.always", &length, NULL);
+        GList* otr_always = NULL;
+        gchar** always = g_key_file_get_string_list(accounts, name, "otr.always", &length, NULL);
         if (always) {
             int i = 0;
             for (i = 0; i < length; i++) {
@@ -279,13 +279,13 @@ accounts_get_account(const char *const name)
             g_strfreev(always);
         }
 
-        gchar *omemo_policy = NULL;
+        gchar* omemo_policy = NULL;
         if (g_key_file_has_key(accounts, name, "omemo.policy", NULL)) {
             omemo_policy = g_key_file_get_string(accounts, name, "omemo.policy", NULL);
         }
 
-        GList *omemo_enabled = NULL;
-        gchar **enabled_list = g_key_file_get_string_list(accounts, name, "omemo.enabled", &length, NULL);
+        GList* omemo_enabled = NULL;
+        gchar** enabled_list = g_key_file_get_string_list(accounts, name, "omemo.enabled", &length, NULL);
         if (enabled_list) {
             int i = 0;
             for (i = 0; i < length; i++) {
@@ -294,8 +294,8 @@ accounts_get_account(const char *const name)
             g_strfreev(enabled_list);
         }
 
-        GList *omemo_disabled = NULL;
-        gchar **disabled_list = g_key_file_get_string_list(accounts, name, "omemo.disabled", &length, NULL);
+        GList* omemo_disabled = NULL;
+        gchar** disabled_list = g_key_file_get_string_list(accounts, name, "omemo.disabled", &length, NULL);
         if (disabled_list) {
             int i = 0;
             for (i = 0; i < length; i++) {
@@ -304,40 +304,36 @@ accounts_get_account(const char *const name)
             g_strfreev(disabled_list);
         }
 
-        gchar *pgp_keyid = NULL;
+        gchar* pgp_keyid = NULL;
         if (g_key_file_has_key(accounts, name, "pgp.keyid", NULL)) {
             pgp_keyid = g_key_file_get_string(accounts, name, "pgp.keyid", NULL);
         }
 
-        gchar *startscript = NULL;
+        gchar* startscript = NULL;
         if (g_key_file_has_key(accounts, name, "script.start", NULL)) {
             startscript = g_key_file_get_string(accounts, name, "script.start", NULL);
         }
 
-        gchar *theme = NULL;
+        gchar* theme = NULL;
         if (g_key_file_has_key(accounts, name, "theme", NULL)) {
             theme = g_key_file_get_string(accounts, name, "theme", NULL);
         }
 
-        gchar *tls_policy = g_key_file_get_string(accounts, name, "tls.policy", NULL);
-        if (tls_policy && ((g_strcmp0(tls_policy, "force") != 0) &&
-                (g_strcmp0(tls_policy, "allow") != 0) &&
-                (g_strcmp0(tls_policy, "trust") != 0) &&
-                (g_strcmp0(tls_policy, "disable") != 0) &&
-                (g_strcmp0(tls_policy, "legacy") != 0))) {
+        gchar* tls_policy = g_key_file_get_string(accounts, name, "tls.policy", NULL);
+        if (tls_policy && ((g_strcmp0(tls_policy, "force") != 0) && (g_strcmp0(tls_policy, "allow") != 0) && (g_strcmp0(tls_policy, "trust") != 0) && (g_strcmp0(tls_policy, "disable") != 0) && (g_strcmp0(tls_policy, "legacy") != 0))) {
             g_free(tls_policy);
             tls_policy = NULL;
         }
 
-        gchar *auth_policy = g_key_file_get_string(accounts, name, "auth.policy", NULL);
+        gchar* auth_policy = g_key_file_get_string(accounts, name, "auth.policy", NULL);
 
-        ProfAccount *new_account = account_new(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,  pgp_keyid, startscript, theme, tls_policy,
-            auth_policy);
+        ProfAccount* new_account = account_new(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, pgp_keyid, startscript, theme, tls_policy,
+                                               auth_policy);
 
         g_free(jid);
         g_free(password);
@@ -361,7 +357,7 @@ accounts_get_account(const char *const name)
 }
 
 gboolean
-accounts_enable(const char *const name)
+accounts_enable(const char* const name)
 {
     if (g_key_file_has_group(accounts, name)) {
         g_key_file_set_boolean(accounts, name, "enabled", TRUE);
@@ -374,7 +370,7 @@ accounts_enable(const char *const name)
 }
 
 gboolean
-accounts_disable(const char *const name)
+accounts_disable(const char* const name)
 {
     if (g_key_file_has_group(accounts, name)) {
         g_key_file_set_boolean(accounts, name, "enabled", FALSE);
@@ -387,7 +383,7 @@ accounts_disable(const char *const name)
 }
 
 gboolean
-accounts_rename(const char *const account_name, const char *const new_name)
+accounts_rename(const char* const account_name, const char* const new_name)
 {
     if (g_key_file_has_group(accounts, new_name)) {
         return FALSE;
@@ -398,7 +394,7 @@ accounts_rename(const char *const account_name, const char *const new_name)
     }
 
     // treat all properties as strings for copy
-    gchar *string_keys[] = {
+    gchar* string_keys[] = {
         "enabled",
         "jid",
         "server",
@@ -431,7 +427,7 @@ accounts_rename(const char *const account_name, const char *const new_name)
 
     int i;
     for (i = 0; i < ARRAY_SIZE(string_keys); i++) {
-        char *value = g_key_file_get_string(accounts, account_name, string_keys[i], NULL);
+        char* value = g_key_file_get_string(accounts, account_name, string_keys[i], NULL);
         if (value) {
             g_key_file_set_string(accounts, new_name, string_keys[i], value);
             g_free(value);
@@ -452,16 +448,15 @@ accounts_rename(const char *const account_name, const char *const new_name)
 }
 
 gboolean
-accounts_account_exists(const char *const account_name)
+accounts_account_exists(const char* const account_name)
 {
     return g_key_file_has_group(accounts, account_name);
-
 }
 
 void
-accounts_set_jid(const char *const account_name, const char *const value)
+accounts_set_jid(const char* const account_name, const char* const value)
 {
-    Jid *jid = jid_create(value);
+    Jid* jid = jid_create(value);
     if (jid) {
         if (accounts_account_exists(account_name)) {
             g_key_file_set_string(accounts, account_name, "jid", jid->barejid);
@@ -483,7 +478,7 @@ accounts_set_jid(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_server(const char *const account_name, const char *const value)
+accounts_set_server(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "server", value);
@@ -492,7 +487,7 @@ accounts_set_server(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_port(const char *const account_name, const int value)
+accounts_set_port(const char* const account_name, const int value)
 {
     if (value != 0) {
         g_key_file_set_integer(accounts, account_name, "port", value);
@@ -501,7 +496,7 @@ accounts_set_port(const char *const account_name, const int value)
 }
 
 void
-accounts_set_resource(const char *const account_name, const char *const value)
+accounts_set_resource(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "resource", value);
@@ -510,7 +505,7 @@ accounts_set_resource(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_password(const char *const account_name, const char *const value)
+accounts_set_password(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "password", value);
@@ -519,7 +514,7 @@ accounts_set_password(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_eval_password(const char *const account_name, const char *const value)
+accounts_set_eval_password(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "eval_password", value);
@@ -528,7 +523,7 @@ accounts_set_eval_password(const char *const account_name, const char *const val
 }
 
 void
-accounts_set_pgp_keyid(const char *const account_name, const char *const value)
+accounts_set_pgp_keyid(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "pgp.keyid", value);
@@ -537,7 +532,7 @@ accounts_set_pgp_keyid(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_script_start(const char *const account_name, const char *const value)
+accounts_set_script_start(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "script.start", value);
@@ -546,7 +541,7 @@ accounts_set_script_start(const char *const account_name, const char *const valu
 }
 
 void
-accounts_set_theme(const char *const account_name, const char *const value)
+accounts_set_theme(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "theme", value);
@@ -555,7 +550,7 @@ accounts_set_theme(const char *const account_name, const char *const value)
 }
 
 void
-accounts_clear_password(const char *const account_name)
+accounts_clear_password(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "password", NULL);
@@ -564,7 +559,7 @@ accounts_clear_password(const char *const account_name)
 }
 
 void
-accounts_clear_eval_password(const char *const account_name)
+accounts_clear_eval_password(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "eval_password", NULL);
@@ -573,7 +568,7 @@ accounts_clear_eval_password(const char *const account_name)
 }
 
 void
-accounts_clear_server(const char *const account_name)
+accounts_clear_server(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "server", NULL);
@@ -582,7 +577,7 @@ accounts_clear_server(const char *const account_name)
 }
 
 void
-accounts_clear_port(const char *const account_name)
+accounts_clear_port(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "port", NULL);
@@ -591,7 +586,7 @@ accounts_clear_port(const char *const account_name)
 }
 
 void
-accounts_clear_pgp_keyid(const char *const account_name)
+accounts_clear_pgp_keyid(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "pgp.keyid", NULL);
@@ -600,7 +595,7 @@ accounts_clear_pgp_keyid(const char *const account_name)
 }
 
 void
-accounts_clear_script_start(const char *const account_name)
+accounts_clear_script_start(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "script.start", NULL);
@@ -609,7 +604,7 @@ accounts_clear_script_start(const char *const account_name)
 }
 
 void
-accounts_clear_theme(const char *const account_name)
+accounts_clear_theme(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "theme", NULL);
@@ -618,7 +613,7 @@ accounts_clear_theme(const char *const account_name)
 }
 
 void
-accounts_clear_muc(const char *const account_name)
+accounts_clear_muc(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "muc.service", NULL);
@@ -627,7 +622,7 @@ accounts_clear_muc(const char *const account_name)
 }
 
 void
-accounts_clear_resource(const char *const account_name)
+accounts_clear_resource(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "resource", NULL);
@@ -636,7 +631,7 @@ accounts_clear_resource(const char *const account_name)
 }
 
 void
-accounts_clear_otr(const char *const account_name)
+accounts_clear_otr(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "otr.policy", NULL);
@@ -645,10 +640,10 @@ accounts_clear_otr(const char *const account_name)
 }
 
 void
-accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy)
+accounts_add_otr_policy(const char* const account_name, const char* const contact_jid, const char* const policy)
 {
     if (accounts_account_exists(account_name)) {
-        GString *key = g_string_new("otr.");
+        GString* key = g_string_new("otr.");
         g_string_append(key, policy);
         conf_string_list_add(accounts, account_name, key->str, contact_jid);
         g_string_free(key, TRUE);
@@ -672,7 +667,7 @@ accounts_add_otr_policy(const char *const account_name, const char *const contac
 }
 
 void
-accounts_add_omemo_state(const char *const account_name, const char *const contact_jid, gboolean enabled)
+accounts_add_omemo_state(const char* const account_name, const char* const contact_jid, gboolean enabled)
 {
     if (accounts_account_exists(account_name)) {
         if (enabled) {
@@ -688,7 +683,7 @@ accounts_add_omemo_state(const char *const account_name, const char *const conta
 }
 
 void
-accounts_clear_omemo_state(const char *const account_name, const char *const contact_jid)
+accounts_clear_omemo_state(const char* const account_name, const char* const contact_jid)
 {
     if (accounts_account_exists(account_name)) {
         conf_string_list_remove(accounts, account_name, "omemo.enabled", contact_jid);
@@ -698,7 +693,7 @@ accounts_clear_omemo_state(const char *const account_name, const char *const con
 }
 
 void
-accounts_set_muc_service(const char *const account_name, const char *const value)
+accounts_set_muc_service(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "muc.service", value);
@@ -707,7 +702,7 @@ accounts_set_muc_service(const char *const account_name, const char *const value
 }
 
 void
-accounts_set_muc_nick(const char *const account_name, const char *const value)
+accounts_set_muc_nick(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "muc.nick", value);
@@ -716,7 +711,7 @@ 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)
+accounts_set_otr_policy(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "otr.policy", value);
@@ -725,7 +720,7 @@ accounts_set_otr_policy(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_omemo_policy(const char *const account_name, const char *const value)
+accounts_set_omemo_policy(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "omemo.policy", value);
@@ -734,7 +729,7 @@ accounts_set_omemo_policy(const char *const account_name, const char *const valu
 }
 
 void
-accounts_set_tls_policy(const char *const account_name, const char *const value)
+accounts_set_tls_policy(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "tls.policy", value);
@@ -743,7 +738,7 @@ accounts_set_tls_policy(const char *const account_name, const char *const value)
 }
 
 void
-accounts_set_auth_policy(const char *const account_name, const char *const value)
+accounts_set_auth_policy(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "auth.policy", value);
@@ -752,7 +747,7 @@ accounts_set_auth_policy(const char *const account_name, const char *const value
 }
 
 void
-accounts_set_priority_online(const char *const account_name, const gint value)
+accounts_set_priority_online(const char* const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.online", value);
@@ -761,7 +756,7 @@ 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)
+accounts_set_priority_chat(const char* const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.chat", value);
@@ -770,7 +765,7 @@ accounts_set_priority_chat(const char *const account_name, const gint value)
 }
 
 void
-accounts_set_priority_away(const char *const account_name, const gint value)
+accounts_set_priority_away(const char* const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.away", value);
@@ -779,7 +774,7 @@ accounts_set_priority_away(const char *const account_name, const gint value)
 }
 
 void
-accounts_set_priority_xa(const char *const account_name, const gint value)
+accounts_set_priority_xa(const char* const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.xa", value);
@@ -788,7 +783,7 @@ accounts_set_priority_xa(const char *const account_name, const gint value)
 }
 
 void
-accounts_set_priority_dnd(const char *const account_name, const gint value)
+accounts_set_priority_dnd(const char* const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.dnd", value);
@@ -797,7 +792,7 @@ accounts_set_priority_dnd(const char *const account_name, const gint value)
 }
 
 void
-accounts_set_priority_all(const char *const account_name, const gint value)
+accounts_set_priority_all(const char* const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         accounts_set_priority_online(account_name, value);
@@ -810,28 +805,27 @@ accounts_set_priority_all(const char *const account_name, const gint value)
 }
 
 gint
-accounts_get_priority_for_presence_type(const char *const account_name,
-    resource_presence_t presence_type)
+accounts_get_priority_for_presence_type(const char* const account_name,
+                                        resource_presence_t presence_type)
 {
     gint result;
 
-    switch (presence_type)
-    {
-        case (RESOURCE_ONLINE):
-            result = g_key_file_get_integer(accounts, account_name, "priority.online", NULL);
-            break;
-        case (RESOURCE_CHAT):
-            result = g_key_file_get_integer(accounts, account_name, "priority.chat", NULL);
-            break;
-        case (RESOURCE_AWAY):
-            result = g_key_file_get_integer(accounts, account_name, "priority.away", NULL);
-            break;
-        case (RESOURCE_XA):
-            result = g_key_file_get_integer(accounts, account_name, "priority.xa", NULL);
-            break;
-        default:
-            result = g_key_file_get_integer(accounts, account_name, "priority.dnd", NULL);
-            break;
+    switch (presence_type) {
+    case (RESOURCE_ONLINE):
+        result = g_key_file_get_integer(accounts, account_name, "priority.online", NULL);
+        break;
+    case (RESOURCE_CHAT):
+        result = g_key_file_get_integer(accounts, account_name, "priority.chat", NULL);
+        break;
+    case (RESOURCE_AWAY):
+        result = g_key_file_get_integer(accounts, account_name, "priority.away", NULL);
+        break;
+    case (RESOURCE_XA):
+        result = g_key_file_get_integer(accounts, account_name, "priority.xa", NULL);
+        break;
+    default:
+        result = g_key_file_get_integer(accounts, account_name, "priority.dnd", NULL);
+        break;
     }
 
     if (result < JABBER_PRIORITY_MIN || result > JABBER_PRIORITY_MAX)
@@ -841,7 +835,7 @@ accounts_get_priority_for_presence_type(const char *const account_name,
 }
 
 void
-accounts_set_last_presence(const char *const account_name, const char *const value)
+accounts_set_last_presence(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "presence.last", value);
@@ -850,7 +844,7 @@ accounts_set_last_presence(const char *const account_name, const char *const val
 }
 
 void
-accounts_set_last_status(const char *const account_name, const char *const value)
+accounts_set_last_status(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         if (value) {
@@ -863,16 +857,16 @@ accounts_set_last_status(const char *const account_name, const char *const value
 }
 
 void
-accounts_set_last_activity(const char *const account_name)
+accounts_set_last_activity(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
-        GDateTime *nowdt = g_date_time_new_now_utc();
+        GDateTime* nowdt = g_date_time_new_now_utc();
         GTimeVal nowtv;
         gboolean res = g_date_time_to_timeval(nowdt, &nowtv);
         g_date_time_unref(nowdt);
 
         if (res) {
-            char *timestr = g_time_val_to_iso8601(&nowtv);
+            char* timestr = g_time_val_to_iso8601(&nowtv);
             g_key_file_set_string(accounts, account_name, "last.activity", timestr);
             free(timestr);
             _save_accounts();
@@ -881,7 +875,7 @@ accounts_set_last_activity(const char *const account_name)
 }
 
 char*
-accounts_get_last_activity(const char *const account_name)
+accounts_get_last_activity(const char* const account_name)
 {
     if (accounts_account_exists(account_name)) {
         return g_key_file_get_string(accounts, account_name, "last.activity", NULL);
@@ -891,7 +885,7 @@ accounts_get_last_activity(const char *const account_name)
 }
 
 void
-accounts_set_login_presence(const char *const account_name, const char *const value)
+accounts_set_login_presence(const char* const account_name, const char* const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "presence.login", value);
@@ -900,10 +894,10 @@ accounts_set_login_presence(const char *const account_name, const char *const va
 }
 
 resource_presence_t
-accounts_get_last_presence(const char *const account_name)
+accounts_get_last_presence(const char* const account_name)
 {
     resource_presence_t result;
-    gchar *setting = g_key_file_get_string(accounts, account_name, "presence.last", NULL);
+    gchar* setting = g_key_file_get_string(accounts, account_name, "presence.last", NULL);
 
     if (setting == NULL || (strcmp(setting, "online") == 0)) {
         result = RESOURCE_ONLINE;
@@ -917,7 +911,7 @@ accounts_get_last_presence(const char *const account_name)
         result = RESOURCE_DND;
     } else {
         log_warning("Error reading presence.last for account: '%s', value: '%s', defaulting to 'online'",
-            account_name, setting);
+                    account_name, setting);
         result = RESOURCE_ONLINE;
     }
 
@@ -928,16 +922,16 @@ accounts_get_last_presence(const char *const account_name)
 }
 
 char*
-accounts_get_last_status(const char *const account_name)
+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)
+accounts_get_login_presence(const char* const account_name)
 {
     resource_presence_t result;
-    gchar *setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL);
+    gchar* setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL);
 
     if (setting == NULL || (strcmp(setting, "online") == 0)) {
         result = RESOURCE_ONLINE;
@@ -953,7 +947,7 @@ accounts_get_login_presence(const char *const account_name)
         result = accounts_get_last_presence(account_name);
     } else {
         log_warning("Error reading presence.login for account: '%s', value: '%s', defaulting to 'online'",
-            account_name, setting);
+                    account_name, setting);
         result = RESOURCE_ONLINE;
     }
 
@@ -967,10 +961,10 @@ static void
 _save_accounts(void)
 {
     gsize g_data_size;
-    gchar *g_accounts_data = g_key_file_to_data(accounts, &g_data_size, NULL);
+    gchar* g_accounts_data = g_key_file_to_data(accounts, &g_data_size, NULL);
 
-    gchar *base = g_path_get_dirname(accounts_loc);
-    gchar *true_loc = get_file_or_linked(accounts_loc, base);
+    gchar* base = g_path_get_dirname(accounts_loc);
+    gchar* true_loc = get_file_or_linked(accounts_loc, base);
     g_file_set_contents(true_loc, g_accounts_data, g_data_size, NULL);
     g_chmod(accounts_loc, S_IRUSR | S_IWUSR);
 
diff --git a/src/config/accounts.h b/src/config/accounts.h
index 2cd4bcf6..4195a82e 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -44,61 +44,61 @@
 void accounts_load(void);
 void accounts_close(void);
 
-char* accounts_find_all(const char *const prefix, gboolean previous, void *context);
-char* accounts_find_enabled(const char *const prefix, gboolean previous, void *context);
+char* accounts_find_all(const char* const prefix, gboolean previous, void* context);
+char* accounts_find_enabled(const char* const prefix, gboolean previous, void* context);
 void accounts_reset_all_search(void);
 void accounts_reset_enabled_search(void);
-void accounts_add(const char *jid, const char *altdomain, const int port, const char *const tls_policy, const char *const auth_policy);
-int  accounts_remove(const char *jid);
+void accounts_add(const char* jid, const char* altdomain, const int port, const char* const tls_policy, const char* const auth_policy);
+int accounts_remove(const char* jid);
 gchar** accounts_get_list(void);
-ProfAccount* accounts_get_account(const char *const name);
-gboolean accounts_enable(const char *const name);
-gboolean accounts_disable(const char *const name);
-gboolean accounts_rename(const char *const account_name,
-    const char *const new_name);
-gboolean accounts_account_exists(const char *const account_name);
-void accounts_set_jid(const char *const account_name, const char *const value);
-void accounts_set_server(const char *const account_name, const char *const value);
-void accounts_set_port(const char *const account_name, const int value);
-void accounts_set_resource(const char *const account_name, const char *const value);
-void accounts_set_password(const char *const account_name, const char *const value);
-void accounts_set_eval_password(const char *const account_name, const char *const value);
-void accounts_set_muc_service(const char *const account_name, const char *const value);
-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_tls_policy(const char *const account_name, const char *const value);
-void accounts_set_auth_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);
-char* accounts_get_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);
-void accounts_set_priority_away(const char *const account_name, const gint value);
-void accounts_set_priority_xa(const char *const account_name, const gint value);
-void accounts_set_priority_dnd(const char *const account_name, const gint value);
-void accounts_set_priority_all(const char *const account_name, const gint value);
-gint accounts_get_priority_for_presence_type(const char *const account_name,
-    resource_presence_t presence_type);
-void accounts_set_pgp_keyid(const char *const account_name, const char *const value);
-void accounts_set_script_start(const char *const account_name, const char *const value);
-void accounts_set_theme(const char *const account_name, const char *const value);
-void accounts_clear_password(const char *const account_name);
-void accounts_clear_eval_password(const char *const account_name);
-void accounts_clear_server(const char *const account_name);
-void accounts_clear_port(const char *const account_name);
-void accounts_clear_otr(const char *const account_name);
-void accounts_clear_pgp_keyid(const char *const account_name);
-void accounts_clear_script_start(const char *const account_name);
-void accounts_clear_theme(const char *const account_name);
-void accounts_clear_muc(const char *const account_name);
-void accounts_clear_resource(const char *const account_name);
-void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy);
-void accounts_add_omemo_state(const char *const account_name, const char *const contact_jid, gboolean enabled);
-void accounts_clear_omemo_state(const char *const account_name, const char *const contact_jid);
+ProfAccount* accounts_get_account(const char* const name);
+gboolean accounts_enable(const char* const name);
+gboolean accounts_disable(const char* const name);
+gboolean accounts_rename(const char* const account_name,
+                         const char* const new_name);
+gboolean accounts_account_exists(const char* const account_name);
+void accounts_set_jid(const char* const account_name, const char* const value);
+void accounts_set_server(const char* const account_name, const char* const value);
+void accounts_set_port(const char* const account_name, const int value);
+void accounts_set_resource(const char* const account_name, const char* const value);
+void accounts_set_password(const char* const account_name, const char* const value);
+void accounts_set_eval_password(const char* const account_name, const char* const value);
+void accounts_set_muc_service(const char* const account_name, const char* const value);
+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_tls_policy(const char* const account_name, const char* const value);
+void accounts_set_auth_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);
+char* accounts_get_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);
+void accounts_set_priority_away(const char* const account_name, const gint value);
+void accounts_set_priority_xa(const char* const account_name, const gint value);
+void accounts_set_priority_dnd(const char* const account_name, const gint value);
+void accounts_set_priority_all(const char* const account_name, const gint value);
+gint accounts_get_priority_for_presence_type(const char* const account_name,
+                                             resource_presence_t presence_type);
+void accounts_set_pgp_keyid(const char* const account_name, const char* const value);
+void accounts_set_script_start(const char* const account_name, const char* const value);
+void accounts_set_theme(const char* const account_name, const char* const value);
+void accounts_clear_password(const char* const account_name);
+void accounts_clear_eval_password(const char* const account_name);
+void accounts_clear_server(const char* const account_name);
+void accounts_clear_port(const char* const account_name);
+void accounts_clear_otr(const char* const account_name);
+void accounts_clear_pgp_keyid(const char* const account_name);
+void accounts_clear_script_start(const char* const account_name);
+void accounts_clear_theme(const char* const account_name);
+void accounts_clear_muc(const char* const account_name);
+void accounts_clear_resource(const char* const account_name);
+void accounts_add_otr_policy(const char* const account_name, const char* const contact_jid, const char* const policy);
+void accounts_add_omemo_state(const char* const account_name, const char* const contact_jid, gboolean enabled);
+void accounts_clear_omemo_state(const char* const account_name, const char* const contact_jid);
 
 #endif
diff --git a/src/config/color.c b/src/config/color.c
index cb857792..790febc7 100644
--- a/src/config/color.c
+++ b/src/config/color.c
@@ -52,13 +52,15 @@
 #include "config/theme.h"
 #include "log.h"
 
-static
-struct color_pair_cache
+static struct color_pair_cache
 {
-    struct { int16_t fg, bg; } *pairs;
+    struct
+    {
+        int16_t fg, bg;
+    } * pairs;
     int size;
     int capacity;
-} cache = {0};
+} cache = { 0 };
 
 /*
  * xterm default 256 colors
@@ -66,279 +68,281 @@ struct color_pair_cache
  */
 
 const struct color_def color_names[COLOR_NAME_SIZE] = {
-  [0]  =  { 0,      0,      0,  "black" },
-  [1]  =  { 0,      100,    25, "red" },
-  [2]  =  { 120,    100,    25, "green" },
-  [3]  =  { 60,     100,    25, "yellow" },
-  [4]  =  { 240,    100,    25, "blue" },
-  [5]  =  { 300,    100,    25, "magenta" },
-  [6]  =  { 180,    100,    25, "cyan" },
-  [7]  =  { 0,      0,      75, "white" },
-  [8]  =  { 0,      0,      50, "lightblack" },
-  [9]  =  { 0,      100,    50, "lightred" },
-  [10] =  { 120,    100,    50, "lightgreen" },
-  [11] =  { 60,     100,    50, "lightyellow" },
-  [12] =  { 240,    100,    50, "lightblue" },
-  [13] =  { 300,    100,    50, "lightmagenta" },
-  [14] =  { 180,    100,    50, "lightcyan" },
-  [15] =  { 0,      0,      100, "lightwhite" },
-  [16] =  { 0,      0,      0,  "grey0" },
-  [17] =  { 240,    100,    18, "navyblue" },
-  [18] =  { 240,    100,    26, "darkblue" },
-  [19] =  { 240,    100,    34, "blue3" },
-  [20] =  { 240,    100,    42, "blue3" },
-  [21] =  { 240,    100,    50, "blue1" },
-  [22] =  { 120,    100,    18, "darkgreen" },
-  [23] =  { 180,    100,    18, "deepskyblue4" },
-  [24] =  { 97,     100,    26, "deepskyblue4" },
-  [25] =  { 7,     100,    34, "deepskyblue4" },
-  [26] =  { 13,     100,    42, "dodgerblue3" },
-  [27] =  { 17,     100,    50, "dodgerblue2" },
-  [28] =  { 120,    100,    26, "green4" },
-  [29] =  { 62,     100,    26, "springgreen4" },
-  [30] =  { 180,    100,    26, "turquoise4" },
-  [31] =  { 93,     100,    34, "deepskyblue3" },
-  [32] =  { 2,     100,    42, "deepskyblue3" },
-  [33] =  { 8,     100,    50, "dodgerblue1" },
-  [34] =  { 120,    100,    34, "green3" },
-  [35] =  { 52,     100,    34, "springgreen3" },
-  [36] =  { 66,     100,    34, "darkcyan" },
-  [37] =  { 180,    100,    34, "lightseagreen" },
-  [38] =  { 91,     100,    42, "deepskyblue2" },
-  [39] =  { 98,     100,    50, "deepskyblue1" },
-  [40] =  { 120,    100,    42, "green3" },
-  [41] =  { 46,     100,    42, "springgreen3" },
-  [42] =  { 57,     100,    42, "springgreen2" },
-  [43] =  { 68,     100,    42, "cyan3" },
-  [44] =  { 180,    100,    42, "darkturquoise" },
-  [45] =  { 89,     100,    50, "turquoise2" },
-  [46] =  { 120,    100,    50, "green1" },
-  [47] =  { 42,     100,    50, "springgreen2" },
-  [48] =  { 51,     100,    50, "springgreen1" },
-  [49] =  { 61,     100,    50, "mediumspringgreen" },
-  [50] =  { 70,     100,    50, "cyan2" },
-  [51] =  { 180,    100,    50, "cyan1" },
-  [52] =  { 0,      100,    18, "darkred" },
-  [53] =  { 300,    100,    18, "deeppink4" },
-  [54] =  { 82,     100,    26, "purple4" },
-  [55] =  { 72,     100,    34, "purple4" },
-  [56] =  { 66,     100,    42, "purple3" },
-  [57] =  { 62,     100,    50, "blueviolet" },
-  [58] =  { 60,     100,    18, "orange4" },
-  [59] =  { 0,      0,      37, "grey37" },
-  [60] =  { 240,    17,     45, "mediumpurple4" },
-  [61] =  { 240,    33,     52, "slateblue3" },
-  [62] =  { 240,    60,     60, "slateblue3" },
-  [63] =  { 240,    100,    68, "royalblue1" },
-  [64] =  { 7,      100,    26, "chartreuse4" },
-  [65] =  { 120,    17,     45, "darkseagreen4" },
-  [66] =  { 180,    17,     45, "paleturquoise4" },
-  [67] =  { 210,    33,     52, "steelblue" },
-  [68] =  { 220,    60,     60, "steelblue3" },
-  [69] =  { 225,    100,    68, "cornflowerblue" },
-  [70] =  { 7,      100,    34, "chartreuse3" },
-  [71] =  { 120,    33,     52, "darkseagreen4" },
-  [72] =  { 150,    33,     52, "cadetblue" },
-  [73] =  { 180,    33,     52, "cadetblue" },
-  [74] =  { 200,    60,     60, "skyblue3" },
-  [75] =  { 210,    100,    68, "steelblue1" },
-  [76] =  { 3,      100,    42, "chartreuse3" },
-  [77] =  { 120,    60,     60, "palegreen3" },
-  [78] =  { 140,    60,     60, "seagreen3" },
-  [79] =  { 160,    60,     60, "aquamarine3" },
-  [80] =  { 180,    60,     60, "mediumturquoise" },
-  [81] =  { 195,    100,    68, "steelblue1" },
-  [82] =  { 7,      100,    50, "chartreuse2" },
-  [83] =  { 120,    100,    68, "seagreen2" },
-  [84] =  { 135,    100,    68, "seagreen1" },
-  [85] =  { 150,    100,    68, "seagreen1" },
-  [86] =  { 165,    100,    68, "aquamarine1" },
-  [87] =  { 180,    100,    68, "darkslategray2" },
-  [88] =  { 0,      100,    26, "darkred" },
-  [89] =  { 17,     100,    26, "deeppink4" },
-  [90] =  { 300,    100,    26, "darkmagenta" },
-  [91] =  { 86,     100,    34, "darkmagenta" },
-  [92] =  { 77,     100,    42, "darkviolet" },
-  [93] =  { 71,     100,    50, "purple" },
-  [94] =  { 2,      100,    26, "orange4" },
-  [95] =  { 0,      17,     45, "lightpink4" },
-  [96] =  { 300,    17,     45, "plum4" },
-  [97] =  { 270,    33,     52, "mediumpurple3" },
-  [98] =  { 260,    60,     60, "mediumpurple3" },
-  [99] =  { 255,    100,    68, "slateblue1" },
-  [100] = { 60,     100,    26, "yellow4" },
-  [101] = { 60,     17,     45, "wheat4" },
-  [102] = { 0,      0,      52, "grey53" },
-  [103] = { 240,    20,     60, "lightslategrey" },
-  [104] = { 240,    50,     68, "mediumpurple" },
-  [105] = { 240,    100,    76, "lightslateblue" },
-  [106] = { 3,      100,    34, "yellow4" },
-  [107] = { 90,     33,     52, "darkolivegreen3" },
-  [108] = { 120,    20,     60, "darkseagreen" },
-  [109] = { 180,    20,     60, "lightskyblue3" },
-  [110] = { 210,    50,     68, "lightskyblue3" },
-  [111] = { 220,    100,    76, "skyblue2" },
-  [112] = { 2,      100,    42, "chartreuse2" },
-  [113] = { 100,    60,     60, "darkolivegreen3" },
-  [114] = { 120,    50,     68, "palegreen3" },
-  [115] = { 150,    50,     68, "darkseagreen3" },
-  [116] = { 180,    50,     68, "darkslategray3" },
-  [117] = { 200,    100,    76, "skyblue1" },
-  [118] = { 8,      100,    50, "chartreuse1" },
-  [119] = { 105,    100,    68, "lightgreen" },
-  [120] = { 120,    100,    76, "lightgreen" },
-  [121] = { 140,    100,    76, "palegreen1" },
-  [122] = { 160,    100,    76, "aquamarine1" },
-  [123] = { 180,    100,    76, "darkslategray1" },
-  [124] = { 0,      100,    34, "red3" },
-  [125] = { 27,     100,    34, "deeppink4" },
-  [126] = { 13,     100,    34, "mediumvioletred" },
-  [127] = { 300,    100,    34, "magenta3" },
-  [128] = { 88,     100,    42, "darkviolet" },
-  [129] = { 81,     100,    50, "purple" },
-  [130] = { 2,      100,    34, "darkorange3" },
-  [131] = { 0,      33,     52, "indianred" },
-  [132] = { 330,    33,     52, "hotpink3" },
-  [133] = { 300,    33,     52, "mediumorchid3" },
-  [134] = { 280,    60,     60, "mediumorchid" },
-  [135] = { 270,    100,    68, "mediumpurple2" },
-  [136] = { 6,      100,    34, "darkgoldenrod" },
-  [137] = { 30,     33,     52, "lightsalmon3" },
-  [138] = { 0,      20,     60, "rosybrown" },
-  [139] = { 300,    20,     60, "grey63" },
-  [140] = { 270,    50,     68, "mediumpurple2" },
-  [141] = { 260,    100,    76, "mediumpurple1" },
-  [142] = { 60,     100,    34, "gold3" },
-  [143] = { 60,     33,     52, "darkkhaki" },
-  [144] = { 60,     20,     60, "navajowhite3" },
-  [145] = { 0,      0,      68, "grey69" },
-  [146] = { 240,    33,     76, "lightsteelblue3" },
-  [147] = { 240,    100,    84, "lightsteelblue" },
-  [148] = { 1,      100,    42, "yellow3" },
-  [149] = { 80,     60,     60, "darkolivegreen3" },
-  [150] = { 90,     50,     68, "darkseagreen3" },
-  [151] = { 120,    33,     76, "darkseagreen2" },
-  [152] = { 180,    33,     76, "lightcyan3" },
-  [153] = { 210,    100,    84, "lightskyblue1" },
-  [154] = { 8,      100,    50, "greenyellow" },
-  [155] = { 90,     100,    68, "darkolivegreen2" },
-  [156] = { 100,    100,    76, "palegreen1" },
-  [157] = { 120,    100,    84, "darkseagreen2" },
-  [158] = { 150,    100,    84, "darkseagreen1" },
-  [159] = { 180,    100,    84, "paleturquoise1" },
-  [160] = { 0,      100,    42, "red3" },
-  [161] = { 33,     100,    42, "deeppink3" },
-  [162] = { 22,     100,    42, "deeppink3" },
-  [163] = { 11,     100,    42, "magenta3" },
-  [164] = { 300,    100,    42, "magenta3" },
-  [165] = { 90,     100,    50, "magenta2" },
-  [166] = { 6,      100,    42, "darkorange3" },
-  [167] = { 0,      60,     60, "indianred" },
-  [168] = { 340,    60,     60, "hotpink3" },
-  [169] = { 320,    60,     60, "hotpink2" },
-  [170] = { 300,    60,     60, "orchid" },
-  [171] = { 285,    100,    68, "mediumorchid1" },
-  [172] = { 7,      100,    42, "orange3" },
-  [173] = { 20,     60,     60, "lightsalmon3" },
-  [174] = { 0,      50,     68, "lightpink3" },
-  [175] = { 330,    50,     68, "pink3" },
-  [176] = { 300,    50,     68, "plum3" },
-  [177] = { 280,    100,    76, "violet" },
-  [178] = { 8,      100,    42, "gold3" },
-  [179] = { 40,     60,     60, "lightgoldenrod3" },
-  [180] = { 30,     50,     68, "tan" },
-  [181] = { 0,      33,     76, "mistyrose3" },
-  [182] = { 300,    33,     76, "thistle3" },
-  [183] = { 270,    100,    84, "plum2" },
-  [184] = { 60,     100,    42, "yellow3" },
-  [185] = { 60,     60,     60, "khaki3" },
-  [186] = { 60,     50,     68, "lightgoldenrod2" },
-  [187] = { 60,     33,     76, "lightyellow3" },
-  [188] = { 0,      0,      84, "grey84" },
-  [189] = { 240,    100,    92, "lightsteelblue1" },
-  [190] = { 9,      100,    50, "yellow2" },
-  [191] = { 75,     100,    68, "darkolivegreen1" },
-  [192] = { 80,     100,    76, "darkolivegreen1" },
-  [193] = { 90,     100,    84, "darkseagreen1" },
-  [194] = { 120,    100,    92, "honeydew2" },
-  [195] = { 180,    100,    92, "lightcyan1" },
-  [196] = { 0,      100,    50, "red1" },
-  [197] = { 37,     100,    50, "deeppink2" },
-  [198] = { 28,     100,    50, "deeppink1" },
-  [199] = { 18,     100,    50, "deeppink1" },
-  [200] = { 9,     100,    50, "magenta2" },
-  [201] = { 300,    100,    50, "magenta1" },
-  [202] = { 2,      100,    50, "orangered1" },
-  [203] = { 0,      100,    68, "indianred1" },
-  [204] = { 345,    100,    68, "indianred1" },
-  [205] = { 330,    100,    68, "hotpink" },
-  [206] = { 315,    100,    68, "hotpink" },
-  [207] = { 300,    100,    68, "mediumorchid1" },
-  [208] = { 1,      100,    50, "darkorange" },
-  [209] = { 15,     100,    68, "salmon1" },
-  [210] = { 0,      100,    76, "lightcoral" },
-  [211] = { 340,    100,    76, "palevioletred1" },
-  [212] = { 320,    100,    76, "orchid2" },
-  [213] = { 300,    100,    76, "orchid1" },
-  [214] = { 1,      100,    50, "orange1" },
-  [215] = { 30,     100,    68, "sandybrown" },
-  [216] = { 20,     100,    76, "lightsalmon1" },
-  [217] = { 0,      100,    84, "lightpink1" },
-  [218] = { 330,    100,    84, "pink1" },
-  [219] = { 300,    100,    84, "plum1" },
-  [220] = { 0,      100,    50, "gold1" },
-  [221] = { 45,     100,    68, "lightgoldenrod2" },
-  [222] = { 40,     100,    76, "lightgoldenrod2" },
-  [223] = { 30,     100,    84, "navajowhite1" },
-  [224] = { 0,      100,    92, "mistyrose1" },
-  [225] = { 300,    100,    92, "thistle1" },
-  [226] = { 60,     100,    50, "yellow1" },
-  [227] = { 60,     100,    68, "lightgoldenrod1" },
-  [228] = { 60,     100,    76, "khaki1" },
-  [229] = { 60,     100,    84, "wheat1" },
-  [230] = { 60,     100,    92, "cornsilk1" },
-  [231] = { 0,      0,      100, "grey100" },
-  [232] = { 0,      0,      3,  "grey3" },
-  [233] = { 0,      0,      7,  "grey7" },
-  [234] = { 0,      0,      10, "grey11" },
-  [235] = { 0,      0,      14, "grey15" },
-  [236] = { 0,      0,      18, "grey19" },
-  [237] = { 0,      0,      22, "grey23" },
-  [238] = { 0,      0,      26, "grey27" },
-  [239] = { 0,      0,      30, "grey30" },
-  [240] = { 0,      0,      34, "grey35" },
-  [241] = { 0,      0,      37, "grey39" },
-  [242] = { 0,      0,      40, "grey42" },
-  [243] = { 0,      0,      46, "grey46" },
-  [244] = { 0,      0,      50, "grey50" },
-  [245] = { 0,      0,      54, "grey54" },
-  [246] = { 0,      0,      58, "grey58" },
-  [247] = { 0,      0,      61, "grey62" },
-  [248] = { 0,      0,      65, "grey66" },
-  [249] = { 0,      0,      69, "grey70" },
-  [250] = { 0,      0,      73, "grey74" },
-  [251] = { 0,      0,      77, "grey78" },
-  [252] = { 0,      0,      81, "grey82" },
-  [253] = { 0,      0,      85, "grey85" },
-  [254] = { 0,      0,      89, "grey89" },
-  [255] = { 0,      0,      93, "grey93" },
+    [0] = { 0, 0, 0, "black" },
+    [1] = { 0, 100, 25, "red" },
+    [2] = { 120, 100, 25, "green" },
+    [3] = { 60, 100, 25, "yellow" },
+    [4] = { 240, 100, 25, "blue" },
+    [5] = { 300, 100, 25, "magenta" },
+    [6] = { 180, 100, 25, "cyan" },
+    [7] = { 0, 0, 75, "white" },
+    [8] = { 0, 0, 50, "lightblack" },
+    [9] = { 0, 100, 50, "lightred" },
+    [10] = { 120, 100, 50, "lightgreen" },
+    [11] = { 60, 100, 50, "lightyellow" },
+    [12] = { 240, 100, 50, "lightblue" },
+    [13] = { 300, 100, 50, "lightmagenta" },
+    [14] = { 180, 100, 50, "lightcyan" },
+    [15] = { 0, 0, 100, "lightwhite" },
+    [16] = { 0, 0, 0, "grey0" },
+    [17] = { 240, 100, 18, "navyblue" },
+    [18] = { 240, 100, 26, "darkblue" },
+    [19] = { 240, 100, 34, "blue3" },
+    [20] = { 240, 100, 42, "blue3" },
+    [21] = { 240, 100, 50, "blue1" },
+    [22] = { 120, 100, 18, "darkgreen" },
+    [23] = { 180, 100, 18, "deepskyblue4" },
+    [24] = { 97, 100, 26, "deepskyblue4" },
+    [25] = { 7, 100, 34, "deepskyblue4" },
+    [26] = { 13, 100, 42, "dodgerblue3" },
+    [27] = { 17, 100, 50, "dodgerblue2" },
+    [28] = { 120, 100, 26, "green4" },
+    [29] = { 62, 100, 26, "springgreen4" },
+    [30] = { 180, 100, 26, "turquoise4" },
+    [31] = { 93, 100, 34, "deepskyblue3" },
+    [32] = { 2, 100, 42, "deepskyblue3" },
+    [33] = { 8, 100, 50, "dodgerblue1" },
+    [34] = { 120, 100, 34, "green3" },
+    [35] = { 52, 100, 34, "springgreen3" },
+    [36] = { 66, 100, 34, "darkcyan" },
+    [37] = { 180, 100, 34, "lightseagreen" },
+    [38] = { 91, 100, 42, "deepskyblue2" },
+    [39] = { 98, 100, 50, "deepskyblue1" },
+    [40] = { 120, 100, 42, "green3" },
+    [41] = { 46, 100, 42, "springgreen3" },
+    [42] = { 57, 100, 42, "springgreen2" },
+    [43] = { 68, 100, 42, "cyan3" },
+    [44] = { 180, 100, 42, "darkturquoise" },
+    [45] = { 89, 100, 50, "turquoise2" },
+    [46] = { 120, 100, 50, "green1" },
+    [47] = { 42, 100, 50, "springgreen2" },
+    [48] = { 51, 100, 50, "springgreen1" },
+    [49] = { 61, 100, 50, "mediumspringgreen" },
+    [50] = { 70, 100, 50, "cyan2" },
+    [51] = { 180, 100, 50, "cyan1" },
+    [52] = { 0, 100, 18, "darkred" },
+    [53] = { 300, 100, 18, "deeppink4" },
+    [54] = { 82, 100, 26, "purple4" },
+    [55] = { 72, 100, 34, "purple4" },
+    [56] = { 66, 100, 42, "purple3" },
+    [57] = { 62, 100, 50, "blueviolet" },
+    [58] = { 60, 100, 18, "orange4" },
+    [59] = { 0, 0, 37, "grey37" },
+    [60] = { 240, 17, 45, "mediumpurple4" },
+    [61] = { 240, 33, 52, "slateblue3" },
+    [62] = { 240, 60, 60, "slateblue3" },
+    [63] = { 240, 100, 68, "royalblue1" },
+    [64] = { 7, 100, 26, "chartreuse4" },
+    [65] = { 120, 17, 45, "darkseagreen4" },
+    [66] = { 180, 17, 45, "paleturquoise4" },
+    [67] = { 210, 33, 52, "steelblue" },
+    [68] = { 220, 60, 60, "steelblue3" },
+    [69] = { 225, 100, 68, "cornflowerblue" },
+    [70] = { 7, 100, 34, "chartreuse3" },
+    [71] = { 120, 33, 52, "darkseagreen4" },
+    [72] = { 150, 33, 52, "cadetblue" },
+    [73] = { 180, 33, 52, "cadetblue" },
+    [74] = { 200, 60, 60, "skyblue3" },
+    [75] = { 210, 100, 68, "steelblue1" },
+    [76] = { 3, 100, 42, "chartreuse3" },
+    [77] = { 120, 60, 60, "palegreen3" },
+    [78] = { 140, 60, 60, "seagreen3" },
+    [79] = { 160, 60, 60, "aquamarine3" },
+    [80] = { 180, 60, 60, "mediumturquoise" },
+    [81] = { 195, 100, 68, "steelblue1" },
+    [82] = { 7, 100, 50, "chartreuse2" },
+    [83] = { 120, 100, 68, "seagreen2" },
+    [84] = { 135, 100, 68, "seagreen1" },
+    [85] = { 150, 100, 68, "seagreen1" },
+    [86] = { 165, 100, 68, "aquamarine1" },
+    [87] = { 180, 100, 68, "darkslategray2" },
+    [88] = { 0, 100, 26, "darkred" },
+    [89] = { 17, 100, 26, "deeppink4" },
+    [90] = { 300, 100, 26, "darkmagenta" },
+    [91] = { 86, 100, 34, "darkmagenta" },
+    [92] = { 77, 100, 42, "darkviolet" },
+    [93] = { 71, 100, 50, "purple" },
+    [94] = { 2, 100, 26, "orange4" },
+    [95] = { 0, 17, 45, "lightpink4" },
+    [96] = { 300, 17, 45, "plum4" },
+    [97] = { 270, 33, 52, "mediumpurple3" },
+    [98] = { 260, 60, 60, "mediumpurple3" },
+    [99] = { 255, 100, 68, "slateblue1" },
+    [100] = { 60, 100, 26, "yellow4" },
+    [101] = { 60, 17, 45, "wheat4" },
+    [102] = { 0, 0, 52, "grey53" },
+    [103] = { 240, 20, 60, "lightslategrey" },
+    [104] = { 240, 50, 68, "mediumpurple" },
+    [105] = { 240, 100, 76, "lightslateblue" },
+    [106] = { 3, 100, 34, "yellow4" },
+    [107] = { 90, 33, 52, "darkolivegreen3" },
+    [108] = { 120, 20, 60, "darkseagreen" },
+    [109] = { 180, 20, 60, "lightskyblue3" },
+    [110] = { 210, 50, 68, "lightskyblue3" },
+    [111] = { 220, 100, 76, "skyblue2" },
+    [112] = { 2, 100, 42, "chartreuse2" },
+    [113] = { 100, 60, 60, "darkolivegreen3" },
+    [114] = { 120, 50, 68, "palegreen3" },
+    [115] = { 150, 50, 68, "darkseagreen3" },
+    [116] = { 180, 50, 68, "darkslategray3" },
+    [117] = { 200, 100, 76, "skyblue1" },
+    [118] = { 8, 100, 50, "chartreuse1" },
+    [119] = { 105, 100, 68, "lightgreen" },
+    [120] = { 120, 100, 76, "lightgreen" },
+    [121] = { 140, 100, 76, "palegreen1" },
+    [122] = { 160, 100, 76, "aquamarine1" },
+    [123] = { 180, 100, 76, "darkslategray1" },
+    [124] = { 0, 100, 34, "red3" },
+    [125] = { 27, 100, 34, "deeppink4" },
+    [126] = { 13, 100, 34, "mediumvioletred" },
+    [127] = { 300, 100, 34, "magenta3" },
+    [128] = { 88, 100, 42, "darkviolet" },
+    [129] = { 81, 100, 50, "purple" },
+    [130] = { 2, 100, 34, "darkorange3" },
+    [131] = { 0, 33, 52, "indianred" },
+    [132] = { 330, 33, 52, "hotpink3" },
+    [133] = { 300, 33, 52, "mediumorchid3" },
+    [134] = { 280, 60, 60, "mediumorchid" },
+    [135] = { 270, 100, 68, "mediumpurple2" },
+    [136] = { 6, 100, 34, "darkgoldenrod" },
+    [137] = { 30, 33, 52, "lightsalmon3" },
+    [138] = { 0, 20, 60, "rosybrown" },
+    [139] = { 300, 20, 60, "grey63" },
+    [140] = { 270, 50, 68, "mediumpurple2" },
+    [141] = { 260, 100, 76, "mediumpurple1" },
+    [142] = { 60, 100, 34, "gold3" },
+    [143] = { 60, 33, 52, "darkkhaki" },
+    [144] = { 60, 20, 60, "navajowhite3" },
+    [145] = { 0, 0, 68, "grey69" },
+    [146] = { 240, 33, 76, "lightsteelblue3" },
+    [147] = { 240, 100, 84, "lightsteelblue" },
+    [148] = { 1, 100, 42, "yellow3" },
+    [149] = { 80, 60, 60, "darkolivegreen3" },
+    [150] = { 90, 50, 68, "darkseagreen3" },
+    [151] = { 120, 33, 76, "darkseagreen2" },
+    [152] = { 180, 33, 76, "lightcyan3" },
+    [153] = { 210, 100, 84, "lightskyblue1" },
+    [154] = { 8, 100, 50, "greenyellow" },
+    [155] = { 90, 100, 68, "darkolivegreen2" },
+    [156] = { 100, 100, 76, "palegreen1" },
+    [157] = { 120, 100, 84, "darkseagreen2" },
+    [158] = { 150, 100, 84, "darkseagreen1" },
+    [159] = { 180, 100, 84, "paleturquoise1" },
+    [160] = { 0, 100, 42, "red3" },
+    [161] = { 33, 100, 42, "deeppink3" },
+    [162] = { 22, 100, 42, "deeppink3" },
+    [163] = { 11, 100, 42, "magenta3" },
+    [164] = { 300, 100, 42, "magenta3" },
+    [165] = { 90, 100, 50, "magenta2" },
+    [166] = { 6, 100, 42, "darkorange3" },
+    [167] = { 0, 60, 60, "indianred" },
+    [168] = { 340, 60, 60, "hotpink3" },
+    [169] = { 320, 60, 60, "hotpink2" },
+    [170] = { 300, 60, 60, "orchid" },
+    [171] = { 285, 100, 68, "mediumorchid1" },
+    [172] = { 7, 100, 42, "orange3" },
+    [173] = { 20, 60, 60, "lightsalmon3" },
+    [174] = { 0, 50, 68, "lightpink3" },
+    [175] = { 330, 50, 68, "pink3" },
+    [176] = { 300, 50, 68, "plum3" },
+    [177] = { 280, 100, 76, "violet" },
+    [178] = { 8, 100, 42, "gold3" },
+    [179] = { 40, 60, 60, "lightgoldenrod3" },
+    [180] = { 30, 50, 68, "tan" },
+    [181] = { 0, 33, 76, "mistyrose3" },
+    [182] = { 300, 33, 76, "thistle3" },
+    [183] = { 270, 100, 84, "plum2" },
+    [184] = { 60, 100, 42, "yellow3" },
+    [185] = { 60, 60, 60, "khaki3" },
+    [186] = { 60, 50, 68, "lightgoldenrod2" },
+    [187] = { 60, 33, 76, "lightyellow3" },
+    [188] = { 0, 0, 84, "grey84" },
+    [189] = { 240, 100, 92, "lightsteelblue1" },
+    [190] = { 9, 100, 50, "yellow2" },
+    [191] = { 75, 100, 68, "darkolivegreen1" },
+    [192] = { 80, 100, 76, "darkolivegreen1" },
+    [193] = { 90, 100, 84, "darkseagreen1" },
+    [194] = { 120, 100, 92, "honeydew2" },
+    [195] = { 180, 100, 92, "lightcyan1" },
+    [196] = { 0, 100, 50, "red1" },
+    [197] = { 37, 100, 50, "deeppink2" },
+    [198] = { 28, 100, 50, "deeppink1" },
+    [199] = { 18, 100, 50, "deeppink1" },
+    [200] = { 9, 100, 50, "magenta2" },
+    [201] = { 300, 100, 50, "magenta1" },
+    [202] = { 2, 100, 50, "orangered1" },
+    [203] = { 0, 100, 68, "indianred1" },
+    [204] = { 345, 100, 68, "indianred1" },
+    [205] = { 330, 100, 68, "hotpink" },
+    [206] = { 315, 100, 68, "hotpink" },
+    [207] = { 300, 100, 68, "mediumorchid1" },
+    [208] = { 1, 100, 50, "darkorange" },
+    [209] = { 15, 100, 68, "salmon1" },
+    [210] = { 0, 100, 76, "lightcoral" },
+    [211] = { 340, 100, 76, "palevioletred1" },
+    [212] = { 320, 100, 76, "orchid2" },
+    [213] = { 300, 100, 76, "orchid1" },
+    [214] = { 1, 100, 50, "orange1" },
+    [215] = { 30, 100, 68, "sandybrown" },
+    [216] = { 20, 100, 76, "lightsalmon1" },
+    [217] = { 0, 100, 84, "lightpink1" },
+    [218] = { 330, 100, 84, "pink1" },
+    [219] = { 300, 100, 84, "plum1" },
+    [220] = { 0, 100, 50, "gold1" },
+    [221] = { 45, 100, 68, "lightgoldenrod2" },
+    [222] = { 40, 100, 76, "lightgoldenrod2" },
+    [223] = { 30, 100, 84, "navajowhite1" },
+    [224] = { 0, 100, 92, "mistyrose1" },
+    [225] = { 300, 100, 92, "thistle1" },
+    [226] = { 60, 100, 50, "yellow1" },
+    [227] = { 60, 100, 68, "lightgoldenrod1" },
+    [228] = { 60, 100, 76, "khaki1" },
+    [229] = { 60, 100, 84, "wheat1" },
+    [230] = { 60, 100, 92, "cornsilk1" },
+    [231] = { 0, 0, 100, "grey100" },
+    [232] = { 0, 0, 3, "grey3" },
+    [233] = { 0, 0, 7, "grey7" },
+    [234] = { 0, 0, 10, "grey11" },
+    [235] = { 0, 0, 14, "grey15" },
+    [236] = { 0, 0, 18, "grey19" },
+    [237] = { 0, 0, 22, "grey23" },
+    [238] = { 0, 0, 26, "grey27" },
+    [239] = { 0, 0, 30, "grey30" },
+    [240] = { 0, 0, 34, "grey35" },
+    [241] = { 0, 0, 37, "grey39" },
+    [242] = { 0, 0, 40, "grey42" },
+    [243] = { 0, 0, 46, "grey46" },
+    [244] = { 0, 0, 50, "grey50" },
+    [245] = { 0, 0, 54, "grey54" },
+    [246] = { 0, 0, 58, "grey58" },
+    [247] = { 0, 0, 61, "grey62" },
+    [248] = { 0, 0, 65, "grey66" },
+    [249] = { 0, 0, 69, "grey70" },
+    [250] = { 0, 0, 73, "grey74" },
+    [251] = { 0, 0, 77, "grey78" },
+    [252] = { 0, 0, 81, "grey82" },
+    [253] = { 0, 0, 85, "grey85" },
+    [254] = { 0, 0, 89, "grey89" },
+    [255] = { 0, 0, 93, "grey93" },
 };
 
 /* -1 is valid curses color */
 #define COL_ERR -2
 
-static inline int color_distance(const struct color_def *a, const struct color_def *b)
+static inline int
+color_distance(const struct color_def* a, const struct color_def* b)
 {
-    int h = MIN((a->h - b->h)%360, (b->h - a->h)%360);
+    int h = MIN((a->h - b->h) % 360, (b->h - a->h) % 360);
     int s = (int)a->s - b->s;
     int l = (int)a->l - b->l;
-    return h*h + s*s + l*l;
+    return h * h + s * s + l * l;
 }
 
-static int find_closest_col(int h, int s, int l)
+static int
+find_closest_col(int h, int s, int l)
 {
     int i;
-    struct color_def a = {h, s, l};
+    struct color_def a = { h, s, l };
     int min = 0;
     int dmin = color_distance(&a, &color_names[0]);
 
@@ -352,10 +356,11 @@ static int find_closest_col(int h, int s, int l)
     return min;
 }
 
-static int find_col(const char *col_name, int n)
+static int
+find_col(const char* col_name, int n)
 {
     int i;
-    char name[32] = {0};
+    char name[32] = { 0 };
 
     /*
      * make a null terminated version of col_name. we don't want to
@@ -366,7 +371,7 @@ static int find_col(const char *col_name, int n)
     if (n >= sizeof(name)) {
         /* truncate */
         log_error("Color: <%s,%d> bigger than %zu", col_name, n, sizeof(name));
-        n = sizeof(name)-1;
+        n = sizeof(name) - 1;
     }
     memcpy(name, col_name, n);
 
@@ -383,10 +388,11 @@ static int find_col(const char *col_name, int n)
     return COL_ERR;
 }
 
-static int color_hash(const char *str, color_profile profile)
+static int
+color_hash(const char* str, color_profile profile)
 {
-    GChecksum *cs = NULL;
-    guint8 buf[256] = {0};
+    GChecksum* cs = NULL;
+    guint8 buf[256] = { 0 };
     gsize len = 256;
     int rc = -1; /* default ncurse color */
 
@@ -403,27 +409,27 @@ static int color_hash(const char *str, color_profile profile)
 
     double h = ((buf[1] << 8) | buf[0]) / 65536. * 360.;
 
-    switch(profile)
-    {
-        case COLOR_PROFILE_REDGREEN_BLINDNESS:
-            // red/green blindness correction
-            h = fmod(fmod(h + 90., 180) - 90., 360.);
-            break;
-        case COLOR_PROFILE_BLUE_BLINDNESS:
-            // blue blindness correction
-            h = fmod(h, 180.);
-        default:
-            break;
+    switch (profile) {
+    case COLOR_PROFILE_REDGREEN_BLINDNESS:
+        // red/green blindness correction
+        h = fmod(fmod(h + 90., 180) - 90., 360.);
+        break;
+    case COLOR_PROFILE_BLUE_BLINDNESS:
+        // blue blindness correction
+        h = fmod(h, 180.);
+    default:
+        break;
     }
 
     rc = find_closest_col((int)h, 100, 50);
 
-  out:
+out:
     g_checksum_free(cs);
     return rc;
 }
 
-void color_pair_cache_reset(void)
+void
+color_pair_cache_reset(void)
 {
     if (cache.pairs) {
         free(cache.pairs);
@@ -440,7 +446,7 @@ void color_pair_cache_reset(void)
     if (cache.capacity < 0)
         cache.capacity = 8;
 
-    cache.pairs = g_malloc0(sizeof(*cache.pairs)*cache.capacity);
+    cache.pairs = g_malloc0(sizeof(*cache.pairs) * cache.capacity);
     if (cache.pairs) {
         /* default_default */
         cache.pairs[0].fg = -1;
@@ -451,7 +457,8 @@ void color_pair_cache_reset(void)
     }
 }
 
-static int _color_pair_cache_get(int fg, int bg)
+static int
+_color_pair_cache_get(int fg, int bg)
 {
     int i;
 
@@ -497,12 +504,13 @@ static int _color_pair_cache_get(int fg, int bg)
  * hash a string into a color that will be used as fg
  * check for 'bkgnd' in theme file or use default color as bg
  */
-int color_pair_cache_hash_str(const char *str, color_profile profile)
+int
+color_pair_cache_hash_str(const char* str, color_profile profile)
 {
     int fg = color_hash(str, profile);
     int bg = -1;
 
-    char *bkgnd = theme_get_bkgnd();
+    char* bkgnd = theme_get_bkgnd();
     if (bkgnd) {
         bg = find_col(bkgnd, strlen(bkgnd));
         free(bkgnd);
@@ -517,9 +525,10 @@ int color_pair_cache_hash_str(const char *str, color_profile profile)
  * if the pair doesn't exist it will allocate it in curses with init_pair
  * if the pair exists it returns its id
  */
-int color_pair_cache_get(const char *pair_name)
+int
+color_pair_cache_get(const char* pair_name)
 {
-    const char *sep;
+    const char* sep;
     int fg, bg;
 
     sep = strchr(pair_name, '_');
@@ -529,7 +538,7 @@ int color_pair_cache_get(const char *pair_name)
     }
 
     fg = find_col(pair_name, sep - pair_name);
-    bg = find_col(sep+1, strlen(sep));
+    bg = find_col(sep + 1, strlen(sep));
     if (fg == COL_ERR || bg == COL_ERR) {
         log_error("Color: bad color name %s", pair_name);
         return -1;
diff --git a/src/config/color.h b/src/config/color.h
index 304e862e..fe0c6e63 100644
--- a/src/config/color.h
+++ b/src/config/color.h
@@ -47,16 +47,18 @@ typedef enum {
     COLOR_PROFILE_BLUE_BLINDNESS,
 } color_profile;
 
-struct color_def {
-    uint16_t h; uint8_t s, l;
-    const char *name;
+struct color_def
+{
+    uint16_t h;
+    uint8_t s, l;
+    const char* name;
 };
 extern const struct color_def color_names[];
 
 /* hash string to color pair */
-int color_pair_cache_hash_str(const char *str, color_profile profile);
+int color_pair_cache_hash_str(const char* str, color_profile profile);
 /* parse fg_bg string to color pair */
-int color_pair_cache_get(const char *pair_name);
+int color_pair_cache_get(const char* pair_name);
 /* clear cache */
 void color_pair_cache_reset(void);
 
diff --git a/src/config/conflists.c b/src/config/conflists.c
index d0985669..944ada62 100644
--- a/src/config/conflists.c
+++ b/src/config/conflists.c
@@ -37,11 +37,11 @@
 #include <glib.h>
 
 gboolean
-conf_string_list_add(GKeyFile *keyfile, const char *const group, const char *const key, const char *const item)
+conf_string_list_add(GKeyFile* keyfile, const char* const group, const char* const key, const char* const item)
 {
     gsize length;
-    gchar **list = g_key_file_get_string_list(keyfile, group, key, &length, NULL);
-    GList *glist = NULL;
+    gchar** list = g_key_file_get_string_list(keyfile, group, key, &length, NULL);
+    GList* glist = NULL;
 
     // list found
     if (list) {
@@ -61,8 +61,8 @@ conf_string_list_add(GKeyFile *keyfile, const char *const group, const char *con
         glist = g_list_append(glist, strdup(item));
 
         // create the new list entry
-        const gchar* new_list[g_list_length(glist)+1];
-        GList *curr = glist;
+        const gchar* new_list[g_list_length(glist) + 1];
+        GList* curr = glist;
         i = 0;
         while (curr) {
             new_list[i++] = curr->data;
@@ -71,7 +71,7 @@ conf_string_list_add(GKeyFile *keyfile, const char *const group, const char *con
         new_list[i] = NULL;
         g_key_file_set_string_list(keyfile, group, key, new_list, g_list_length(glist));
 
-    // list not found
+        // list not found
     } else {
         const gchar* new_list[2];
         new_list[0] = item;
@@ -86,15 +86,15 @@ conf_string_list_add(GKeyFile *keyfile, const char *const group, const char *con
 }
 
 gboolean
-conf_string_list_remove(GKeyFile *keyfile, const char *const group, const char *const key, const char *const item)
+conf_string_list_remove(GKeyFile* keyfile, const char* const group, const char* const key, const char* const item)
 {
     gsize length;
-    gchar **list = g_key_file_get_string_list(keyfile, group, key, &length, NULL);
+    gchar** list = g_key_file_get_string_list(keyfile, group, key, &length, NULL);
 
     gboolean deleted = FALSE;
     if (list) {
         int i = 0;
-        GList *glist = NULL;
+        GList* glist = NULL;
 
         for (i = 0; i < length; i++) {
             // item found, mark as deleted
@@ -111,8 +111,8 @@ conf_string_list_remove(GKeyFile *keyfile, const char *const group, const char *
                 g_key_file_remove_key(keyfile, group, key, NULL);
             } else {
                 // create the new list entry
-                const gchar* new_list[g_list_length(glist)+1];
-                GList *curr = glist;
+                const gchar* new_list[g_list_length(glist) + 1];
+                GList* curr = glist;
                 i = 0;
                 while (curr) {
                     new_list[i++] = curr->data;
diff --git a/src/config/conflists.h b/src/config/conflists.h
index a939b406..92771875 100644
--- a/src/config/conflists.h
+++ b/src/config/conflists.h
@@ -38,9 +38,9 @@
 
 #include <glib.h>
 
-gboolean conf_string_list_add(GKeyFile *keyfile, const char *const group, const char *const key,
-    const char *const item);
-gboolean conf_string_list_remove(GKeyFile *keyfile, const char *const group, const char *const key,
-    const char *const item);
+gboolean conf_string_list_add(GKeyFile* keyfile, const char* const group, const char* const key,
+                              const char* const item);
+gboolean conf_string_list_remove(GKeyFile* keyfile, const char* const group, const char* const key,
+                                 const char* const item);
 
 #endif
diff --git a/src/config/files.c b/src/config/files.c
index 576303fb..72b192e4 100644
--- a/src/config/files.c
+++ b/src/config/files.c
@@ -51,18 +51,18 @@ static char* _files_get_xdg_data_home(void);
 void
 files_create_directories(void)
 {
-    gchar *xdg_config = _files_get_xdg_config_home();
-    gchar *xdg_data = _files_get_xdg_data_home();
+    gchar* xdg_config = _files_get_xdg_config_home();
+    gchar* xdg_data = _files_get_xdg_data_home();
 
-    GString *themes_dir = g_string_new(xdg_config);
+    GString* themes_dir = g_string_new(xdg_config);
     g_string_append(themes_dir, "/profanity/themes");
-    GString *icons_dir = g_string_new(xdg_config);
+    GString* icons_dir = g_string_new(xdg_config);
     g_string_append(icons_dir, "/profanity/icons");
-    GString *chatlogs_dir = g_string_new(xdg_data);
+    GString* chatlogs_dir = g_string_new(xdg_data);
     g_string_append(chatlogs_dir, "/profanity/chatlogs");
-    GString *logs_dir = g_string_new(xdg_data);
+    GString* logs_dir = g_string_new(xdg_data);
     g_string_append(logs_dir, "/profanity/logs");
-    GString *plugins_dir = g_string_new(xdg_data);
+    GString* plugins_dir = g_string_new(xdg_data);
     g_string_append(plugins_dir, "/profanity/plugins");
 
     if (!mkdir_recursive(themes_dir->str)) {
@@ -94,14 +94,14 @@ files_create_directories(void)
 gchar*
 files_get_inputrc_file(void)
 {
-    gchar *xdg_config = _files_get_xdg_config_home();
-    GString *inputrc_file = g_string_new(xdg_config);
+    gchar* xdg_config = _files_get_xdg_config_home();
+    GString* inputrc_file = g_string_new(xdg_config);
     g_free(xdg_config);
 
     g_string_append(inputrc_file, "/profanity/inputrc");
 
     if (g_file_test(inputrc_file->str, G_FILE_TEST_IS_REGULAR)) {
-        gchar *result = g_strdup(inputrc_file->str);
+        gchar* result = g_strdup(inputrc_file->str);
         g_string_free(inputrc_file, TRUE);
 
         return result;
@@ -113,10 +113,10 @@ files_get_inputrc_file(void)
 }
 
 char*
-files_get_log_file(const char *const log_file)
+files_get_log_file(const char* const log_file)
 {
-    gchar *xdg_data = _files_get_xdg_data_home();
-    GString *logfile = g_string_new(xdg_data);
+    gchar* xdg_data = _files_get_xdg_data_home();
+    GString* logfile = g_string_new(xdg_data);
 
     if (log_file) {
         g_string_append(logfile, "/profanity/logs/");
@@ -131,7 +131,7 @@ files_get_log_file(const char *const log_file)
 
     g_string_append(logfile, ".log");
 
-    char *result = g_strdup(logfile->str);
+    char* result = g_strdup(logfile->str);
 
     free(xdg_data);
     g_string_free(logfile, TRUE);
@@ -140,13 +140,13 @@ files_get_log_file(const char *const log_file)
 }
 
 gchar*
-files_get_config_path(const char *const config_base)
+files_get_config_path(const char* const config_base)
 {
-    gchar *xdg_config = _files_get_xdg_config_home();
-    GString *file_str = g_string_new(xdg_config);
+    gchar* xdg_config = _files_get_xdg_config_home();
+    GString* file_str = g_string_new(xdg_config);
     g_string_append(file_str, "/profanity/");
     g_string_append(file_str, config_base);
-    gchar *result = g_strdup(file_str->str);
+    gchar* result = g_strdup(file_str->str);
     g_free(xdg_config);
     g_string_free(file_str, TRUE);
 
@@ -154,13 +154,13 @@ files_get_config_path(const char *const config_base)
 }
 
 gchar*
-files_get_data_path(const char *const data_base)
+files_get_data_path(const char* const data_base)
 {
-    gchar *xdg_data = _files_get_xdg_data_home();
-    GString *file_str = g_string_new(xdg_data);
+    gchar* xdg_data = _files_get_xdg_data_home();
+    GString* file_str = g_string_new(xdg_data);
     g_string_append(file_str, "/profanity/");
     g_string_append(file_str, data_base);
-    gchar *result = g_strdup(file_str->str);
+    gchar* result = g_strdup(file_str->str);
     g_free(xdg_data);
     g_string_free(file_str, TRUE);
 
@@ -168,18 +168,18 @@ files_get_data_path(const char *const data_base)
 }
 
 gchar*
-files_get_account_data_path(const char *const specific_dir, const char *const jid)
+files_get_account_data_path(const char* const specific_dir, const char* const jid)
 {
-    gchar *data_dir = files_get_data_path(specific_dir);
-    GString *result_dir = g_string_new(data_dir);
+    gchar* data_dir = files_get_data_path(specific_dir);
+    GString* result_dir = g_string_new(data_dir);
     g_free(data_dir);
 
-    gchar *account_dir = str_replace(jid, "@", "_at_");
+    gchar* account_dir = str_replace(jid, "@", "_at_");
     g_string_append(result_dir, "/");
     g_string_append(result_dir, account_dir);
     g_free(account_dir);
 
-    gchar *result = g_strdup(result_dir->str);
+    gchar* result = g_strdup(result_dir->str);
     g_string_free(result_dir, TRUE);
 
     return result;
@@ -188,8 +188,8 @@ files_get_account_data_path(const char *const specific_dir, const char *const ji
 static char*
 _files_get_xdg_config_home(void)
 {
-    gchar *xdg_config_home_env = getenv("XDG_CONFIG_HOME");
-    gchar *xdg_config_home = NULL;
+    gchar* xdg_config_home_env = getenv("XDG_CONFIG_HOME");
+    gchar* xdg_config_home = NULL;
 
     if (xdg_config_home_env) {
         xdg_config_home = strdup(xdg_config_home_env);
@@ -199,9 +199,9 @@ _files_get_xdg_config_home(void)
     if (xdg_config_home && (strcmp(xdg_config_home, "") != 0)) {
         return xdg_config_home;
     } else {
-        GString *default_path = g_string_new(getenv("HOME"));
+        GString* default_path = g_string_new(getenv("HOME"));
         g_string_append(default_path, "/.config");
-        char *result = strdup(default_path->str);
+        char* result = strdup(default_path->str);
         g_string_free(default_path, TRUE);
 
         return result;
@@ -211,8 +211,8 @@ _files_get_xdg_config_home(void)
 static char*
 _files_get_xdg_data_home(void)
 {
-    gchar *xdg_data_home_env = getenv("XDG_DATA_HOME");
-    gchar *xdg_data_home = NULL;
+    gchar* xdg_data_home_env = getenv("XDG_DATA_HOME");
+    gchar* xdg_data_home = NULL;
 
     if (xdg_data_home_env) {
         xdg_data_home = strdup(xdg_data_home_env);
@@ -222,9 +222,9 @@ _files_get_xdg_data_home(void)
     if (xdg_data_home && (strcmp(xdg_data_home, "") != 0)) {
         return xdg_data_home;
     } else {
-        GString *default_path = g_string_new(getenv("HOME"));
+        GString* default_path = g_string_new(getenv("HOME"));
         g_string_append(default_path, "/.local/share");
-        gchar *result = strdup(default_path->str);
+        gchar* result = strdup(default_path->str);
         g_string_free(default_path, TRUE);
 
         return result;
diff --git a/src/config/files.h b/src/config/files.h
index 2a74793f..d5c96b0f 100644
--- a/src/config/files.h
+++ b/src/config/files.h
@@ -39,32 +39,32 @@
 
 #include <glib.h>
 
-#define FILE_PROFRC "profrc"
-#define FILE_ACCOUNTS "accounts"
-#define FILE_TLSCERTS "tlscerts"
-#define FILE_PLUGIN_SETTINGS "plugin_settings"
-#define FILE_PLUGIN_THEMES "plugin_themes"
-#define FILE_CAPSCACHE "capscache"
-#define FILE_PROFANITY_IDENTIFIER "profident"
+#define FILE_PROFRC                   "profrc"
+#define FILE_ACCOUNTS                 "accounts"
+#define FILE_TLSCERTS                 "tlscerts"
+#define FILE_PLUGIN_SETTINGS          "plugin_settings"
+#define FILE_PLUGIN_THEMES            "plugin_themes"
+#define FILE_CAPSCACHE                "capscache"
+#define FILE_PROFANITY_IDENTIFIER     "profident"
 #define FILE_BOOKMARK_AUTOJOIN_IGNORE "bookmark_ignore"
 
-#define DIR_THEMES "themes"
-#define DIR_ICONS "icons"
-#define DIR_SCRIPTS "scripts"
+#define DIR_THEMES   "themes"
+#define DIR_ICONS    "icons"
+#define DIR_SCRIPTS  "scripts"
 #define DIR_CHATLOGS "chatlogs"
-#define DIR_OTR "otr"
-#define DIR_PGP "pgp"
-#define DIR_OMEMO "omemo"
-#define DIR_PLUGINS "plugins"
+#define DIR_OTR      "otr"
+#define DIR_PGP      "pgp"
+#define DIR_OMEMO    "omemo"
+#define DIR_PLUGINS  "plugins"
 #define DIR_DATABASE "database"
 
 void files_create_directories(void);
 
-gchar* files_get_config_path(const char *const config_base);
-gchar* files_get_data_path(const char *const data_base);
-gchar* files_get_account_data_path(const char *const specific_dir, const char *const jid);
+gchar* files_get_config_path(const char* const config_base);
+gchar* files_get_data_path(const char* const data_base);
+gchar* files_get_account_data_path(const char* const specific_dir, const char* const jid);
 
-gchar* files_get_log_file(const char *const log_file);
+gchar* files_get_log_file(const char* const log_file);
 gchar* files_get_inputrc_file(void);
 
 #endif
diff --git a/src/config/preferences.c b/src/config/preferences.c
index a1b1dbb3..00a1e5ce 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -52,25 +52,25 @@
 
 // preference groups refer to the sections in .profrc or theme files
 // for example [ui] but not [colours] which is handled in theme.c
-#define PREF_GROUP_LOGGING "logging"
-#define PREF_GROUP_CHATSTATES "chatstates"
-#define PREF_GROUP_UI "ui"
+#define PREF_GROUP_LOGGING       "logging"
+#define PREF_GROUP_CHATSTATES    "chatstates"
+#define PREF_GROUP_UI            "ui"
 #define PREF_GROUP_NOTIFICATIONS "notifications"
-#define PREF_GROUP_PRESENCE "presence"
-#define PREF_GROUP_CONNECTION "connection"
-#define PREF_GROUP_ALIAS "alias"
-#define PREF_GROUP_OTR "otr"
-#define PREF_GROUP_PGP "pgp"
-#define PREF_GROUP_OMEMO "omemo"
-#define PREF_GROUP_OX "ox"
-#define PREF_GROUP_MUC "muc"
-#define PREF_GROUP_PLUGINS "plugins"
-#define PREF_GROUP_EXECUTABLES "executables"
+#define PREF_GROUP_PRESENCE      "presence"
+#define PREF_GROUP_CONNECTION    "connection"
+#define PREF_GROUP_ALIAS         "alias"
+#define PREF_GROUP_OTR           "otr"
+#define PREF_GROUP_PGP           "pgp"
+#define PREF_GROUP_OMEMO         "omemo"
+#define PREF_GROUP_OX            "ox"
+#define PREF_GROUP_MUC           "muc"
+#define PREF_GROUP_PLUGINS       "plugins"
+#define PREF_GROUP_EXECUTABLES   "executables"
 
 #define INPBLOCK_DEFAULT 1000
 
-static gchar *prefs_loc;
-static GKeyFile *prefs;
+static gchar* prefs_loc;
+static GKeyFile* prefs;
 gint log_maxsize = 0;
 
 static Autocomplete boolean_choice_ac;
@@ -83,9 +83,10 @@ static gboolean _get_default_boolean(preference_t pref);
 static char* _get_default_string(preference_t pref);
 static char** _get_default_string_list(preference_t pref);
 
-static void _prefs_load(void)
+static void
+_prefs_load(void)
 {
-    GError *err = NULL;
+    GError* err = NULL;
     log_maxsize = g_key_file_get_integer(prefs, PREF_GROUP_LOGGING, "maxsize", &err);
     if (err) {
         log_maxsize = 0;
@@ -101,7 +102,7 @@ static void _prefs_load(void)
 
     // move pre 0.5.0 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);
+        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);
         g_free(message);
@@ -109,8 +110,8 @@ static void _prefs_load(void)
 
     // migrate pre 0.5.0 time settings
     if (g_key_file_has_key(prefs, PREF_GROUP_UI, "time", NULL)) {
-        char *time = g_key_file_get_string(prefs, PREF_GROUP_UI, "time", NULL);
-        char *val = NULL;
+        char* time = g_key_file_get_string(prefs, PREF_GROUP_UI, "time", NULL);
+        char* val = NULL;
         if (time) {
             val = time;
         } else {
@@ -128,7 +129,7 @@ static void _prefs_load(void)
 
     // move pre 0.5.0 notify settings
     if (g_key_file_has_key(prefs, PREF_GROUP_NOTIFICATIONS, "room", NULL)) {
-        char *value = g_key_file_get_string(prefs, PREF_GROUP_NOTIFICATIONS, "room", NULL);
+        char* value = g_key_file_get_string(prefs, PREF_GROUP_NOTIFICATIONS, "room", NULL);
         if (g_strcmp0(value, "on") == 0) {
             g_key_file_set_boolean(prefs, PREF_GROUP_NOTIFICATIONS, "room", TRUE);
         } else if (g_strcmp0(value, "off") == 0) {
@@ -154,7 +155,7 @@ static void _prefs_load(void)
 
     // after 0.8.1: titlebar use jid|name -> titlebar show|hide jid|name
     if (g_key_file_has_key(prefs, PREF_GROUP_UI, "titlebar.muc.title", NULL)) {
-        char *value = g_key_file_get_string(prefs, PREF_GROUP_UI, "titlebar.muc.title", NULL);
+        char* value = g_key_file_get_string(prefs, PREF_GROUP_UI, "titlebar.muc.title", NULL);
         if (g_strcmp0(value, "name") == 0) {
             g_key_file_set_boolean(prefs, PREF_GROUP_UI, "titlebar.muc.title.name", TRUE);
         } else if (g_strcmp0(value, "jid") == 0) {
@@ -164,9 +165,9 @@ static void _prefs_load(void)
 
     // 0.9.0 introduced /urlopen. It was saved under "logging" section. Now we have a new "executables" section.
     if (g_key_file_has_key(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL)) {
-        char *val = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL);
+        char* val = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL);
 
-        GString *value = g_string_new("false;");
+        GString* value = g_string_new("false;");
         value = g_string_append(value, val);
         value = g_string_append(value, " %u;");
 
@@ -178,7 +179,7 @@ static void _prefs_load(void)
 
     // 0.9.0 introduced configurable /avatar. It was saved under "logging" section. Now we have a new "executables" section.
     if (g_key_file_has_key(prefs, PREF_GROUP_LOGGING, "avatar.cmd", NULL)) {
-        char *value = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "avatar.cmd", NULL);
+        char* value = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "avatar.cmd", NULL);
         g_key_file_set_string(prefs, PREF_GROUP_EXECUTABLES, "avatar.cmd", value);
         g_key_file_remove_key(prefs, PREF_GROUP_LOGGING, "avatar.cmd", NULL);
     }
@@ -191,7 +192,7 @@ static void _prefs_load(void)
 
     room_trigger_ac = autocomplete_new();
     gsize len = 0;
-    gchar **triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL);
+    gchar** triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL);
 
     int i = 0;
     for (i = 0; i < len; i++) {
@@ -201,7 +202,8 @@ static void _prefs_load(void)
 }
 
 /* Clean up after _prefs_load() */
-static void _prefs_close(void)
+static void
+_prefs_close(void)
 {
     autocomplete_free(boolean_choice_ac);
     autocomplete_free(room_trigger_ac);
@@ -227,7 +229,7 @@ prefs_reload(void)
 }
 
 void
-prefs_load(char *config_file)
+prefs_load(char* config_file)
 {
 
     if (config_file == NULL) {
@@ -265,7 +267,7 @@ prefs_close(void)
 }
 
 char*
-prefs_autocomplete_boolean_choice(const char *const prefix, gboolean previous, void *context)
+prefs_autocomplete_boolean_choice(const char* const prefix, gboolean previous, void* context)
 {
     return autocomplete_complete(boolean_choice_ac, prefix, TRUE, previous);
 }
@@ -277,7 +279,7 @@ prefs_reset_boolean_choice(void)
 }
 
 char*
-prefs_autocomplete_room_trigger(const char *const prefix, gboolean previous, void *context)
+prefs_autocomplete_room_trigger(const char* const prefix, gboolean previous, void* context)
 {
     return autocomplete_complete(room_trigger_ac, prefix, TRUE, previous);
 }
@@ -303,16 +305,16 @@ prefs_do_chat_notify(gboolean current_win)
 }
 
 GList*
-prefs_message_get_triggers(const char *const message)
+prefs_message_get_triggers(const char* const message)
 {
-    GList *result = NULL;
+    GList* result = NULL;
 
-    char *message_lower = g_utf8_strdown(message, -1);
+    char* message_lower = g_utf8_strdown(message, -1);
     gsize len = 0;
-    gchar **triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL);
+    gchar** triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL);
     int i;
     for (i = 0; i < len; i++) {
-        char *trigger_lower = g_utf8_strdown(triggers[i], -1);
+        char* trigger_lower = g_utf8_strdown(triggers[i], -1);
         if (g_strrstr(message_lower, trigger_lower)) {
             result = g_list_append(result, strdup(triggers[i]));
         }
@@ -325,8 +327,8 @@ prefs_message_get_triggers(const char *const message)
 }
 
 gboolean
-prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char *const mynick,
-    const char *const theirnick, const char *const message, gboolean mention, gboolean trigger_found)
+prefs_do_room_notify(gboolean current_win, const char* const roomjid, const char* const mynick,
+                     const char* const theirnick, const char* const message, gboolean mention, gboolean trigger_found)
 {
     if (g_strcmp0(mynick, theirnick) == 0) {
         return FALSE;
@@ -334,7 +336,7 @@ prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char
 
     gboolean notify_current = prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT);
     gboolean notify_window = FALSE;
-    if (!current_win || (current_win && notify_current) ) {
+    if (!current_win || (current_win && notify_current)) {
         notify_window = TRUE;
     }
     if (!notify_window) {
@@ -375,7 +377,7 @@ prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char
 }
 
 gboolean
-prefs_do_room_notify_mention(const char *const roomjid, int unread, gboolean mention, gboolean trigger)
+prefs_do_room_notify_mention(const char* const roomjid, int unread, gboolean mention, gboolean trigger)
 {
     gboolean notify_room = FALSE;
     if (g_key_file_has_key(prefs, roomjid, "notify", NULL)) {
@@ -411,61 +413,61 @@ prefs_do_room_notify_mention(const char *const roomjid, int unread, gboolean men
 }
 
 void
-prefs_set_room_notify(const char *const roomjid, gboolean value)
+prefs_set_room_notify(const char* const roomjid, gboolean value)
 {
     g_key_file_set_boolean(prefs, roomjid, "notify", value);
 }
 
 void
-prefs_set_room_notify_mention(const char *const roomjid, gboolean value)
+prefs_set_room_notify_mention(const char* const roomjid, gboolean value)
 {
     g_key_file_set_boolean(prefs, roomjid, "notify.mention", value);
 }
 
 void
-prefs_set_room_notify_trigger(const char *const roomjid, gboolean value)
+prefs_set_room_notify_trigger(const char* const roomjid, gboolean value)
 {
     g_key_file_set_boolean(prefs, roomjid, "notify.trigger", value);
 }
 
 gboolean
-prefs_has_room_notify(const char *const roomjid)
+prefs_has_room_notify(const char* const roomjid)
 {
     return g_key_file_has_key(prefs, roomjid, "notify", NULL);
 }
 
 gboolean
-prefs_has_room_notify_mention(const char *const roomjid)
+prefs_has_room_notify_mention(const char* const roomjid)
 {
     return g_key_file_has_key(prefs, roomjid, "notify.mention", NULL);
 }
 
 gboolean
-prefs_has_room_notify_trigger(const char *const roomjid)
+prefs_has_room_notify_trigger(const char* const roomjid)
 {
     return g_key_file_has_key(prefs, roomjid, "notify.trigger", NULL);
 }
 
 gboolean
-prefs_get_room_notify(const char *const roomjid)
+prefs_get_room_notify(const char* const roomjid)
 {
     return g_key_file_get_boolean(prefs, roomjid, "notify", NULL);
 }
 
 gboolean
-prefs_get_room_notify_mention(const char *const roomjid)
+prefs_get_room_notify_mention(const char* const roomjid)
 {
     return g_key_file_get_boolean(prefs, roomjid, "notify.mention", NULL);
 }
 
 gboolean
-prefs_get_room_notify_trigger(const char *const roomjid)
+prefs_get_room_notify_trigger(const char* const roomjid)
 {
     return g_key_file_get_boolean(prefs, roomjid, "notify.trigger", NULL);
 }
 
 gboolean
-prefs_reset_room_notify(const char *const roomjid)
+prefs_reset_room_notify(const char* const roomjid)
 {
     if (g_key_file_has_group(prefs, roomjid)) {
         g_key_file_remove_group(prefs, roomjid, NULL);
@@ -478,8 +480,8 @@ prefs_reset_room_notify(const char *const roomjid)
 gboolean
 prefs_get_boolean(preference_t pref)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
     gboolean def = _get_default_boolean(pref);
 
     if (!g_key_file_has_key(prefs, group, key, NULL)) {
@@ -492,19 +494,19 @@ prefs_get_boolean(preference_t pref)
 void
 prefs_set_boolean(preference_t pref, gboolean value)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
     g_key_file_set_boolean(prefs, group, key, value);
 }
 
 char*
 prefs_get_string(preference_t pref)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
-    char *def = _get_default_string(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
+    char* def = _get_default_string(pref);
 
-    char *result = g_key_file_get_string(prefs, group, key, NULL);
+    char* result = g_key_file_get_string(prefs, group, key, NULL);
 
     if (result == NULL) {
         if (def) {
@@ -518,13 +520,13 @@ prefs_get_string(preference_t pref)
 }
 
 char*
-prefs_get_string_with_option(preference_t pref, gchar *option)
+prefs_get_string_with_option(preference_t pref, gchar* option)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
-    char *def = _get_default_string(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
+    char* def = _get_default_string(pref);
 
-    char *result = g_key_file_get_locale_string(prefs, group, key, option, NULL);
+    char* result = g_key_file_get_locale_string(prefs, group, key, option, NULL);
 
     if (result == NULL) {
         // check for user set default
@@ -543,13 +545,13 @@ prefs_get_string_with_option(preference_t pref, gchar *option)
 }
 
 gchar**
-prefs_get_string_list_with_option(preference_t pref, gchar *option)
+prefs_get_string_list_with_option(preference_t pref, gchar* option)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
-    char **def = _get_default_string_list(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
+    char** def = _get_default_string_list(pref);
 
-    gchar **result = g_key_file_get_locale_string_list(prefs, group, key, option, NULL, NULL);
+    gchar** result = g_key_file_get_locale_string_list(prefs, group, key, option, NULL, NULL);
     if (result) {
         g_strfreev(def);
         return result;
@@ -570,10 +572,10 @@ prefs_get_string_list_with_option(preference_t pref, gchar *option)
 }
 
 void
-prefs_set_string(preference_t pref, char *value)
+prefs_set_string(preference_t pref, char* value)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
     if (value == NULL) {
         g_key_file_remove_key(prefs, group, key, NULL);
     } else {
@@ -582,10 +584,10 @@ prefs_set_string(preference_t pref, char *value)
 }
 
 void
-prefs_set_string_with_option(preference_t pref, char *option, char *value)
+prefs_set_string_with_option(preference_t pref, char* option, char* value)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
     if (value == NULL) {
         g_key_file_remove_key(prefs, group, key, NULL);
     } else {
@@ -594,11 +596,11 @@ prefs_set_string_with_option(preference_t pref, char *option, char *value)
 }
 
 void
-prefs_set_string_list_with_option(preference_t pref, char *option, const gchar* const *values)
+prefs_set_string_list_with_option(preference_t pref, char* option, const gchar* const* values)
 {
-    const char *group = _get_group(pref);
-    const char *key = _get_key(pref);
-    if (values == NULL || *values == NULL){
+    const char* group = _get_group(pref);
+    const char* key = _get_key(pref);
+    if (values == NULL || *values == NULL) {
         if (g_strcmp0(option, "*") == 0) {
             g_key_file_set_string_list(prefs, group, key, NULL, 0);
         } else {
@@ -606,7 +608,7 @@ prefs_set_string_list_with_option(preference_t pref, char *option, const gchar*
         }
     } else {
         guint num_values = 0;
-        while(values[num_values]) {
+        while (values[num_values]) {
             num_values++;
         }
         if (g_strcmp0(option, "*") == 0) {
@@ -620,10 +622,10 @@ prefs_set_string_list_with_option(preference_t pref, char *option, const gchar*
 char*
 prefs_get_tls_certpath(void)
 {
-    const char *group = _get_group(PREF_TLS_CERTPATH);
-    const char *key = _get_key(PREF_TLS_CERTPATH);
+    const char* group = _get_group(PREF_TLS_CERTPATH);
+    const char* key = _get_key(PREF_TLS_CERTPATH);
 
-    char *setting = g_key_file_get_string(prefs, group, key, NULL);
+    char* setting = g_key_file_get_string(prefs, group, key, NULL);
 
     if (g_strcmp0(setting, "none") == 0) {
         g_free(setting);
@@ -631,26 +633,26 @@ prefs_get_tls_certpath(void)
     }
 
     if (setting == NULL) {
-        if (g_file_test("/etc/ssl/certs",  G_FILE_TEST_IS_DIR)) {
+        if (g_file_test("/etc/ssl/certs", G_FILE_TEST_IS_DIR)) {
             return strdup("/etc/ssl/certs");
         }
-        if (g_file_test("/etc/pki/tls/certs",  G_FILE_TEST_IS_DIR)) {
+        if (g_file_test("/etc/pki/tls/certs", G_FILE_TEST_IS_DIR)) {
             return strdup("/etc/pki/tls/certs");
         }
-        if (g_file_test("/etc/ssl",  G_FILE_TEST_IS_DIR)) {
+        if (g_file_test("/etc/ssl", G_FILE_TEST_IS_DIR)) {
             return strdup("/etc/ssl");
         }
-        if (g_file_test("/etc/pki/tls",  G_FILE_TEST_IS_DIR)) {
+        if (g_file_test("/etc/pki/tls", G_FILE_TEST_IS_DIR)) {
             return strdup("/etc/pki/tls");
         }
-        if (g_file_test("/system/etc/security/cacerts",  G_FILE_TEST_IS_DIR)) {
+        if (g_file_test("/system/etc/security/cacerts", G_FILE_TEST_IS_DIR)) {
             return strdup("/system/etc/security/cacerts");
         }
 
         return NULL;
     }
 
-    char *result = strdup(setting);
+    char* result = strdup(setting);
     g_free(setting);
 
     return result;
@@ -855,21 +857,21 @@ prefs_get_plugins(void)
 }
 
 void
-prefs_add_plugin(const char *const name)
+prefs_add_plugin(const char* const name)
 {
     conf_string_list_add(prefs, PREF_GROUP_PLUGINS, "load", name);
     _save_prefs();
 }
 
 void
-prefs_remove_plugin(const char *const name)
+prefs_remove_plugin(const char* const name)
 {
     conf_string_list_remove(prefs, PREF_GROUP_PLUGINS, "load", name);
     _save_prefs();
 }
 
 void
-prefs_free_plugins(gchar **plugins)
+prefs_free_plugins(gchar** plugins)
 {
     g_strfreev(plugins);
 }
@@ -897,9 +899,9 @@ prefs_get_occupants_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -950,9 +952,9 @@ prefs_get_occupants_header_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -996,11 +998,11 @@ prefs_get_roster_size(void)
 }
 
 static char*
-_prefs_get_encryption_char(const char *const ch, const char *const pref_group, const char *const key)
+_prefs_get_encryption_char(const char* const ch, const char* const pref_group, const char* const key)
 {
-    char *result = NULL;
+    char* result = NULL;
 
-    char *resultstr = g_key_file_get_string(prefs, pref_group, key, NULL);
+    char* resultstr = g_key_file_get_string(prefs, pref_group, key, NULL);
     if (!resultstr) {
         result = strdup(ch);
     } else {
@@ -1011,7 +1013,7 @@ _prefs_get_encryption_char(const char *const ch, const char *const pref_group, c
 }
 
 static gboolean
-_prefs_set_encryption_char(const char *const ch, const char *const pref_group, const char *const key)
+_prefs_set_encryption_char(const char* const ch, const char* const pref_group, const char* const key)
 {
     if (g_utf8_strlen(ch, 4) == 1) {
         g_key_file_set_string(prefs, pref_group, key, ch);
@@ -1029,7 +1031,7 @@ prefs_get_otr_char(void)
 }
 
 gboolean
-prefs_set_otr_char(char *ch)
+prefs_set_otr_char(char* ch)
 {
     return _prefs_set_encryption_char(ch, PREF_GROUP_OTR, "otr.char");
 }
@@ -1041,7 +1043,7 @@ prefs_get_pgp_char(void)
 }
 
 gboolean
-prefs_set_pgp_char(char *ch)
+prefs_set_pgp_char(char* ch)
 {
     return _prefs_set_encryption_char(ch, PREF_GROUP_PGP, "pgp.char");
 }
@@ -1053,7 +1055,7 @@ prefs_get_ox_char(void)
 }
 
 gboolean
-prefs_set_ox_char(char *ch)
+prefs_set_ox_char(char* ch)
 {
     return _prefs_set_encryption_char(ch, PREF_GROUP_OX, "ox.char");
 }
@@ -1065,7 +1067,7 @@ prefs_get_omemo_char(void)
 }
 
 gboolean
-prefs_set_omemo_char(char *ch)
+prefs_set_omemo_char(char* ch)
 {
     return _prefs_set_encryption_char(ch, PREF_GROUP_OMEMO, "omemo.char");
 }
@@ -1075,9 +1077,9 @@ prefs_get_roster_header_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.header.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.header.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -1107,9 +1109,9 @@ prefs_get_roster_contact_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.contact.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.contact.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -1139,9 +1141,9 @@ prefs_get_roster_resource_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.resource.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.resource.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -1171,9 +1173,9 @@ prefs_get_roster_private_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.private.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.private.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -1203,9 +1205,9 @@ prefs_get_roster_room_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -1235,9 +1237,9 @@ prefs_get_roster_room_private_char(void)
 {
     char result = 0;
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL);
     if (!resultstr) {
-        result =  0;
+        result = 0;
     } else {
         result = resultstr[0];
     }
@@ -1328,9 +1330,9 @@ prefs_set_roster_presence_indent(gint value)
 char*
 prefs_get_correction_char(void)
 {
-    char *result = "+";
+    char* result = "+";
 
-    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "correction.char", NULL);
+    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "correction.char", NULL);
     if (!resultstr) {
         result = strdup("+");
     } else {
@@ -1351,7 +1353,7 @@ prefs_set_correction_char(char ch)
 }
 
 gboolean
-prefs_add_room_notify_trigger(const char * const text)
+prefs_add_room_notify_trigger(const char* const text)
 {
     gboolean res = conf_string_list_add(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", text);
 
@@ -1363,7 +1365,7 @@ prefs_add_room_notify_trigger(const char * const text)
 }
 
 gboolean
-prefs_remove_room_notify_trigger(const char * const text)
+prefs_remove_room_notify_trigger(const char* const text)
 {
     gboolean res = conf_string_list_remove(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", text);
     _save_prefs();
@@ -1378,9 +1380,9 @@ prefs_remove_room_notify_trigger(const char * const text)
 GList*
 prefs_get_room_notify_triggers(void)
 {
-    GList *result = NULL;
+    GList* result = NULL;
     gsize len = 0;
-    gchar **triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL);
+    gchar** triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL);
 
     int i;
     for (i = 0; i < len; i++) {
@@ -1395,7 +1397,7 @@ prefs_get_room_notify_triggers(void)
 ProfWinPlacement*
 prefs_create_profwin_placement(int titlebar, int mainwin, int statusbar, int inputwin)
 {
-    ProfWinPlacement *placement = malloc(sizeof(ProfWinPlacement));
+    ProfWinPlacement* placement = malloc(sizeof(ProfWinPlacement));
     placement->titlebar_pos = titlebar;
     placement->mainwin_pos = mainwin;
     placement->statusbar_pos = statusbar;
@@ -1405,7 +1407,7 @@ prefs_create_profwin_placement(int titlebar, int mainwin, int statusbar, int inp
 }
 
 void
-prefs_free_win_placement(ProfWinPlacement *placement)
+prefs_free_win_placement(ProfWinPlacement* placement)
 {
     free(placement);
 }
@@ -1460,7 +1462,7 @@ prefs_get_win_placement(void)
 }
 
 void
-prefs_save_win_placement(ProfWinPlacement *placement)
+prefs_save_win_placement(ProfWinPlacement* placement)
 {
     g_key_file_set_integer(prefs, PREF_GROUP_UI, "titlebar.position", placement->titlebar_pos);
     g_key_file_set_integer(prefs, PREF_GROUP_UI, "mainwin.position", placement->mainwin_pos);
@@ -1472,18 +1474,18 @@ prefs_save_win_placement(ProfWinPlacement *placement)
 gboolean
 prefs_titlebar_pos_up(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 2;
-    for (pos = 2; pos<5; pos++) {
+    for (pos = 2; pos < 5; pos++) {
         if (placement->titlebar_pos == pos) {
-            placement->titlebar_pos = pos-1;
+            placement->titlebar_pos = pos - 1;
 
-            if (placement->mainwin_pos == pos-1) {
+            if (placement->mainwin_pos == pos - 1) {
                 placement->mainwin_pos = pos;
-            } else if (placement->statusbar_pos == pos-1) {
+            } else if (placement->statusbar_pos == pos - 1) {
                 placement->statusbar_pos = pos;
-            } else if (placement->inputwin_pos == pos-1) {
+            } else if (placement->inputwin_pos == pos - 1) {
                 placement->inputwin_pos = pos;
             }
 
@@ -1500,18 +1502,18 @@ prefs_titlebar_pos_up(void)
 gboolean
 prefs_mainwin_pos_up(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 2;
-    for (pos = 2; pos<5; pos++) {
+    for (pos = 2; pos < 5; pos++) {
         if (placement->mainwin_pos == pos) {
-            placement->mainwin_pos = pos-1;
+            placement->mainwin_pos = pos - 1;
 
-            if (placement->titlebar_pos == pos-1) {
+            if (placement->titlebar_pos == pos - 1) {
                 placement->titlebar_pos = pos;
-            } else if (placement->statusbar_pos == pos-1) {
+            } else if (placement->statusbar_pos == pos - 1) {
                 placement->statusbar_pos = pos;
-            } else if (placement->inputwin_pos == pos-1) {
+            } else if (placement->inputwin_pos == pos - 1) {
                 placement->inputwin_pos = pos;
             }
 
@@ -1528,18 +1530,18 @@ prefs_mainwin_pos_up(void)
 gboolean
 prefs_statusbar_pos_up(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 2;
-    for (pos = 2; pos<5; pos++) {
+    for (pos = 2; pos < 5; pos++) {
         if (placement->statusbar_pos == pos) {
-            placement->statusbar_pos = pos-1;
+            placement->statusbar_pos = pos - 1;
 
-            if (placement->titlebar_pos == pos-1) {
+            if (placement->titlebar_pos == pos - 1) {
                 placement->titlebar_pos = pos;
-            } else if (placement->mainwin_pos == pos-1) {
+            } else if (placement->mainwin_pos == pos - 1) {
                 placement->mainwin_pos = pos;
-            } else if (placement->inputwin_pos == pos-1) {
+            } else if (placement->inputwin_pos == pos - 1) {
                 placement->inputwin_pos = pos;
             }
 
@@ -1556,18 +1558,18 @@ prefs_statusbar_pos_up(void)
 gboolean
 prefs_inputwin_pos_up(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 2;
-    for (pos = 2; pos<5; pos++) {
+    for (pos = 2; pos < 5; pos++) {
         if (placement->inputwin_pos == pos) {
-            placement->inputwin_pos = pos-1;
+            placement->inputwin_pos = pos - 1;
 
-            if (placement->titlebar_pos == pos-1) {
+            if (placement->titlebar_pos == pos - 1) {
                 placement->titlebar_pos = pos;
-            } else if (placement->mainwin_pos == pos-1) {
+            } else if (placement->mainwin_pos == pos - 1) {
                 placement->mainwin_pos = pos;
-            } else if (placement->statusbar_pos == pos-1) {
+            } else if (placement->statusbar_pos == pos - 1) {
                 placement->statusbar_pos = pos;
             }
 
@@ -1584,18 +1586,18 @@ prefs_inputwin_pos_up(void)
 gboolean
 prefs_titlebar_pos_down(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 1;
-    for (pos = 1; pos<4; pos++) {
+    for (pos = 1; pos < 4; pos++) {
         if (placement->titlebar_pos == pos) {
-            placement->titlebar_pos = pos+1;
+            placement->titlebar_pos = pos + 1;
 
-            if (placement->mainwin_pos == pos+1) {
+            if (placement->mainwin_pos == pos + 1) {
                 placement->mainwin_pos = pos;
-            } else if (placement->statusbar_pos == pos+1) {
+            } else if (placement->statusbar_pos == pos + 1) {
                 placement->statusbar_pos = pos;
-            } else if (placement->inputwin_pos == pos+1) {
+            } else if (placement->inputwin_pos == pos + 1) {
                 placement->inputwin_pos = pos;
             }
 
@@ -1612,18 +1614,18 @@ prefs_titlebar_pos_down(void)
 gboolean
 prefs_mainwin_pos_down(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 1;
-    for (pos = 1; pos<4; pos++) {
+    for (pos = 1; pos < 4; pos++) {
         if (placement->mainwin_pos == pos) {
-            placement->mainwin_pos = pos+1;
+            placement->mainwin_pos = pos + 1;
 
-            if (placement->titlebar_pos == pos+1) {
+            if (placement->titlebar_pos == pos + 1) {
                 placement->titlebar_pos = pos;
-            } else if (placement->statusbar_pos == pos+1) {
+            } else if (placement->statusbar_pos == pos + 1) {
                 placement->statusbar_pos = pos;
-            } else if (placement->inputwin_pos == pos+1) {
+            } else if (placement->inputwin_pos == pos + 1) {
                 placement->inputwin_pos = pos;
             }
 
@@ -1640,18 +1642,18 @@ prefs_mainwin_pos_down(void)
 gboolean
 prefs_statusbar_pos_down(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 1;
-    for (pos = 1; pos<4; pos++) {
+    for (pos = 1; pos < 4; pos++) {
         if (placement->statusbar_pos == pos) {
-            placement->statusbar_pos = pos+1;
+            placement->statusbar_pos = pos + 1;
 
-            if (placement->titlebar_pos == pos+1) {
+            if (placement->titlebar_pos == pos + 1) {
                 placement->titlebar_pos = pos;
-            } else if (placement->mainwin_pos == pos+1) {
+            } else if (placement->mainwin_pos == pos + 1) {
                 placement->mainwin_pos = pos;
-            } else if (placement->inputwin_pos == pos+1) {
+            } else if (placement->inputwin_pos == pos + 1) {
                 placement->inputwin_pos = pos;
             }
 
@@ -1668,18 +1670,18 @@ prefs_statusbar_pos_down(void)
 gboolean
 prefs_inputwin_pos_down(void)
 {
-    ProfWinPlacement *placement = prefs_get_win_placement();
+    ProfWinPlacement* placement = prefs_get_win_placement();
 
     int pos = 1;
-    for (pos = 1; pos<4; pos++) {
+    for (pos = 1; pos < 4; pos++) {
         if (placement->inputwin_pos == pos) {
-            placement->inputwin_pos = pos+1;
+            placement->inputwin_pos = pos + 1;
 
-            if (placement->titlebar_pos == pos+1) {
+            if (placement->titlebar_pos == pos + 1) {
                 placement->titlebar_pos = pos;
-            } else if (placement->mainwin_pos == pos+1) {
+            } else if (placement->mainwin_pos == pos + 1) {
                 placement->mainwin_pos = pos;
-            } else if (placement->statusbar_pos == pos+1) {
+            } else if (placement->statusbar_pos == pos + 1) {
                 placement->statusbar_pos = pos;
             }
 
@@ -1694,7 +1696,7 @@ prefs_inputwin_pos_down(void)
 }
 
 gboolean
-prefs_add_alias(const char *const name, const char *const value)
+prefs_add_alias(const char* const name, const char* const value)
 {
     if (g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) {
         return FALSE;
@@ -1705,14 +1707,13 @@ prefs_add_alias(const char *const name, const char *const value)
 }
 
 char*
-prefs_get_alias(const char *const name)
+prefs_get_alias(const char* const name)
 {
     return g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
-
 }
 
 gboolean
-prefs_remove_alias(const char *const name)
+prefs_remove_alias(const char* const name)
 {
     if (!g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) {
         return FALSE;
@@ -1723,10 +1724,10 @@ prefs_remove_alias(const char *const name)
 }
 
 static gint
-_alias_cmp(gconstpointer *p1, gconstpointer *p2)
+_alias_cmp(gconstpointer* p1, gconstpointer* p2)
 {
-    ProfAlias *alias1 = (ProfAlias*)p1;
-    ProfAlias *alias2 = (ProfAlias*)p2;
+    ProfAlias* alias1 = (ProfAlias*)p1;
+    ProfAlias* alias2 = (ProfAlias*)p2;
 
     return strcmp(alias1->name, alias2->name);
 }
@@ -1737,16 +1738,16 @@ prefs_get_aliases(void)
     if (!g_key_file_has_group(prefs, PREF_GROUP_ALIAS)) {
         return NULL;
     } else {
-        GList *result = NULL;
+        GList* result = NULL;
         gsize len;
-        gchar **keys = g_key_file_get_keys(prefs, PREF_GROUP_ALIAS, &len, NULL);
+        gchar** keys = g_key_file_get_keys(prefs, PREF_GROUP_ALIAS, &len, NULL);
         int i;
         for (i = 0; i < len; i++) {
-            char *name = keys[i];
-            char *value = g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
+            char* name = keys[i];
+            char* value = g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
 
             if (value) {
-                ProfAlias *alias = malloc(sizeof(struct prof_alias_t));
+                ProfAlias* alias = malloc(sizeof(struct prof_alias_t));
                 alias->name = strdup(name);
                 alias->value = strdup(value);
 
@@ -1763,7 +1764,7 @@ prefs_get_aliases(void)
 }
 
 void
-_free_alias(ProfAlias *alias)
+_free_alias(ProfAlias* alias)
 {
     FREE_SET_NULL(alias->name);
     FREE_SET_NULL(alias->value);
@@ -1771,7 +1772,7 @@ _free_alias(ProfAlias *alias)
 }
 
 void
-prefs_free_aliases(GList *aliases)
+prefs_free_aliases(GList* aliases)
 {
     g_list_free_full(aliases, (GDestroyNotify)_free_alias);
 }
@@ -1780,9 +1781,9 @@ static void
 _save_prefs(void)
 {
     gsize g_data_size;
-    gchar *g_prefs_data = g_key_file_to_data(prefs, &g_data_size, NULL);
-    gchar *base = g_path_get_dirname(prefs_loc);
-    gchar *true_loc = get_file_or_linked(prefs_loc, base);
+    gchar* g_prefs_data = g_key_file_to_data(prefs, &g_data_size, NULL);
+    gchar* base = g_path_get_dirname(prefs_loc);
+    gchar* true_loc = get_file_or_linked(prefs_loc, base);
 
     g_file_set_contents(true_loc, g_prefs_data, g_data_size, NULL);
     g_chmod(prefs_loc, S_IRUSR | S_IWUSR);
@@ -1798,146 +1799,145 @@ _save_prefs(void)
 static const char*
 _get_group(preference_t pref)
 {
-    switch (pref)
-    {
-        case PREF_CLEAR_PERSIST_HISTORY:
-        case PREF_SPLASH:
-        case PREF_BEEP:
-        case PREF_THEME:
-        case PREF_VERCHECK:
-        case PREF_WINTITLE_SHOW:
-        case PREF_WINTITLE_GOODBYE:
-        case PREF_FLASH:
-        case PREF_INTYPE:
-        case PREF_HISTORY:
-        case PREF_OCCUPANTS:
-        case PREF_OCCUPANTS_JID:
-        case PREF_OCCUPANTS_WRAP:
-        case PREF_STATUSES:
-        case PREF_STATUSES_CONSOLE:
-        case PREF_STATUSES_CHAT:
-        case PREF_STATUSES_MUC:
-        case PREF_MUC_PRIVILEGES:
-        case PREF_PRESENCE:
-        case PREF_WRAP:
-        case PREF_TIME_CONSOLE:
-        case PREF_TIME_CHAT:
-        case PREF_TIME_MUC:
-        case PREF_TIME_CONFIG:
-        case PREF_TIME_PRIVATE:
-        case PREF_TIME_XMLCONSOLE:
-        case PREF_TIME_STATUSBAR:
-        case PREF_TIME_LASTACTIVITY:
-        case PREF_ROSTER:
-        case PREF_ROSTER_OFFLINE:
-        case PREF_ROSTER_RESOURCE:
-        case PREF_ROSTER_PRESENCE:
-        case PREF_ROSTER_STATUS:
-        case PREF_ROSTER_EMPTY:
-        case PREF_ROSTER_BY:
-        case PREF_ROSTER_ORDER:
-        case PREF_ROSTER_UNREAD:
-        case PREF_ROSTER_COUNT:
-        case PREF_ROSTER_COUNT_ZERO:
-        case PREF_ROSTER_PRIORITY:
-        case PREF_ROSTER_WRAP:
-        case PREF_ROSTER_RESOURCE_JOIN:
-        case PREF_ROSTER_CONTACTS:
-        case PREF_ROSTER_UNSUBSCRIBED:
-        case PREF_ROSTER_ROOMS:
-        case PREF_ROSTER_ROOMS_POS:
-        case PREF_ROSTER_ROOMS_BY:
-        case PREF_ROSTER_ROOMS_ORDER:
-        case PREF_ROSTER_ROOMS_UNREAD:
-        case PREF_ROSTER_ROOMS_SERVER:
-        case PREF_ROSTER_ROOMS_USE_AS_NAME:
-        case PREF_ROSTER_PRIVATE:
-        case PREF_RESOURCE_TITLE:
-        case PREF_RESOURCE_MESSAGE:
-        case PREF_ENC_WARN:
-        case PREF_INPBLOCK_DYNAMIC:
-        case PREF_TLS_SHOW:
-        case PREF_CONSOLE_MUC:
-        case PREF_CONSOLE_PRIVATE:
-        case PREF_CONSOLE_CHAT:
-        case PREF_COLOR_NICK:
-        case PREF_COLOR_NICK_OWN:
-        case PREF_ROSTER_COLOR_NICK:
-        case PREF_OCCUPANTS_COLOR_NICK:
-        case PREF_STATUSBAR_SHOW_NAME:
-        case PREF_STATUSBAR_SHOW_NUMBER:
-        case PREF_STATUSBAR_SHOW_READ:
-        case PREF_STATUSBAR_SELF:
-        case PREF_STATUSBAR_CHAT:
-        case PREF_STATUSBAR_ROOM:
-        case PREF_TITLEBAR_MUC_TITLE_JID:
-        case PREF_TITLEBAR_MUC_TITLE_NAME:
-        case PREF_SLASH_GUARD:
-            return PREF_GROUP_UI;
-        case PREF_STATES:
-        case PREF_OUTTYPE:
-            return PREF_GROUP_CHATSTATES;
-        case PREF_NOTIFY_TYPING:
-        case PREF_NOTIFY_TYPING_CURRENT:
-        case PREF_NOTIFY_CHAT:
-        case PREF_NOTIFY_CHAT_CURRENT:
-        case PREF_NOTIFY_CHAT_TEXT:
-        case PREF_NOTIFY_ROOM:
-        case PREF_NOTIFY_ROOM_MENTION:
-        case PREF_NOTIFY_ROOM_TRIGGER:
-        case PREF_NOTIFY_ROOM_CURRENT:
-        case PREF_NOTIFY_ROOM_TEXT:
-        case PREF_NOTIFY_INVITE:
-        case PREF_NOTIFY_SUB:
-        case PREF_NOTIFY_MENTION_CASE_SENSITIVE:
-        case PREF_NOTIFY_MENTION_WHOLE_WORD:
-        case PREF_TRAY:
-        case PREF_TRAY_READ:
-        case PREF_ADV_NOTIFY_DISCO_OR_VERSION:
-            return PREF_GROUP_NOTIFICATIONS;
-        case PREF_CHLOG:
-        case PREF_GRLOG:
-        case PREF_LOG_ROTATE:
-        case PREF_LOG_SHARED:
-            return PREF_GROUP_LOGGING;
-        case PREF_AVATAR_CMD:
-        case PREF_URL_OPEN_CMD:
-        case PREF_URL_SAVE_CMD:
-            return PREF_GROUP_EXECUTABLES;
-        case PREF_AUTOAWAY_CHECK:
-        case PREF_AUTOAWAY_MODE:
-        case PREF_AUTOAWAY_MESSAGE:
-        case PREF_AUTOXA_MESSAGE:
-        case PREF_LASTACTIVITY:
-            return PREF_GROUP_PRESENCE;
-        case PREF_CONNECT_ACCOUNT:
-        case PREF_DEFAULT_ACCOUNT:
-        case PREF_CARBONS:
-        case PREF_RECEIPTS_SEND:
-        case PREF_RECEIPTS_REQUEST:
-        case PREF_REVEAL_OS:
-        case PREF_TLS_CERTPATH:
-        case PREF_CORRECTION_ALLOW:
-        case PREF_MAM:
-            return PREF_GROUP_CONNECTION;
-        case PREF_OTR_LOG:
-        case PREF_OTR_POLICY:
-        case PREF_OTR_SENDFILE:
-            return PREF_GROUP_OTR;
-        case PREF_PGP_LOG:
-        case PREF_PGP_SENDFILE:
-            return PREF_GROUP_PGP;
-        case PREF_BOOKMARK_INVITE:
-        case PREF_ROOM_LIST_CACHE:
-            return PREF_GROUP_MUC;
-        case PREF_PLUGINS_SOURCEPATH:
-            return PREF_GROUP_PLUGINS;
-        case PREF_OMEMO_LOG:
-        case PREF_OMEMO_POLICY:
-        case PREF_OMEMO_SENDFILE:
-            return PREF_GROUP_OMEMO;
-        default:
-            return NULL;
+    switch (pref) {
+    case PREF_CLEAR_PERSIST_HISTORY:
+    case PREF_SPLASH:
+    case PREF_BEEP:
+    case PREF_THEME:
+    case PREF_VERCHECK:
+    case PREF_WINTITLE_SHOW:
+    case PREF_WINTITLE_GOODBYE:
+    case PREF_FLASH:
+    case PREF_INTYPE:
+    case PREF_HISTORY:
+    case PREF_OCCUPANTS:
+    case PREF_OCCUPANTS_JID:
+    case PREF_OCCUPANTS_WRAP:
+    case PREF_STATUSES:
+    case PREF_STATUSES_CONSOLE:
+    case PREF_STATUSES_CHAT:
+    case PREF_STATUSES_MUC:
+    case PREF_MUC_PRIVILEGES:
+    case PREF_PRESENCE:
+    case PREF_WRAP:
+    case PREF_TIME_CONSOLE:
+    case PREF_TIME_CHAT:
+    case PREF_TIME_MUC:
+    case PREF_TIME_CONFIG:
+    case PREF_TIME_PRIVATE:
+    case PREF_TIME_XMLCONSOLE:
+    case PREF_TIME_STATUSBAR:
+    case PREF_TIME_LASTACTIVITY:
+    case PREF_ROSTER:
+    case PREF_ROSTER_OFFLINE:
+    case PREF_ROSTER_RESOURCE:
+    case PREF_ROSTER_PRESENCE:
+    case PREF_ROSTER_STATUS:
+    case PREF_ROSTER_EMPTY:
+    case PREF_ROSTER_BY:
+    case PREF_ROSTER_ORDER:
+    case PREF_ROSTER_UNREAD:
+    case PREF_ROSTER_COUNT:
+    case PREF_ROSTER_COUNT_ZERO:
+    case PREF_ROSTER_PRIORITY:
+    case PREF_ROSTER_WRAP:
+    case PREF_ROSTER_RESOURCE_JOIN:
+    case PREF_ROSTER_CONTACTS:
+    case PREF_ROSTER_UNSUBSCRIBED:
+    case PREF_ROSTER_ROOMS:
+    case PREF_ROSTER_ROOMS_POS:
+    case PREF_ROSTER_ROOMS_BY:
+    case PREF_ROSTER_ROOMS_ORDER:
+    case PREF_ROSTER_ROOMS_UNREAD:
+    case PREF_ROSTER_ROOMS_SERVER:
+    case PREF_ROSTER_ROOMS_USE_AS_NAME:
+    case PREF_ROSTER_PRIVATE:
+    case PREF_RESOURCE_TITLE:
+    case PREF_RESOURCE_MESSAGE:
+    case PREF_ENC_WARN:
+    case PREF_INPBLOCK_DYNAMIC:
+    case PREF_TLS_SHOW:
+    case PREF_CONSOLE_MUC:
+    case PREF_CONSOLE_PRIVATE:
+    case PREF_CONSOLE_CHAT:
+    case PREF_COLOR_NICK:
+    case PREF_COLOR_NICK_OWN:
+    case PREF_ROSTER_COLOR_NICK:
+    case PREF_OCCUPANTS_COLOR_NICK:
+    case PREF_STATUSBAR_SHOW_NAME:
+    case PREF_STATUSBAR_SHOW_NUMBER:
+    case PREF_STATUSBAR_SHOW_READ:
+    case PREF_STATUSBAR_SELF:
+    case PREF_STATUSBAR_CHAT:
+    case PREF_STATUSBAR_ROOM:
+    case PREF_TITLEBAR_MUC_TITLE_JID:
+    case PREF_TITLEBAR_MUC_TITLE_NAME:
+    case PREF_SLASH_GUARD:
+        return PREF_GROUP_UI;
+    case PREF_STATES:
+    case PREF_OUTTYPE:
+        return PREF_GROUP_CHATSTATES;
+    case PREF_NOTIFY_TYPING:
+    case PREF_NOTIFY_TYPING_CURRENT:
+    case PREF_NOTIFY_CHAT:
+    case PREF_NOTIFY_CHAT_CURRENT:
+    case PREF_NOTIFY_CHAT_TEXT:
+    case PREF_NOTIFY_ROOM:
+    case PREF_NOTIFY_ROOM_MENTION:
+    case PREF_NOTIFY_ROOM_TRIGGER:
+    case PREF_NOTIFY_ROOM_CURRENT:
+    case PREF_NOTIFY_ROOM_TEXT:
+    case PREF_NOTIFY_INVITE:
+    case PREF_NOTIFY_SUB:
+    case PREF_NOTIFY_MENTION_CASE_SENSITIVE:
+    case PREF_NOTIFY_MENTION_WHOLE_WORD:
+    case PREF_TRAY:
+    case PREF_TRAY_READ:
+    case PREF_ADV_NOTIFY_DISCO_OR_VERSION:
+        return PREF_GROUP_NOTIFICATIONS;
+    case PREF_CHLOG:
+    case PREF_GRLOG:
+    case PREF_LOG_ROTATE:
+    case PREF_LOG_SHARED:
+        return PREF_GROUP_LOGGING;
+    case PREF_AVATAR_CMD:
+    case PREF_URL_OPEN_CMD:
+    case PREF_URL_SAVE_CMD:
+        return PREF_GROUP_EXECUTABLES;
+    case PREF_AUTOAWAY_CHECK:
+    case PREF_AUTOAWAY_MODE:
+    case PREF_AUTOAWAY_MESSAGE:
+    case PREF_AUTOXA_MESSAGE:
+    case PREF_LASTACTIVITY:
+        return PREF_GROUP_PRESENCE;
+    case PREF_CONNECT_ACCOUNT:
+    case PREF_DEFAULT_ACCOUNT:
+    case PREF_CARBONS:
+    case PREF_RECEIPTS_SEND:
+    case PREF_RECEIPTS_REQUEST:
+    case PREF_REVEAL_OS:
+    case PREF_TLS_CERTPATH:
+    case PREF_CORRECTION_ALLOW:
+    case PREF_MAM:
+        return PREF_GROUP_CONNECTION;
+    case PREF_OTR_LOG:
+    case PREF_OTR_POLICY:
+    case PREF_OTR_SENDFILE:
+        return PREF_GROUP_OTR;
+    case PREF_PGP_LOG:
+    case PREF_PGP_SENDFILE:
+        return PREF_GROUP_PGP;
+    case PREF_BOOKMARK_INVITE:
+    case PREF_ROOM_LIST_CACHE:
+        return PREF_GROUP_MUC;
+    case PREF_PLUGINS_SOURCEPATH:
+        return PREF_GROUP_PLUGINS;
+    case PREF_OMEMO_LOG:
+    case PREF_OMEMO_POLICY:
+    case PREF_OMEMO_SENDFILE:
+        return PREF_GROUP_OMEMO;
+    default:
+        return NULL;
     }
 }
 
@@ -1946,258 +1946,257 @@ _get_group(preference_t pref)
 static const char*
 _get_key(preference_t pref)
 {
-    switch (pref)
-    {
-        case PREF_CLEAR_PERSIST_HISTORY:
-            return "clear.persist_history";
-        case PREF_SPLASH:
-            return "splash";
-        case PREF_BEEP:
-            return "beep";
-        case PREF_THEME:
-            return "theme";
-        case PREF_VERCHECK:
-            return "vercheck";
-        case PREF_WINTITLE_SHOW:
-            return "wintitle.show";
-        case PREF_WINTITLE_GOODBYE:
-            return "wintitle.goodbye";
-        case PREF_FLASH:
-            return "flash";
-        case PREF_TRAY:
-            return "tray";
-        case PREF_TRAY_READ:
-            return "tray.read";
-        case PREF_ADV_NOTIFY_DISCO_OR_VERSION:
-            return "adv.notify.discoversion";
-        case PREF_INTYPE:
-            return "intype";
-        case PREF_HISTORY:
-            return "history";
-        case PREF_CARBONS:
-            return "carbons";
-        case PREF_RECEIPTS_SEND:
-            return "receipts.send";
-        case PREF_RECEIPTS_REQUEST:
-            return "receipts.request";
-        case PREF_REVEAL_OS:
-            return "reveal.os";
-        case PREF_OCCUPANTS:
-            return "occupants";
-        case PREF_OCCUPANTS_JID:
-            return "occupants.jid";
-        case PREF_OCCUPANTS_WRAP:
-            return "occupants.wrap";
-        case PREF_MUC_PRIVILEGES:
-            return "privileges";
-        case PREF_STATUSES:
-            return "statuses";
-        case PREF_STATUSES_CONSOLE:
-            return "statuses.console";
-        case PREF_STATUSES_CHAT:
-            return "statuses.chat";
-        case PREF_STATUSES_MUC:
-            return "statuses.muc";
-        case PREF_STATES:
-            return "enabled";
-        case PREF_OUTTYPE:
-            return "outtype";
-        case PREF_NOTIFY_TYPING:
-            return "typing";
-        case PREF_NOTIFY_TYPING_CURRENT:
-            return "typing.current";
-        case PREF_NOTIFY_CHAT:
-            return "message";
-        case PREF_NOTIFY_CHAT_CURRENT:
-            return "message.current";
-        case PREF_NOTIFY_CHAT_TEXT:
-            return "message.text";
-        case PREF_NOTIFY_ROOM:
-            return "room";
-        case PREF_NOTIFY_ROOM_TRIGGER:
-            return "room.trigger";
-        case PREF_NOTIFY_ROOM_MENTION:
-            return "room.mention";
-        case PREF_NOTIFY_ROOM_CURRENT:
-            return "room.current";
-        case PREF_NOTIFY_ROOM_TEXT:
-            return "room.text";
-        case PREF_NOTIFY_INVITE:
-            return "invite";
-        case PREF_NOTIFY_SUB:
-            return "sub";
-        case PREF_NOTIFY_MENTION_CASE_SENSITIVE:
-            return "room.mention.casesensitive";
-        case PREF_NOTIFY_MENTION_WHOLE_WORD:
-            return "room.mention.wholeword";
-        case PREF_CHLOG:
-            return "chlog";
-        case PREF_GRLOG:
-            return "grlog";
-        case PREF_AUTOAWAY_CHECK:
-            return "autoaway.check";
-        case PREF_AUTOAWAY_MODE:
-            return "autoaway.mode";
-        case PREF_AUTOAWAY_MESSAGE:
-            return "autoaway.awaymessage";
-        case PREF_AUTOXA_MESSAGE:
-            return "autoaway.xamessage";
-        case PREF_CONNECT_ACCOUNT:
-            return "account";
-        case PREF_DEFAULT_ACCOUNT:
-            return "defaccount";
-        case PREF_OTR_LOG:
-            return "log";
-        case PREF_OTR_POLICY:
-            return "policy";
-        case PREF_OTR_SENDFILE:
-            return "sendfile";
-        case PREF_LOG_ROTATE:
-            return "rotate";
-        case PREF_LOG_SHARED:
-            return "shared";
-        case PREF_PRESENCE:
-            return "presence";
-        case PREF_WRAP:
-            return "wrap";
-        case PREF_TIME_CONSOLE:
-            return "time.console";
-        case PREF_TIME_CHAT:
-            return "time.chat";
-        case PREF_TIME_MUC:
-            return "time.muc";
-        case PREF_TIME_CONFIG:
-            return "time.config";
-        case PREF_TIME_PRIVATE:
-            return "time.private";
-        case PREF_TIME_XMLCONSOLE:
-            return "time.xmlconsole";
-        case PREF_TIME_STATUSBAR:
-            return "time.statusbar";
-        case PREF_TIME_LASTACTIVITY:
-            return "time.lastactivity";
-        case PREF_ROSTER:
-            return "roster";
-        case PREF_ROSTER_OFFLINE:
-            return "roster.offline";
-        case PREF_ROSTER_RESOURCE:
-            return "roster.resource";
-        case PREF_ROSTER_PRESENCE:
-            return "roster.presence";
-        case PREF_ROSTER_STATUS:
-            return "roster.status";
-        case PREF_ROSTER_EMPTY:
-            return "roster.empty";
-        case PREF_ROSTER_BY:
-            return "roster.by";
-        case PREF_ROSTER_ORDER:
-            return "roster.order";
-        case PREF_ROSTER_UNREAD:
-            return "roster.unread";
-        case PREF_ROSTER_COUNT:
-            return "roster.count";
-        case PREF_ROSTER_COUNT_ZERO:
-            return "roster.count.zero";
-        case PREF_ROSTER_PRIORITY:
-            return "roster.priority";
-        case PREF_ROSTER_WRAP:
-            return "roster.wrap";
-        case PREF_ROSTER_RESOURCE_JOIN:
-            return "roster.resource.join";
-        case PREF_ROSTER_CONTACTS:
-            return "roster.contacts";
-        case PREF_ROSTER_UNSUBSCRIBED:
-            return "roster.unsubscribed";
-        case PREF_ROSTER_ROOMS:
-            return "roster.rooms";
-        case PREF_ROSTER_ROOMS_POS:
-            return "roster.rooms.pos";
-        case PREF_ROSTER_ROOMS_BY:
-            return "roster.rooms.by";
-        case PREF_ROSTER_ROOMS_ORDER:
-            return "roster.rooms.order";
-        case PREF_ROSTER_ROOMS_UNREAD:
-            return "roster.rooms.unread";
-        case PREF_ROSTER_ROOMS_SERVER:
-            return "roster.rooms.server";
-        case PREF_ROSTER_ROOMS_USE_AS_NAME:
-            return "roster.rooms.use.name";
-        case PREF_ROSTER_PRIVATE:
-            return "roster.private";
-        case PREF_RESOURCE_TITLE:
-            return "resource.title";
-        case PREF_RESOURCE_MESSAGE:
-            return "resource.message";
-        case PREF_INPBLOCK_DYNAMIC:
-            return "inpblock.dynamic";
-        case PREF_ENC_WARN:
-            return "enc.warn";
-        case PREF_TITLEBAR_MUC_TITLE_JID:
-            return "titlebar.muc.title.jid";
-        case PREF_TITLEBAR_MUC_TITLE_NAME:
-            return "titlebar.muc.title.name";
-        case PREF_PGP_LOG:
-            return "log";
-        case PREF_PGP_SENDFILE:
-            return "sendfile";
-        case PREF_TLS_CERTPATH:
-            return "tls.certpath";
-        case PREF_TLS_SHOW:
-            return "tls.show";
-        case PREF_LASTACTIVITY:
-            return "lastactivity";
-        case PREF_CONSOLE_MUC:
-            return "console.muc";
-        case PREF_CONSOLE_PRIVATE:
-            return "console.private";
-        case PREF_CONSOLE_CHAT:
-            return "console.chat";
-        case PREF_COLOR_NICK:
-            return "color.nick";
-        case PREF_COLOR_NICK_OWN:
-            return "color.nick.own";
-        case PREF_ROSTER_COLOR_NICK:
-            return "color.roster.nick";
-        case PREF_OCCUPANTS_COLOR_NICK:
-            return "color.occupants.nick";
-        case PREF_BOOKMARK_INVITE:
-            return "bookmark.invite";
-        case PREF_PLUGINS_SOURCEPATH:
-            return "sourcepath";
-        case PREF_ROOM_LIST_CACHE:
-            return "rooms.cache";
-        case PREF_STATUSBAR_SHOW_NAME:
-            return "statusbar.show.name";
-        case PREF_STATUSBAR_SHOW_NUMBER:
-            return "statusbar.show.number";
-        case PREF_STATUSBAR_SHOW_READ:
-            return "statusbar.show.read";
-        case PREF_STATUSBAR_SELF:
-            return "statusbar.self";
-        case PREF_STATUSBAR_CHAT:
-            return "statusbar.chat";
-        case PREF_STATUSBAR_ROOM:
-            return "statusbar.room";
-        case PREF_OMEMO_LOG:
-            return "log";
-        case PREF_OMEMO_POLICY:
-            return "policy";
-        case PREF_OMEMO_SENDFILE:
-            return "sendfile";
-        case PREF_CORRECTION_ALLOW:
-            return "correction.allow";
-        case PREF_AVATAR_CMD:
-            return "avatar.cmd";
-        case PREF_SLASH_GUARD:
-            return "slashguard";
-        case PREF_MAM:
-            return "mam";
-        case PREF_URL_OPEN_CMD:
-            return "url.open.cmd";
-        case PREF_URL_SAVE_CMD:
-            return "url.save.cmd";
-        default:
-            return NULL;
+    switch (pref) {
+    case PREF_CLEAR_PERSIST_HISTORY:
+        return "clear.persist_history";
+    case PREF_SPLASH:
+        return "splash";
+    case PREF_BEEP:
+        return "beep";
+    case PREF_THEME:
+        return "theme";
+    case PREF_VERCHECK:
+        return "vercheck";
+    case PREF_WINTITLE_SHOW:
+        return "wintitle.show";
+    case PREF_WINTITLE_GOODBYE:
+        return "wintitle.goodbye";
+    case PREF_FLASH:
+        return "flash";
+    case PREF_TRAY:
+        return "tray";
+    case PREF_TRAY_READ:
+        return "tray.read";
+    case PREF_ADV_NOTIFY_DISCO_OR_VERSION:
+        return "adv.notify.discoversion";
+    case PREF_INTYPE:
+        return "intype";
+    case PREF_HISTORY:
+        return "history";
+    case PREF_CARBONS:
+        return "carbons";
+    case PREF_RECEIPTS_SEND:
+        return "receipts.send";
+    case PREF_RECEIPTS_REQUEST:
+        return "receipts.request";
+    case PREF_REVEAL_OS:
+        return "reveal.os";
+    case PREF_OCCUPANTS:
+        return "occupants";
+    case PREF_OCCUPANTS_JID:
+        return "occupants.jid";
+    case PREF_OCCUPANTS_WRAP:
+        return "occupants.wrap";
+    case PREF_MUC_PRIVILEGES:
+        return "privileges";
+    case PREF_STATUSES:
+        return "statuses";
+    case PREF_STATUSES_CONSOLE:
+        return "statuses.console";
+    case PREF_STATUSES_CHAT:
+        return "statuses.chat";
+    case PREF_STATUSES_MUC:
+        return "statuses.muc";
+    case PREF_STATES:
+        return "enabled";
+    case PREF_OUTTYPE:
+        return "outtype";
+    case PREF_NOTIFY_TYPING:
+        return "typing";
+    case PREF_NOTIFY_TYPING_CURRENT:
+        return "typing.current";
+    case PREF_NOTIFY_CHAT:
+        return "message";
+    case PREF_NOTIFY_CHAT_CURRENT:
+        return "message.current";
+    case PREF_NOTIFY_CHAT_TEXT:
+        return "message.text";
+    case PREF_NOTIFY_ROOM:
+        return "room";
+    case PREF_NOTIFY_ROOM_TRIGGER:
+        return "room.trigger";
+    case PREF_NOTIFY_ROOM_MENTION:
+        return "room.mention";
+    case PREF_NOTIFY_ROOM_CURRENT:
+        return "room.current";
+    case PREF_NOTIFY_ROOM_TEXT:
+        return "room.text";
+    case PREF_NOTIFY_INVITE:
+        return "invite";
+    case PREF_NOTIFY_SUB:
+        return "sub";
+    case PREF_NOTIFY_MENTION_CASE_SENSITIVE:
+        return "room.mention.casesensitive";
+    case PREF_NOTIFY_MENTION_WHOLE_WORD:
+        return "room.mention.wholeword";
+    case PREF_CHLOG:
+        return "chlog";
+    case PREF_GRLOG:
+        return "grlog";
+    case PREF_AUTOAWAY_CHECK:
+        return "autoaway.check";
+    case PREF_AUTOAWAY_MODE:
+        return "autoaway.mode";
+    case PREF_AUTOAWAY_MESSAGE:
+        return "autoaway.awaymessage";
+    case PREF_AUTOXA_MESSAGE:
+        return "autoaway.xamessage";
+    case PREF_CONNECT_ACCOUNT:
+        return "account";
+    case PREF_DEFAULT_ACCOUNT:
+        return "defaccount";
+    case PREF_OTR_LOG:
+        return "log";
+    case PREF_OTR_POLICY:
+        return "policy";
+    case PREF_OTR_SENDFILE:
+        return "sendfile";
+    case PREF_LOG_ROTATE:
+        return "rotate";
+    case PREF_LOG_SHARED:
+        return "shared";
+    case PREF_PRESENCE:
+        return "presence";
+    case PREF_WRAP:
+        return "wrap";
+    case PREF_TIME_CONSOLE:
+        return "time.console";
+    case PREF_TIME_CHAT:
+        return "time.chat";
+    case PREF_TIME_MUC:
+        return "time.muc";
+    case PREF_TIME_CONFIG:
+        return "time.config";
+    case PREF_TIME_PRIVATE:
+        return "time.private";
+    case PREF_TIME_XMLCONSOLE:
+        return "time.xmlconsole";
+    case PREF_TIME_STATUSBAR:
+        return "time.statusbar";
+    case PREF_TIME_LASTACTIVITY:
+        return "time.lastactivity";
+    case PREF_ROSTER:
+        return "roster";
+    case PREF_ROSTER_OFFLINE:
+        return "roster.offline";
+    case PREF_ROSTER_RESOURCE:
+        return "roster.resource";
+    case PREF_ROSTER_PRESENCE:
+        return "roster.presence";
+    case PREF_ROSTER_STATUS:
+        return "roster.status";
+    case PREF_ROSTER_EMPTY:
+        return "roster.empty";
+    case PREF_ROSTER_BY:
+        return "roster.by";
+    case PREF_ROSTER_ORDER:
+        return "roster.order";
+    case PREF_ROSTER_UNREAD:
+        return "roster.unread";
+    case PREF_ROSTER_COUNT:
+        return "roster.count";
+    case PREF_ROSTER_COUNT_ZERO:
+        return "roster.count.zero";
+    case PREF_ROSTER_PRIORITY:
+        return "roster.priority";
+    case PREF_ROSTER_WRAP:
+        return "roster.wrap";
+    case PREF_ROSTER_RESOURCE_JOIN:
+        return "roster.resource.join";
+    case PREF_ROSTER_CONTACTS:
+        return "roster.contacts";
+    case PREF_ROSTER_UNSUBSCRIBED:
+        return "roster.unsubscribed";
+    case PREF_ROSTER_ROOMS:
+        return "roster.rooms";
+    case PREF_ROSTER_ROOMS_POS:
+        return "roster.rooms.pos";
+    case PREF_ROSTER_ROOMS_BY:
+        return "roster.rooms.by";
+    case PREF_ROSTER_ROOMS_ORDER:
+        return "roster.rooms.order";
+    case PREF_ROSTER_ROOMS_UNREAD:
+        return "roster.rooms.unread";
+    case PREF_ROSTER_ROOMS_SERVER:
+        return "roster.rooms.server";
+    case PREF_ROSTER_ROOMS_USE_AS_NAME:
+        return "roster.rooms.use.name";
+    case PREF_ROSTER_PRIVATE:
+        return "roster.private";
+    case PREF_RESOURCE_TITLE:
+        return "resource.title";
+    case PREF_RESOURCE_MESSAGE:
+        return "resource.message";
+    case PREF_INPBLOCK_DYNAMIC:
+        return "inpblock.dynamic";
+    case PREF_ENC_WARN:
+        return "enc.warn";
+    case PREF_TITLEBAR_MUC_TITLE_JID:
+        return "titlebar.muc.title.jid";
+    case PREF_TITLEBAR_MUC_TITLE_NAME:
+        return "titlebar.muc.title.name";
+    case PREF_PGP_LOG:
+        return "log";
+    case PREF_PGP_SENDFILE:
+        return "sendfile";
+    case PREF_TLS_CERTPATH:
+        return "tls.certpath";
+    case PREF_TLS_SHOW:
+        return "tls.show";
+    case PREF_LASTACTIVITY:
+        return "lastactivity";
+    case PREF_CONSOLE_MUC:
+        return "console.muc";
+    case PREF_CONSOLE_PRIVATE:
+        return "console.private";
+    case PREF_CONSOLE_CHAT:
+        return "console.chat";
+    case PREF_COLOR_NICK:
+        return "color.nick";
+    case PREF_COLOR_NICK_OWN:
+        return "color.nick.own";
+    case PREF_ROSTER_COLOR_NICK:
+        return "color.roster.nick";
+    case PREF_OCCUPANTS_COLOR_NICK:
+        return "color.occupants.nick";
+    case PREF_BOOKMARK_INVITE:
+        return "bookmark.invite";
+    case PREF_PLUGINS_SOURCEPATH:
+        return "sourcepath";
+    case PREF_ROOM_LIST_CACHE:
+        return "rooms.cache";
+    case PREF_STATUSBAR_SHOW_NAME:
+        return "statusbar.show.name";
+    case PREF_STATUSBAR_SHOW_NUMBER:
+        return "statusbar.show.number";
+    case PREF_STATUSBAR_SHOW_READ:
+        return "statusbar.show.read";
+    case PREF_STATUSBAR_SELF:
+        return "statusbar.self";
+    case PREF_STATUSBAR_CHAT:
+        return "statusbar.chat";
+    case PREF_STATUSBAR_ROOM:
+        return "statusbar.room";
+    case PREF_OMEMO_LOG:
+        return "log";
+    case PREF_OMEMO_POLICY:
+        return "policy";
+    case PREF_OMEMO_SENDFILE:
+        return "sendfile";
+    case PREF_CORRECTION_ALLOW:
+        return "correction.allow";
+    case PREF_AVATAR_CMD:
+        return "avatar.cmd";
+    case PREF_SLASH_GUARD:
+        return "slashguard";
+    case PREF_MAM:
+        return "mam";
+    case PREF_URL_OPEN_CMD:
+        return "url.open.cmd";
+    case PREF_URL_SAVE_CMD:
+        return "url.save.cmd";
+    default:
+        return NULL;
     }
 }
 
@@ -2206,57 +2205,56 @@ _get_key(preference_t pref)
 static gboolean
 _get_default_boolean(preference_t pref)
 {
-    switch (pref)
-    {
-        case PREF_ENC_WARN:
-        case PREF_AUTOAWAY_CHECK:
-        case PREF_LOG_ROTATE:
-        case PREF_LOG_SHARED:
-        case PREF_NOTIFY_CHAT:
-        case PREF_NOTIFY_CHAT_CURRENT:
-        case PREF_NOTIFY_ROOM:
-        case PREF_NOTIFY_ROOM_CURRENT:
-        case PREF_NOTIFY_TYPING:
-        case PREF_NOTIFY_TYPING_CURRENT:
-        case PREF_NOTIFY_SUB:
-        case PREF_NOTIFY_INVITE:
-        case PREF_SPLASH:
-        case PREF_OCCUPANTS:
-        case PREF_MUC_PRIVILEGES:
-        case PREF_PRESENCE:
-        case PREF_WRAP:
-        case PREF_INPBLOCK_DYNAMIC:
-        case PREF_RESOURCE_TITLE:
-        case PREF_RESOURCE_MESSAGE:
-        case PREF_ROSTER:
-        case PREF_ROSTER_OFFLINE:
-        case PREF_ROSTER_EMPTY:
-        case PREF_ROSTER_COUNT_ZERO:
-        case PREF_ROSTER_PRIORITY:
-        case PREF_ROSTER_RESOURCE_JOIN:
-        case PREF_ROSTER_CONTACTS:
-        case PREF_ROSTER_UNSUBSCRIBED:
-        case PREF_ROSTER_ROOMS:
-        case PREF_ROSTER_ROOMS_SERVER:
-        case PREF_TLS_SHOW:
-        case PREF_LASTACTIVITY:
-        case PREF_NOTIFY_MENTION_WHOLE_WORD:
-        case PREF_TRAY_READ:
-        case PREF_BOOKMARK_INVITE:
-        case PREF_ROOM_LIST_CACHE:
-        case PREF_STATUSBAR_SHOW_NUMBER:
-        case PREF_STATUSBAR_SHOW_READ:
-        case PREF_REVEAL_OS:
-        case PREF_CORRECTION_ALLOW:
-        case PREF_RECEIPTS_SEND:
-        case PREF_CARBONS:
-        case PREF_STATES:
-        case PREF_OUTTYPE:
-        case PREF_TITLEBAR_MUC_TITLE_NAME:
-        case PREF_COLOR_NICK_OWN:
-            return TRUE;
-        default:
-            return FALSE;
+    switch (pref) {
+    case PREF_ENC_WARN:
+    case PREF_AUTOAWAY_CHECK:
+    case PREF_LOG_ROTATE:
+    case PREF_LOG_SHARED:
+    case PREF_NOTIFY_CHAT:
+    case PREF_NOTIFY_CHAT_CURRENT:
+    case PREF_NOTIFY_ROOM:
+    case PREF_NOTIFY_ROOM_CURRENT:
+    case PREF_NOTIFY_TYPING:
+    case PREF_NOTIFY_TYPING_CURRENT:
+    case PREF_NOTIFY_SUB:
+    case PREF_NOTIFY_INVITE:
+    case PREF_SPLASH:
+    case PREF_OCCUPANTS:
+    case PREF_MUC_PRIVILEGES:
+    case PREF_PRESENCE:
+    case PREF_WRAP:
+    case PREF_INPBLOCK_DYNAMIC:
+    case PREF_RESOURCE_TITLE:
+    case PREF_RESOURCE_MESSAGE:
+    case PREF_ROSTER:
+    case PREF_ROSTER_OFFLINE:
+    case PREF_ROSTER_EMPTY:
+    case PREF_ROSTER_COUNT_ZERO:
+    case PREF_ROSTER_PRIORITY:
+    case PREF_ROSTER_RESOURCE_JOIN:
+    case PREF_ROSTER_CONTACTS:
+    case PREF_ROSTER_UNSUBSCRIBED:
+    case PREF_ROSTER_ROOMS:
+    case PREF_ROSTER_ROOMS_SERVER:
+    case PREF_TLS_SHOW:
+    case PREF_LASTACTIVITY:
+    case PREF_NOTIFY_MENTION_WHOLE_WORD:
+    case PREF_TRAY_READ:
+    case PREF_BOOKMARK_INVITE:
+    case PREF_ROOM_LIST_CACHE:
+    case PREF_STATUSBAR_SHOW_NUMBER:
+    case PREF_STATUSBAR_SHOW_READ:
+    case PREF_REVEAL_OS:
+    case PREF_CORRECTION_ALLOW:
+    case PREF_RECEIPTS_SEND:
+    case PREF_CARBONS:
+    case PREF_STATES:
+    case PREF_OUTTYPE:
+    case PREF_TITLEBAR_MUC_TITLE_NAME:
+    case PREF_COLOR_NICK_OWN:
+        return TRUE;
+    default:
+        return FALSE;
     }
 }
 
@@ -2265,78 +2263,77 @@ _get_default_boolean(preference_t pref)
 static char*
 _get_default_string(preference_t pref)
 {
-    switch (pref)
-    {
-        case PREF_AUTOAWAY_MODE:
-            return "off";
-        case PREF_OTR_LOG:
-            return "redact";
-        case PREF_OTR_POLICY:
-            return "manual";
-        case PREF_STATUSES_CONSOLE:
-        case PREF_STATUSES_CHAT:
-        case PREF_STATUSES_MUC:
-            return "all";
-        case PREF_ROSTER_BY:
-            return "presence";
-        case PREF_ROSTER_COUNT:
-            return "unread";
-        case PREF_ROSTER_ORDER:
-            return "presence";
-        case PREF_ROSTER_UNREAD:
-            return "after";
-        case PREF_ROSTER_ROOMS_POS:
-            return "last";
-        case PREF_ROSTER_ROOMS_BY:
-            return "none";
-        case PREF_ROSTER_ROOMS_USE_AS_NAME:
-            return "name";
-        case PREF_ROSTER_ROOMS_ORDER:
-            return "name";
-        case PREF_ROSTER_ROOMS_UNREAD:
-            return "after";
-        case PREF_ROSTER_PRIVATE:
-            return "room";
-        case PREF_TIME_CONSOLE:
-            return "%H:%M:%S";
-        case PREF_TIME_CHAT:
-            return "%H:%M:%S";
-        case PREF_TIME_MUC:
-            return "%H:%M:%S";
-        case PREF_TIME_CONFIG:
-            return "%H:%M:%S";
-        case PREF_TIME_PRIVATE:
-            return "%H:%M:%S";
-        case PREF_TIME_XMLCONSOLE:
-            return "%H:%M:%S";
-        case PREF_TIME_STATUSBAR:
-            return "%H:%M";
-        case PREF_TIME_LASTACTIVITY:
-            return "%d/%m/%y %H:%M:%S";
-        case PREF_PGP_LOG:
-            return "redact";
-        case PREF_CONSOLE_MUC:
-        case PREF_CONSOLE_PRIVATE:
-        case PREF_CONSOLE_CHAT:
-            return "all";
-        case PREF_STATUSBAR_SELF:
-            return "fulljid";
-        case PREF_STATUSBAR_CHAT:
-            return "user";
-        case PREF_STATUSBAR_ROOM:
-            return "room";
-        case PREF_OMEMO_LOG:
-            return "redact";
-        case PREF_OMEMO_POLICY:
-            return "automatic";
-        case PREF_COLOR_NICK:
-            return "false";
-        case PREF_AVATAR_CMD:
-            return "xdg-open";
-        case PREF_URL_SAVE_CMD:
-            return "curl -o %p %u";
-        default:
-            return NULL;
+    switch (pref) {
+    case PREF_AUTOAWAY_MODE:
+        return "off";
+    case PREF_OTR_LOG:
+        return "redact";
+    case PREF_OTR_POLICY:
+        return "manual";
+    case PREF_STATUSES_CONSOLE:
+    case PREF_STATUSES_CHAT:
+    case PREF_STATUSES_MUC:
+        return "all";
+    case PREF_ROSTER_BY:
+        return "presence";
+    case PREF_ROSTER_COUNT:
+        return "unread";
+    case PREF_ROSTER_ORDER:
+        return "presence";
+    case PREF_ROSTER_UNREAD:
+        return "after";
+    case PREF_ROSTER_ROOMS_POS:
+        return "last";
+    case PREF_ROSTER_ROOMS_BY:
+        return "none";
+    case PREF_ROSTER_ROOMS_USE_AS_NAME:
+        return "name";
+    case PREF_ROSTER_ROOMS_ORDER:
+        return "name";
+    case PREF_ROSTER_ROOMS_UNREAD:
+        return "after";
+    case PREF_ROSTER_PRIVATE:
+        return "room";
+    case PREF_TIME_CONSOLE:
+        return "%H:%M:%S";
+    case PREF_TIME_CHAT:
+        return "%H:%M:%S";
+    case PREF_TIME_MUC:
+        return "%H:%M:%S";
+    case PREF_TIME_CONFIG:
+        return "%H:%M:%S";
+    case PREF_TIME_PRIVATE:
+        return "%H:%M:%S";
+    case PREF_TIME_XMLCONSOLE:
+        return "%H:%M:%S";
+    case PREF_TIME_STATUSBAR:
+        return "%H:%M";
+    case PREF_TIME_LASTACTIVITY:
+        return "%d/%m/%y %H:%M:%S";
+    case PREF_PGP_LOG:
+        return "redact";
+    case PREF_CONSOLE_MUC:
+    case PREF_CONSOLE_PRIVATE:
+    case PREF_CONSOLE_CHAT:
+        return "all";
+    case PREF_STATUSBAR_SELF:
+        return "fulljid";
+    case PREF_STATUSBAR_CHAT:
+        return "user";
+    case PREF_STATUSBAR_ROOM:
+        return "room";
+    case PREF_OMEMO_LOG:
+        return "redact";
+    case PREF_OMEMO_POLICY:
+        return "automatic";
+    case PREF_COLOR_NICK:
+        return "false";
+    case PREF_AVATAR_CMD:
+        return "xdg-open";
+    case PREF_URL_SAVE_CMD:
+        return "curl -o %p %u";
+    default:
+        return NULL;
     }
 }
 
@@ -2345,16 +2342,15 @@ _get_default_string(preference_t pref)
 static char**
 _get_default_string_list(preference_t pref)
 {
-    char **str_array = NULL;
+    char** str_array = NULL;
 
-    switch (pref)
-    {
-        case PREF_URL_OPEN_CMD:
-            str_array = g_malloc0(3);
-            str_array[0] = g_strdup("false");
-            str_array[1] = g_strdup("xdg-open %u");
-            return str_array;
-        default:
-            return NULL;
+    switch (pref) {
+    case PREF_URL_OPEN_CMD:
+        str_array = g_malloc0(3);
+        str_array[0] = g_strdup("false");
+        str_array[1] = g_strdup("xdg-open %u");
+        return str_array;
+    default:
+        return NULL;
     }
 }
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 686b9380..a9261853 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -175,30 +175,32 @@ typedef enum {
     PREF_URL_SAVE_CMD,
 } preference_t;
 
-typedef struct prof_alias_t {
-    gchar *name;
-    gchar *value;
+typedef struct prof_alias_t
+{
+    gchar* name;
+    gchar* value;
 } ProfAlias;
 
-typedef struct prof_winplacement_t {
+typedef struct prof_winplacement_t
+{
     int titlebar_pos;
     int mainwin_pos;
     int statusbar_pos;
     int inputwin_pos;
 } ProfWinPlacement;
 
-void prefs_load(char *config_file);
+void prefs_load(char* config_file);
 void prefs_save(void);
 void prefs_close(void);
 void prefs_reload(void);
 
-char* prefs_find_login(char *prefix);
+char* prefs_find_login(char* prefix);
 void prefs_reset_login_search(void);
 
-char* prefs_autocomplete_boolean_choice(const char *const prefix, gboolean previous, void *context);
+char* prefs_autocomplete_boolean_choice(const char* const prefix, gboolean previous, void* context);
 void prefs_reset_boolean_choice(void);
 
-char* prefs_autocomplete_room_trigger(const char *const prefix, gboolean previous, void *context);
+char* prefs_autocomplete_room_trigger(const char* const prefix, gboolean previous, void* context);
 void prefs_reset_room_trigger_ac(void);
 
 gint prefs_get_gone(void);
@@ -235,19 +237,19 @@ gint prefs_get_autoxa_time(void);
 void prefs_set_autoxa_time(gint value);
 
 gchar** prefs_get_plugins(void);
-void prefs_free_plugins(gchar **plugins);
-void prefs_add_plugin(const char *const name);
-void prefs_remove_plugin(const char *const name);
+void prefs_free_plugins(gchar** plugins);
+void prefs_add_plugin(const char* const name);
+void prefs_remove_plugin(const char* const name);
 
 char* prefs_get_otr_char(void);
-gboolean prefs_set_otr_char(char *ch);
+gboolean prefs_set_otr_char(char* ch);
 char* prefs_get_pgp_char(void);
-gboolean prefs_set_pgp_char(char *ch);
+gboolean prefs_set_pgp_char(char* ch);
 char* prefs_get_omemo_char(void);
-gboolean prefs_set_omemo_char(char *ch);
+gboolean prefs_set_omemo_char(char* ch);
 // XEP-0373: OpenPGP for XMPP
 char* prefs_get_ox_char(void);
-gboolean prefs_set_ox_char(char *ch);
+gboolean prefs_set_ox_char(char* ch);
 
 char prefs_get_roster_header_char(void);
 void prefs_set_roster_header_char(char ch);
@@ -286,23 +288,23 @@ void prefs_set_occupants_indent(gint value);
 char* prefs_get_correction_char(void);
 void prefs_set_correction_char(char ch);
 
-void prefs_add_login(const char *jid);
+void prefs_add_login(const char* jid);
 
 void prefs_set_tray_timer(gint value);
 gint prefs_get_tray_timer(void);
 
-gboolean prefs_add_alias(const char *const name, const char *const value);
-gboolean prefs_remove_alias(const char *const name);
-char* prefs_get_alias(const char *const name);
+gboolean prefs_add_alias(const char* const name, const char* const value);
+gboolean prefs_remove_alias(const char* const name);
+char* prefs_get_alias(const char* const name);
 GList* prefs_get_aliases(void);
-void prefs_free_aliases(GList *aliases);
+void prefs_free_aliases(GList* aliases);
 
-gboolean prefs_add_room_notify_trigger(const char * const text);
-gboolean prefs_remove_room_notify_trigger(const char * const text);
+gboolean prefs_add_room_notify_trigger(const char* const text);
+gboolean prefs_remove_room_notify_trigger(const char* const text);
 GList* prefs_get_room_notify_triggers(void);
 
 ProfWinPlacement* prefs_get_win_placement(void);
-void prefs_free_win_placement(ProfWinPlacement *placement);
+void prefs_free_win_placement(ProfWinPlacement* placement);
 
 gboolean prefs_titlebar_pos_up(void);
 gboolean prefs_titlebar_pos_down(void);
@@ -313,35 +315,35 @@ gboolean prefs_statusbar_pos_down(void);
 gboolean prefs_inputwin_pos_up(void);
 gboolean prefs_inputwin_pos_down(void);
 ProfWinPlacement* prefs_create_profwin_placement(int titlebar, int mainwin, int statusbar, int inputwin);
-void prefs_save_win_placement(ProfWinPlacement *placement);
+void prefs_save_win_placement(ProfWinPlacement* placement);
 
 gboolean prefs_get_boolean(preference_t pref);
 void prefs_set_boolean(preference_t pref, gboolean value);
 char* prefs_get_string(preference_t pref);
-char* prefs_get_string_with_option(preference_t pref, gchar *option);
-gchar **prefs_get_string_list_with_option(preference_t pref, gchar *option);
-void prefs_set_string(preference_t pref, char *value);
-void prefs_set_string_with_option(preference_t pref, char *option, char *value);
-void prefs_set_string_list_with_option(preference_t pref, char *option, const gchar* const *values);
+char* prefs_get_string_with_option(preference_t pref, gchar* option);
+gchar** prefs_get_string_list_with_option(preference_t pref, gchar* option);
+void prefs_set_string(preference_t pref, char* value);
+void prefs_set_string_with_option(preference_t pref, char* option, char* value);
+void prefs_set_string_list_with_option(preference_t pref, char* option, const gchar* const* values);
 
 char* prefs_get_tls_certpath(void);
 
 gboolean prefs_do_chat_notify(gboolean current_win);
-gboolean prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char *const mynick,
-    const char *const theirnick, const char *const message, gboolean mention, gboolean trigger_found);
-gboolean prefs_do_room_notify_mention(const char *const roomjid, int unread, gboolean mention, gboolean trigger);
-GList* prefs_message_get_triggers(const char *const message);
-
-void prefs_set_room_notify(const char *const roomjid, gboolean value);
-void prefs_set_room_notify_mention(const char *const roomjid, gboolean value);
-void prefs_set_room_notify_trigger(const char *const roomjid, gboolean value);
-gboolean prefs_reset_room_notify(const char *const roomjid);
-gboolean prefs_has_room_notify(const char *const roomjid);
-gboolean prefs_has_room_notify_mention(const char *const roomjid);
-gboolean prefs_has_room_notify_trigger(const char *const roomjid);
-gboolean prefs_get_room_notify(const char *const roomjid);
-gboolean prefs_get_room_notify_mention(const char *const roomjid);
-gboolean prefs_get_room_notify_trigger(const char *const roomjid);
+gboolean prefs_do_room_notify(gboolean current_win, const char* const roomjid, const char* const mynick,
+                              const char* const theirnick, const char* const message, gboolean mention, gboolean trigger_found);
+gboolean prefs_do_room_notify_mention(const char* const roomjid, int unread, gboolean mention, gboolean trigger);
+GList* prefs_message_get_triggers(const char* const message);
+
+void prefs_set_room_notify(const char* const roomjid, gboolean value);
+void prefs_set_room_notify_mention(const char* const roomjid, gboolean value);
+void prefs_set_room_notify_trigger(const char* const roomjid, gboolean value);
+gboolean prefs_reset_room_notify(const char* const roomjid);
+gboolean prefs_has_room_notify(const char* const roomjid);
+gboolean prefs_has_room_notify_mention(const char* const roomjid);
+gboolean prefs_has_room_notify_trigger(const char* const roomjid);
+gboolean prefs_get_room_notify(const char* const roomjid);
+gboolean prefs_get_room_notify_mention(const char* const roomjid);
+gboolean prefs_get_room_notify_trigger(const char* const roomjid);
 
 gchar* prefs_get_inputrc(void);
 
diff --git a/src/config/scripts.c b/src/config/scripts.c
index 81115aec..ec34fdaf 100644
--- a/src/config/scripts.c
+++ b/src/config/scripts.c
@@ -52,13 +52,13 @@
 void
 scripts_init(void)
 {
-    char *scriptsdir = files_get_data_path(DIR_SCRIPTS);
+    char* scriptsdir = files_get_data_path(DIR_SCRIPTS);
 
     // mkdir if doesn't exist
     errno = 0;
     int res = g_mkdir_with_parents(scriptsdir, S_IRWXU);
     if (res == -1) {
-        char *errmsg = strerror(errno);
+        char* errmsg = strerror(errno);
         if (errmsg) {
             log_error("Error creating directory: %s, %s", scriptsdir, errmsg);
         } else {
@@ -72,14 +72,14 @@ scripts_init(void)
 GSList*
 scripts_list(void)
 {
-    char *scriptsdir = files_get_data_path(DIR_SCRIPTS);
+    char* scriptsdir = files_get_data_path(DIR_SCRIPTS);
 
-    GSList *result = NULL;
-    GDir *scripts = g_dir_open(scriptsdir, 0, NULL);
+    GSList* result = NULL;
+    GDir* scripts = g_dir_open(scriptsdir, 0, NULL);
     free(scriptsdir);
 
     if (scripts) {
-        const gchar *script = g_dir_read_name(scripts);
+        const gchar* script = g_dir_read_name(scripts);
         while (script) {
             result = g_slist_append(result, strdup(script));
             script = g_dir_read_name(scripts);
@@ -91,15 +91,15 @@ scripts_list(void)
 }
 
 GSList*
-scripts_read(const char *const script)
+scripts_read(const char* const script)
 {
-    char *scriptsdir = files_get_data_path(DIR_SCRIPTS);
-    GString *scriptpath = g_string_new(scriptsdir);
+    char* scriptsdir = files_get_data_path(DIR_SCRIPTS);
+    GString* scriptpath = g_string_new(scriptsdir);
     free(scriptsdir);
     g_string_append(scriptpath, "/");
     g_string_append(scriptpath, script);
 
-    FILE *scriptfile = g_fopen(scriptpath->str, "r");
+    FILE* scriptfile = g_fopen(scriptpath->str, "r");
     if (!scriptfile) {
         log_info("Script not found: %s", scriptpath->str);
         g_string_free(scriptpath, TRUE);
@@ -108,35 +108,36 @@ scripts_read(const char *const script)
 
     g_string_free(scriptpath, TRUE);
 
-    char *line = NULL;
+    char* line = NULL;
     size_t len = 0;
     ssize_t read;
-    GSList *result = NULL;
+    GSList* result = NULL;
 
     while ((read = getline(&line, &len, scriptfile)) != -1) {
         if (g_str_has_suffix(line, "\n")) {
-            result = g_slist_append(result, g_strndup(line, strlen(line) -1));
+            result = g_slist_append(result, g_strndup(line, strlen(line) - 1));
         } else {
             result = g_slist_append(result, strdup(line));
         }
     }
 
     fclose(scriptfile);
-    if (line) free(line);
+    if (line)
+        free(line);
 
     return result;
 }
 
 gboolean
-scripts_exec(const char *const script)
+scripts_exec(const char* const script)
 {
-    char *scriptsdir = files_get_data_path(DIR_SCRIPTS);
-    GString *scriptpath = g_string_new(scriptsdir);
+    char* scriptsdir = files_get_data_path(DIR_SCRIPTS);
+    GString* scriptpath = g_string_new(scriptsdir);
     free(scriptsdir);
     g_string_append(scriptpath, "/");
     g_string_append(scriptpath, script);
 
-    FILE *scriptfile = g_fopen(scriptpath->str, "r");
+    FILE* scriptfile = g_fopen(scriptpath->str, "r");
     if (!scriptfile) {
         log_info("Script not found: %s", scriptpath->str);
         g_string_free(scriptpath, TRUE);
@@ -145,20 +146,20 @@ scripts_exec(const char *const script)
 
     g_string_free(scriptpath, TRUE);
 
-    char *line = NULL;
+    char* line = NULL;
     size_t len = 0;
     ssize_t read;
 
     while ((read = getline(&line, &len, scriptfile)) != -1) {
-        ProfWin *win = wins_get_current();
+        ProfWin* win = wins_get_current();
         cmd_process_input(win, line);
         session_process_events();
         ui_update();
     }
 
     fclose(scriptfile);
-    if (line) free(line);
+    if (line)
+        free(line);
 
     return TRUE;
 }
-
diff --git a/src/config/scripts.h b/src/config/scripts.h
index 887dc897..5d99e275 100644
--- a/src/config/scripts.h
+++ b/src/config/scripts.h
@@ -40,7 +40,7 @@
 
 void scripts_init(void);
 GSList* scripts_list(void);
-GSList* scripts_read(const char *const script);
-gboolean scripts_exec(const char *const script);
+GSList* scripts_read(const char* const script);
+gboolean scripts_exec(const char* const script);
 
 #endif
diff --git a/src/config/theme.c b/src/config/theme.c
index 6432e386..147b31c2 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -54,18 +54,18 @@
 #include "config/preferences.h"
 #include "config/color.h"
 
-static GString *theme_loc;
-static GKeyFile *theme;
-static GHashTable *bold_items;
-static GHashTable *defaults;
+static GString* theme_loc;
+static GKeyFile* theme;
+static GHashTable* bold_items;
+static GHashTable* defaults;
 
 static void _load_preferences(void);
-static void _theme_list_dir(const gchar *const dir, GSList **result);
-static GString* _theme_find(const char *const theme_name);
-static gboolean _theme_load_file(const char *const theme_name);
+static void _theme_list_dir(const gchar* const dir, GSList** result);
+static GString* _theme_find(const char* const theme_name);
+static gboolean _theme_load_file(const char* const theme_name);
 
 void
-theme_init(const char *const theme_name)
+theme_init(const char* const theme_name)
 {
     if (!_theme_load_file(theme_name)) {
         log_error("Loading theme %s failed.", theme_name);
@@ -78,98 +78,98 @@ theme_init(const char *const theme_name)
     defaults = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
 
     // Set default colors
-    g_hash_table_insert(defaults, strdup("main.text"),               strdup("default"));
-    g_hash_table_insert(defaults, strdup("main.text.history"),       strdup("default"));
-    g_hash_table_insert(defaults, strdup("main.text.me"),            strdup("default"));
-    g_hash_table_insert(defaults, strdup("main.text.them"),          strdup("default"));
-    g_hash_table_insert(defaults, strdup("main.splash"),             strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("main.help.header"),        strdup("default"));
-    g_hash_table_insert(defaults, strdup("error"),                   strdup("red"));
-    g_hash_table_insert(defaults, strdup("incoming"),                strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("mention"),                 strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("trigger"),                 strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("input.text"),              strdup("default"));
-    g_hash_table_insert(defaults, strdup("main.time"),               strdup("default"));
-    g_hash_table_insert(defaults, strdup("titlebar.text"),           strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.brackets"),       strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("titlebar.unencrypted"),    strdup("red"));
-    g_hash_table_insert(defaults, strdup("titlebar.encrypted"),      strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.untrusted"),      strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("titlebar.trusted"),        strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.online"),         strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.offline"),        strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.away"),           strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.chat"),           strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.dnd"),            strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.xa"),             strdup("white"));
-    g_hash_table_insert(defaults, strdup("titlebar.scrolled"),       strdup("default"));
-    g_hash_table_insert(defaults, strdup("statusbar.text"),          strdup("white"));
-    g_hash_table_insert(defaults, strdup("statusbar.brackets"),      strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("statusbar.active"),        strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("statusbar.current"),       strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("statusbar.new"),           strdup("white"));
-    g_hash_table_insert(defaults, strdup("statusbar.time"),          strdup("white"));
-    g_hash_table_insert(defaults, strdup("me"),                      strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("them"),                    strdup("green"));
-    g_hash_table_insert(defaults, strdup("receipt.sent"),            strdup("red"));
-    g_hash_table_insert(defaults, strdup("roominfo"),                strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("roommention"),             strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("roommention.term"),        strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("roomtrigger"),             strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("roomtrigger.term"),        strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("online"),                  strdup("green"));
-    g_hash_table_insert(defaults, strdup("offline"),                 strdup("red"));
-    g_hash_table_insert(defaults, strdup("away"),                    strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("chat"),                    strdup("green"));
-    g_hash_table_insert(defaults, strdup("dnd"),                     strdup("red"));
-    g_hash_table_insert(defaults, strdup("xa"),                      strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("typing"),                  strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("gone"),                    strdup("red"));
-    g_hash_table_insert(defaults, strdup("subscribed"),              strdup("green"));
-    g_hash_table_insert(defaults, strdup("unsubscribed"),            strdup("red"));
-    g_hash_table_insert(defaults, strdup("otr.started.trusted"),     strdup("green"));
-    g_hash_table_insert(defaults, strdup("otr.started.untrusted"),   strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("otr.ended"),               strdup("red"));
-    g_hash_table_insert(defaults, strdup("otr.trusted"),             strdup("green"));
-    g_hash_table_insert(defaults, strdup("otr.untrusted"),           strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("roster.header"),           strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("roster.online"),           strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.offline"),          strdup("red"));
-    g_hash_table_insert(defaults, strdup("roster.chat"),             strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.away"),             strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("roster.dnd"),              strdup("red"));
-    g_hash_table_insert(defaults, strdup("roster.xa"),               strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("roster.online.active"),    strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.offline.active"),   strdup("red"));
-    g_hash_table_insert(defaults, strdup("roster.chat.active"),      strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.away.active"),      strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("roster.dnd.active"),       strdup("red"));
-    g_hash_table_insert(defaults, strdup("roster.xa.active"),        strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("roster.online.unread"),    strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.offline.unread"),   strdup("red"));
-    g_hash_table_insert(defaults, strdup("roster.chat.unread"),      strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.away.unread"),      strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("roster.dnd.unread"),       strdup("red"));
-    g_hash_table_insert(defaults, strdup("roster.xa.unread"),        strdup("cyan"));
-    g_hash_table_insert(defaults, strdup("roster.room"),             strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.room.unread"),      strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.room.trigger"),     strdup("green"));
-    g_hash_table_insert(defaults, strdup("roster.room.mention"),     strdup("green"));
-    g_hash_table_insert(defaults, strdup("occupants.header"),        strdup("yellow"));
-    g_hash_table_insert(defaults, strdup("untrusted"),               strdup("red"));
-    g_hash_table_insert(defaults, strdup("cmd.wins.unread"),         strdup("default"));
+    g_hash_table_insert(defaults, strdup("main.text"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("main.text.history"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("main.text.me"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("main.text.them"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("main.splash"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("main.help.header"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("error"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("incoming"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("mention"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("trigger"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("input.text"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("main.time"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("titlebar.text"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.brackets"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("titlebar.unencrypted"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("titlebar.encrypted"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.untrusted"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("titlebar.trusted"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.online"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.offline"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.away"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.chat"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.dnd"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.xa"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("titlebar.scrolled"), strdup("default"));
+    g_hash_table_insert(defaults, strdup("statusbar.text"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("statusbar.brackets"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("statusbar.active"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("statusbar.current"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("statusbar.new"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("statusbar.time"), strdup("white"));
+    g_hash_table_insert(defaults, strdup("me"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("them"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roominfo"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("roommention"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("roommention.term"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("roomtrigger"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("roomtrigger.term"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("online"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("offline"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("away"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("chat"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("dnd"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("xa"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("typing"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("gone"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("subscribed"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("unsubscribed"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("otr.started.trusted"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("otr.started.untrusted"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("otr.ended"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("otr.trusted"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("otr.untrusted"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("roster.header"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("roster.online"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.offline"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roster.chat"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.away"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("roster.dnd"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roster.xa"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("roster.online.active"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.offline.active"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roster.chat.active"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.away.active"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("roster.dnd.active"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roster.xa.active"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("roster.online.unread"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.offline.unread"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roster.chat.unread"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.away.unread"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("roster.dnd.unread"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("roster.xa.unread"), strdup("cyan"));
+    g_hash_table_insert(defaults, strdup("roster.room"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.room.unread"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.room.trigger"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("roster.room.mention"), strdup("green"));
+    g_hash_table_insert(defaults, strdup("occupants.header"), strdup("yellow"));
+    g_hash_table_insert(defaults, strdup("untrusted"), strdup("red"));
+    g_hash_table_insert(defaults, strdup("cmd.wins.unread"), strdup("default"));
 
     //_load_preferences();
 }
 
 gboolean
-theme_exists(const char *const theme_name)
+theme_exists(const char* const theme_name)
 {
     if (g_strcmp0(theme_name, "default") == 0) {
         return TRUE;
     }
 
-    GString *new_theme_file = _theme_find(theme_name);
+    GString* new_theme_file = _theme_find(theme_name);
     if (new_theme_file == NULL) {
         return FALSE;
     }
@@ -179,7 +179,7 @@ theme_exists(const char *const theme_name)
 }
 
 gboolean
-theme_load(const char *const theme_name, gboolean load_theme_prefs)
+theme_load(const char* const theme_name, gboolean load_theme_prefs)
 {
     color_pair_cache_reset();
 
@@ -194,7 +194,7 @@ theme_load(const char *const theme_name, gboolean load_theme_prefs)
 }
 
 static gboolean
-_theme_load_file(const char *const theme_name)
+_theme_load_file(const char* const theme_name)
 {
     // use default theme
     if (theme_name == NULL || strcmp(theme_name, "default") == 0) {
@@ -203,9 +203,9 @@ _theme_load_file(const char *const theme_name)
         }
         theme = g_key_file_new();
 
-    // load theme from file
+        // load theme from file
     } else {
-        GString *new_theme_file = _theme_find(theme_name);
+        GString* new_theme_file = _theme_find(theme_name);
         if (new_theme_file == NULL) {
             log_info("Theme does not exist \"%s\"", theme_name);
             return FALSE;
@@ -221,7 +221,7 @@ _theme_load_file(const char *const theme_name)
         }
         theme = g_key_file_new();
         g_key_file_load_from_file(theme, theme_loc->str, G_KEY_FILE_KEEP_COMMENTS,
-            NULL);
+                                  NULL);
     }
 
     return TRUE;
@@ -230,8 +230,8 @@ _theme_load_file(const char *const theme_name)
 GSList*
 theme_list(void)
 {
-    GSList *result = NULL;
-    gchar *themes_dir = files_get_config_path(DIR_THEMES);
+    GSList* result = NULL;
+    gchar* themes_dir = files_get_config_path(DIR_THEMES);
 
     _theme_list_dir(themes_dir, &result);
     g_free(themes_dir);
@@ -272,17 +272,17 @@ theme_init_colours(void)
 }
 
 static void
-_set_string_preference(char *prefstr, preference_t pref)
+_set_string_preference(char* prefstr, preference_t pref)
 {
     if (g_key_file_has_key(theme, "ui", prefstr, NULL)) {
-        gchar *val = g_key_file_get_string(theme, "ui", prefstr, NULL);
+        gchar* val = g_key_file_get_string(theme, "ui", prefstr, NULL);
         prefs_set_string(pref, val);
         g_free(val);
     }
 }
 
 static void
-_set_boolean_preference(char *prefstr, preference_t pref)
+_set_boolean_preference(char* prefstr, preference_t pref)
 {
     if (g_key_file_has_key(theme, "ui", prefstr, NULL)) {
         gboolean val = g_key_file_get_boolean(theme, "ui", prefstr, NULL);
@@ -401,7 +401,7 @@ _load_preferences(void)
     // load chars from theme and set them to prefs
     // with custom set functions
     if (g_key_file_has_key(theme, "ui", "occupants.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "occupants.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "occupants.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_occupants_char(ch[0]);
             g_free(ch);
@@ -409,7 +409,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "occupants.header.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "occupants.header.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "occupants.header.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_occupants_header_char(ch[0]);
             g_free(ch);
@@ -417,7 +417,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "roster.header.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "roster.header.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "roster.header.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_roster_header_char(ch[0]);
             g_free(ch);
@@ -425,7 +425,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "roster.contact.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "roster.contact.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "roster.contact.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_roster_contact_char(ch[0]);
             g_free(ch);
@@ -433,7 +433,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "roster.resource.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "roster.resource.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "roster.resource.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_roster_resource_char(ch[0]);
             g_free(ch);
@@ -443,7 +443,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "roster.rooms.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "roster.rooms.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "roster.rooms.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_roster_room_char(ch[0]);
             g_free(ch);
@@ -451,7 +451,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "roster.rooms.private.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "roster.rooms.private.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "roster.rooms.private.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_roster_room_private_char(ch[0]);
             g_free(ch);
@@ -459,7 +459,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "roster.private.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "roster.private.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "roster.private.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_roster_private_char(ch[0]);
             g_free(ch);
@@ -467,7 +467,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "otr.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "otr.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "otr.char", NULL);
         if (ch && g_utf8_strlen(ch, 4) == 1) {
             prefs_set_otr_char(ch);
             g_free(ch);
@@ -475,7 +475,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "pgp.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "pgp.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "pgp.char", NULL);
         if (ch && g_utf8_strlen(ch, 4) == 1) {
             prefs_set_pgp_char(ch);
             g_free(ch);
@@ -483,7 +483,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "omemo.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "omemo.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "omemo.char", NULL);
         if (ch && g_utf8_strlen(ch, 4) == 1) {
             prefs_set_omemo_char(ch);
             g_free(ch);
@@ -491,7 +491,7 @@ _load_preferences(void)
     }
 
     if (g_key_file_has_key(theme, "ui", "correction.char", NULL)) {
-        gchar *ch = g_key_file_get_string(theme, "ui", "correction.char", NULL);
+        gchar* ch = g_key_file_get_string(theme, "ui", "correction.char", NULL);
         if (ch && strlen(ch) > 0) {
             prefs_set_correction_char(ch[0]);
             g_free(ch);
@@ -499,17 +499,14 @@ _load_preferences(void)
     }
 
     // load window positions
-    if (g_key_file_has_key(theme, "ui", "titlebar.position", NULL) &&
-            g_key_file_has_key(theme, "ui", "mainwin.position", NULL) &&
-            g_key_file_has_key(theme, "ui", "statusbar.position", NULL) &&
-            g_key_file_has_key(theme, "ui", "inputwin.position", NULL)) {
+    if (g_key_file_has_key(theme, "ui", "titlebar.position", NULL) && g_key_file_has_key(theme, "ui", "mainwin.position", NULL) && g_key_file_has_key(theme, "ui", "statusbar.position", NULL) && g_key_file_has_key(theme, "ui", "inputwin.position", NULL)) {
 
         int titlebar_pos = g_key_file_get_integer(theme, "ui", "titlebar.position", NULL);
         int mainwin_pos = g_key_file_get_integer(theme, "ui", "mainwin.position", NULL);
         int statusbar_pos = g_key_file_get_integer(theme, "ui", "statusbar.position", NULL);
         int inputwin_pos = g_key_file_get_integer(theme, "ui", "inputwin.position", NULL);
 
-        ProfWinPlacement *placement = prefs_create_profwin_placement(titlebar_pos, mainwin_pos, statusbar_pos, inputwin_pos);
+        ProfWinPlacement* placement = prefs_create_profwin_placement(titlebar_pos, mainwin_pos, statusbar_pos, inputwin_pos);
 
         prefs_save_win_placement(placement);
         prefs_free_win_placement(placement);
@@ -517,11 +514,11 @@ _load_preferences(void)
 }
 
 static void
-_theme_list_dir(const gchar *const dir, GSList **result)
+_theme_list_dir(const gchar* const dir, GSList** result)
 {
-    GDir *themes = g_dir_open(dir, 0, NULL);
+    GDir* themes = g_dir_open(dir, 0, NULL);
     if (themes) {
-        const gchar *theme = g_dir_read_name(themes);
+        const gchar* theme = g_dir_read_name(themes);
         while (theme) {
             *result = g_slist_append(*result, strdup(theme));
             theme = g_dir_read_name(themes);
@@ -531,10 +528,10 @@ _theme_list_dir(const gchar *const dir, GSList **result)
 }
 
 static GString*
-_theme_find(const char *const theme_name)
+_theme_find(const char* const theme_name)
 {
-    GString *path = NULL;
-    gchar *themes_dir = files_get_config_path(DIR_THEMES);
+    GString* path = NULL;
+    gchar* themes_dir = files_get_config_path(DIR_THEMES);
 
     if (themes_dir) {
         path = g_string_new(themes_dir);
@@ -563,7 +560,7 @@ _theme_find(const char *const theme_name)
 }
 
 theme_item_t
-theme_roster_unread_presence_attrs(const char *const presence)
+theme_roster_unread_presence_attrs(const char* const presence)
 {
     if (g_strcmp0(presence, "online") == 0) {
         return THEME_ROSTER_ONLINE_UNREAD;
@@ -581,7 +578,7 @@ theme_roster_unread_presence_attrs(const char *const presence)
 }
 
 theme_item_t
-theme_roster_active_presence_attrs(const char *const presence)
+theme_roster_active_presence_attrs(const char* const presence)
 {
     if (g_strcmp0(presence, "online") == 0) {
         return THEME_ROSTER_ONLINE_ACTIVE;
@@ -599,7 +596,7 @@ theme_roster_active_presence_attrs(const char *const presence)
 }
 
 theme_item_t
-theme_roster_presence_attrs(const char *const presence)
+theme_roster_presence_attrs(const char* const presence)
 {
     if (g_strcmp0(presence, "online") == 0) {
         return THEME_ROSTER_ONLINE;
@@ -617,7 +614,7 @@ theme_roster_presence_attrs(const char *const presence)
 }
 
 theme_item_t
-theme_main_presence_attrs(const char *const presence)
+theme_main_presence_attrs(const char* const presence)
 {
     if (g_strcmp0(presence, "online") == 0) {
         return THEME_ONLINE;
@@ -635,9 +632,9 @@ theme_main_presence_attrs(const char *const presence)
 }
 
 static void
-_theme_prep_bgnd(char *setting, char *def, GString *lookup_str)
+_theme_prep_bgnd(char* setting, char* def, GString* lookup_str)
 {
-    gchar *val = g_key_file_get_string(theme, "colours", setting, NULL);
+    gchar* val = g_key_file_get_string(theme, "colours", setting, NULL);
     if (!val) {
         g_string_append(lookup_str, def);
     } else {
@@ -654,17 +651,17 @@ _theme_prep_bgnd(char *setting, char *def, GString *lookup_str)
 char*
 theme_get_bkgnd(void)
 {
-    char *val = g_key_file_get_string(theme, "colours", "bkgnd", NULL);
+    char* val = g_key_file_get_string(theme, "colours", "bkgnd", NULL);
     return val;
 }
 
 /* gets the foreground color from the theme. or uses the one defined in 'defaults' */
 static void
-_theme_prep_fgnd(char *setting, GString *lookup_str, gboolean *bold)
+_theme_prep_fgnd(char* setting, GString* lookup_str, gboolean* bold)
 {
-    gchar *val = g_key_file_get_string(theme, "colours", setting, NULL);
+    gchar* val = g_key_file_get_string(theme, "colours", setting, NULL);
     if (!val) {
-        char *def = g_hash_table_lookup(defaults, setting);
+        char* def = g_hash_table_lookup(defaults, setting);
         g_string_append(lookup_str, def);
     } else {
         if (g_str_has_prefix(val, "bold_")) {
@@ -679,9 +676,9 @@ _theme_prep_fgnd(char *setting, GString *lookup_str, gboolean *bold)
 }
 
 char*
-theme_get_string(char *str)
+theme_get_string(char* str)
 {
-    char *res = g_key_file_get_string(theme, "colours", str, NULL);
+    char* res = g_key_file_get_string(theme, "colours", str, NULL);
     if (!res) {
         return strdup(g_hash_table_lookup(defaults, str));
     } else {
@@ -690,7 +687,7 @@ theme_get_string(char *str)
 }
 
 void
-theme_free_string(char *str)
+theme_free_string(char* str)
 {
     if (str) {
         g_free(str);
@@ -698,11 +695,11 @@ theme_free_string(char *str)
 }
 
 int
-theme_hash_attrs(const char *str)
+theme_hash_attrs(const char* str)
 {
     color_profile profile = COLOR_PROFILE_DEFAULT;
 
-    char *color_pref = prefs_get_string(PREF_COLOR_NICK);
+    char* color_pref = prefs_get_string(PREF_COLOR_NICK);
     if (strcmp(color_pref, "redgreen") == 0) {
         profile = COLOR_PROFILE_REDGREEN_BLINDNESS;
     } else if (strcmp(color_pref, "blue") == 0) {
@@ -719,109 +716,322 @@ theme_attrs(theme_item_t attrs)
 {
     int result = 0;
 
-    GString *lookup_str = g_string_new("");
+    GString* lookup_str = g_string_new("");
     gboolean bold = FALSE;
 
     // get forground colour
     switch (attrs) {
-    case THEME_TEXT:                    _theme_prep_fgnd("main.text",               lookup_str, &bold); break;
-    case THEME_TEXT_HISTORY:            _theme_prep_fgnd("main.text.history",       lookup_str, &bold); break;
-    case THEME_TEXT_ME:                 _theme_prep_fgnd("main.text.me",            lookup_str, &bold); break;
-    case THEME_TEXT_THEM:               _theme_prep_fgnd("main.text.them",          lookup_str, &bold); break;
-    case THEME_SPLASH:                  _theme_prep_fgnd("main.splash",             lookup_str, &bold); break;
-    case THEME_TRACKBAR:                _theme_prep_fgnd("main.trackbar",           lookup_str, &bold); break;
-    case THEME_HELP_HEADER:             _theme_prep_fgnd("main.help.header",        lookup_str, &bold); break;
-    case THEME_ERROR:                   _theme_prep_fgnd("error",                   lookup_str, &bold); break;
-    case THEME_INCOMING:                _theme_prep_fgnd("incoming",                lookup_str, &bold); break;
-    case THEME_MENTION:                 _theme_prep_fgnd("mention",                 lookup_str, &bold); break;
-    case THEME_TRIGGER:                 _theme_prep_fgnd("trigger",                 lookup_str, &bold); break;
-    case THEME_INPUT_TEXT:              _theme_prep_fgnd("input.text",              lookup_str, &bold); break;
-    case THEME_TIME:                    _theme_prep_fgnd("main.time",               lookup_str, &bold); break;
-    case THEME_TITLE_TEXT:              _theme_prep_fgnd("titlebar.text",           lookup_str, &bold); break;
-    case THEME_TITLE_BRACKET:           _theme_prep_fgnd("titlebar.brackets",       lookup_str, &bold); break;
-    case THEME_TITLE_SCROLLED:          _theme_prep_fgnd("titlebar.scrolled",       lookup_str, &bold); break;
-    case THEME_TITLE_UNENCRYPTED:       _theme_prep_fgnd("titlebar.unencrypted",    lookup_str, &bold); break;
-    case THEME_TITLE_ENCRYPTED:         _theme_prep_fgnd("titlebar.encrypted",      lookup_str, &bold); break;
-    case THEME_TITLE_UNTRUSTED:         _theme_prep_fgnd("titlebar.untrusted",      lookup_str, &bold); break;
-    case THEME_TITLE_TRUSTED:           _theme_prep_fgnd("titlebar.trusted",        lookup_str, &bold); break;
-    case THEME_TITLE_ONLINE:            _theme_prep_fgnd("titlebar.online",         lookup_str, &bold); break;
-    case THEME_TITLE_OFFLINE:           _theme_prep_fgnd("titlebar.offline",        lookup_str, &bold); break;
-    case THEME_TITLE_AWAY:              _theme_prep_fgnd("titlebar.away",           lookup_str, &bold); break;
-    case THEME_TITLE_CHAT:              _theme_prep_fgnd("titlebar.chat",           lookup_str, &bold); break;
-    case THEME_TITLE_DND:               _theme_prep_fgnd("titlebar.dnd",            lookup_str, &bold); break;
-    case THEME_TITLE_XA:                _theme_prep_fgnd("titlebar.xa",             lookup_str, &bold); break;
-    case THEME_STATUS_TEXT:             _theme_prep_fgnd("statusbar.text",          lookup_str, &bold); break;
-    case THEME_STATUS_BRACKET:          _theme_prep_fgnd("statusbar.brackets",      lookup_str, &bold); break;
-    case THEME_STATUS_ACTIVE:           _theme_prep_fgnd("statusbar.active",        lookup_str, &bold); break;
-    case THEME_STATUS_CURRENT:          _theme_prep_fgnd("statusbar.current",       lookup_str, &bold); break;
-    case THEME_STATUS_NEW:              _theme_prep_fgnd("statusbar.new",           lookup_str, &bold); break;
-    case THEME_STATUS_TIME:             _theme_prep_fgnd("statusbar.time",          lookup_str, &bold); break;
-    case THEME_ME:                      _theme_prep_fgnd("me",                      lookup_str, &bold); break;
-    case THEME_THEM:                    _theme_prep_fgnd("them",                    lookup_str, &bold); break;
-    case THEME_RECEIPT_SENT:            _theme_prep_fgnd("receipt.sent",            lookup_str, &bold); break;
-    case THEME_ROOMINFO:                _theme_prep_fgnd("roominfo",                lookup_str, &bold); break;
-    case THEME_ROOMMENTION:             _theme_prep_fgnd("roommention",             lookup_str, &bold); break;
-    case THEME_ROOMMENTION_TERM:        _theme_prep_fgnd("roommention.term",        lookup_str, &bold); break;
-    case THEME_ROOMTRIGGER:             _theme_prep_fgnd("roomtrigger",             lookup_str, &bold); break;
-    case THEME_ROOMTRIGGER_TERM:        _theme_prep_fgnd("roomtrigger.term",        lookup_str, &bold); break;
-    case THEME_ONLINE:                  _theme_prep_fgnd("online",                  lookup_str, &bold); break;
-    case THEME_OFFLINE:                 _theme_prep_fgnd("offline",                 lookup_str, &bold); break;
-    case THEME_AWAY:                    _theme_prep_fgnd("away",                    lookup_str, &bold); break;
-    case THEME_CHAT:                    _theme_prep_fgnd("chat",                    lookup_str, &bold); break;
-    case THEME_DND:                     _theme_prep_fgnd("dnd",                     lookup_str, &bold); break;
-    case THEME_XA:                      _theme_prep_fgnd("xa",                      lookup_str, &bold); break;
-    case THEME_TYPING:                  _theme_prep_fgnd("typing",                  lookup_str, &bold); break;
-    case THEME_GONE:                    _theme_prep_fgnd("gone",                    lookup_str, &bold); break;
-    case THEME_SUBSCRIBED:              _theme_prep_fgnd("subscribed",              lookup_str, &bold); break;
-    case THEME_UNSUBSCRIBED:            _theme_prep_fgnd("unsubscribed",            lookup_str, &bold); break;
-    case THEME_OTR_STARTED_TRUSTED:     _theme_prep_fgnd("otr.started.trusted",     lookup_str, &bold); break;
-    case THEME_OTR_STARTED_UNTRUSTED:   _theme_prep_fgnd("otr.started.untrusted",   lookup_str, &bold); break;
-    case THEME_OTR_ENDED:               _theme_prep_fgnd("otr.ended",               lookup_str, &bold); break;
-    case THEME_OTR_TRUSTED:             _theme_prep_fgnd("otr.trusted",             lookup_str, &bold); break;
-    case THEME_OTR_UNTRUSTED:           _theme_prep_fgnd("otr.untrusted",           lookup_str, &bold); break;
-    case THEME_ROSTER_HEADER:           _theme_prep_fgnd("roster.header",           lookup_str, &bold); break;
-    case THEME_ROSTER_ONLINE:           _theme_prep_fgnd("roster.online",           lookup_str, &bold); break;
-    case THEME_ROSTER_OFFLINE:          _theme_prep_fgnd("roster.offline",          lookup_str, &bold); break;
-    case THEME_ROSTER_CHAT:             _theme_prep_fgnd("roster.chat",             lookup_str, &bold); break;
-    case THEME_ROSTER_AWAY:             _theme_prep_fgnd("roster.away",             lookup_str, &bold); break;
-    case THEME_ROSTER_DND:              _theme_prep_fgnd("roster.dnd",              lookup_str, &bold); break;
-    case THEME_ROSTER_XA:               _theme_prep_fgnd("roster.xa",               lookup_str, &bold); break;
-    case THEME_ROSTER_ONLINE_ACTIVE:    _theme_prep_fgnd("roster.online.active",    lookup_str, &bold); break;
-    case THEME_ROSTER_OFFLINE_ACTIVE:   _theme_prep_fgnd("roster.offline.active",   lookup_str, &bold); break;
-    case THEME_ROSTER_CHAT_ACTIVE:      _theme_prep_fgnd("roster.chat.active",      lookup_str, &bold); break;
-    case THEME_ROSTER_AWAY_ACTIVE:      _theme_prep_fgnd("roster.away.active",      lookup_str, &bold); break;
-    case THEME_ROSTER_DND_ACTIVE:       _theme_prep_fgnd("roster.dnd.active",       lookup_str, &bold); break;
-    case THEME_ROSTER_XA_ACTIVE:        _theme_prep_fgnd("roster.xa.active",        lookup_str, &bold); break;
-    case THEME_ROSTER_ONLINE_UNREAD:    _theme_prep_fgnd("roster.online.unread",    lookup_str, &bold); break;
-    case THEME_ROSTER_OFFLINE_UNREAD:   _theme_prep_fgnd("roster.offline.unread",   lookup_str, &bold); break;
-    case THEME_ROSTER_CHAT_UNREAD:      _theme_prep_fgnd("roster.chat.unread",      lookup_str, &bold); break;
-    case THEME_ROSTER_AWAY_UNREAD:      _theme_prep_fgnd("roster.away.unread",      lookup_str, &bold); break;
-    case THEME_ROSTER_DND_UNREAD:       _theme_prep_fgnd("roster.dnd.unread",       lookup_str, &bold); break;
-    case THEME_ROSTER_XA_UNREAD:        _theme_prep_fgnd("roster.xa.unread",        lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM:             _theme_prep_fgnd("roster.room",             lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM_UNREAD:      _theme_prep_fgnd("roster.room.unread",      lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM_TRIGGER:     _theme_prep_fgnd("roster.room.trigger",     lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM_MENTION:     _theme_prep_fgnd("roster.room.mention",     lookup_str, &bold); break;
-    case THEME_OCCUPANTS_HEADER:        _theme_prep_fgnd("occupants.header",        lookup_str, &bold); break;
-    case THEME_UNTRUSTED:               _theme_prep_fgnd("untrusted",               lookup_str, &bold); break;
-    case THEME_CMD_WINS_UNREAD:         _theme_prep_fgnd("cmd.wins.unread",         lookup_str, &bold); break;
-    case THEME_WHITE:                   g_string_append(lookup_str, "white");   bold = FALSE;   break;
-    case THEME_WHITE_BOLD:              g_string_append(lookup_str, "white");   bold = TRUE;    break;
-    case THEME_GREEN:                   g_string_append(lookup_str, "green");   bold = FALSE;   break;
-    case THEME_GREEN_BOLD:              g_string_append(lookup_str, "green");   bold = TRUE;    break;
-    case THEME_RED:                     g_string_append(lookup_str, "red");     bold = FALSE;   break;
-    case THEME_RED_BOLD:                g_string_append(lookup_str, "red");     bold = TRUE;    break;
-    case THEME_YELLOW:                  g_string_append(lookup_str, "yellow");  bold = FALSE;   break;
-    case THEME_YELLOW_BOLD:             g_string_append(lookup_str, "yellow");  bold = TRUE;    break;
-    case THEME_BLUE:                    g_string_append(lookup_str, "blue");    bold = FALSE;   break;
-    case THEME_BLUE_BOLD:               g_string_append(lookup_str, "blue");    bold = TRUE;    break;
-    case THEME_CYAN:                    g_string_append(lookup_str, "cyan");    bold = FALSE;   break;
-    case THEME_CYAN_BOLD:               g_string_append(lookup_str, "cyan");    bold = TRUE;    break;
-    case THEME_BLACK:                   g_string_append(lookup_str, "black");   bold = FALSE;   break;
-    case THEME_BLACK_BOLD:              g_string_append(lookup_str, "black");   bold = TRUE;    break;
-    case THEME_MAGENTA:                 g_string_append(lookup_str, "magenta"); bold = FALSE;   break;
-    case THEME_MAGENTA_BOLD:            g_string_append(lookup_str, "magenta"); bold = TRUE;    break;
-    default:                            g_string_append(lookup_str, "default"); bold = FALSE;   break;
+    case THEME_TEXT:
+        _theme_prep_fgnd("main.text", lookup_str, &bold);
+        break;
+    case THEME_TEXT_HISTORY:
+        _theme_prep_fgnd("main.text.history", lookup_str, &bold);
+        break;
+    case THEME_TEXT_ME:
+        _theme_prep_fgnd("main.text.me", lookup_str, &bold);
+        break;
+    case THEME_TEXT_THEM:
+        _theme_prep_fgnd("main.text.them", lookup_str, &bold);
+        break;
+    case THEME_SPLASH:
+        _theme_prep_fgnd("main.splash", lookup_str, &bold);
+        break;
+    case THEME_TRACKBAR:
+        _theme_prep_fgnd("main.trackbar", lookup_str, &bold);
+        break;
+    case THEME_HELP_HEADER:
+        _theme_prep_fgnd("main.help.header", lookup_str, &bold);
+        break;
+    case THEME_ERROR:
+        _theme_prep_fgnd("error", lookup_str, &bold);
+        break;
+    case THEME_INCOMING:
+        _theme_prep_fgnd("incoming", lookup_str, &bold);
+        break;
+    case THEME_MENTION:
+        _theme_prep_fgnd("mention", lookup_str, &bold);
+        break;
+    case THEME_TRIGGER:
+        _theme_prep_fgnd("trigger", lookup_str, &bold);
+        break;
+    case THEME_INPUT_TEXT:
+        _theme_prep_fgnd("input.text", lookup_str, &bold);
+        break;
+    case THEME_TIME:
+        _theme_prep_fgnd("main.time", lookup_str, &bold);
+        break;
+    case THEME_TITLE_TEXT:
+        _theme_prep_fgnd("titlebar.text", lookup_str, &bold);
+        break;
+    case THEME_TITLE_BRACKET:
+        _theme_prep_fgnd("titlebar.brackets", lookup_str, &bold);
+        break;
+    case THEME_TITLE_SCROLLED:
+        _theme_prep_fgnd("titlebar.scrolled", lookup_str, &bold);
+        break;
+    case THEME_TITLE_UNENCRYPTED:
+        _theme_prep_fgnd("titlebar.unencrypted", lookup_str, &bold);
+        break;
+    case THEME_TITLE_ENCRYPTED:
+        _theme_prep_fgnd("titlebar.encrypted", lookup_str, &bold);
+        break;
+    case THEME_TITLE_UNTRUSTED:
+        _theme_prep_fgnd("titlebar.untrusted", lookup_str, &bold);
+        break;
+    case THEME_TITLE_TRUSTED:
+        _theme_prep_fgnd("titlebar.trusted", lookup_str, &bold);
+        break;
+    case THEME_TITLE_ONLINE:
+        _theme_prep_fgnd("titlebar.online", lookup_str, &bold);
+        break;
+    case THEME_TITLE_OFFLINE:
+        _theme_prep_fgnd("titlebar.offline", lookup_str, &bold);
+        break;
+    case THEME_TITLE_AWAY:
+        _theme_prep_fgnd("titlebar.away", lookup_str, &bold);
+        break;
+    case THEME_TITLE_CHAT:
+        _theme_prep_fgnd("titlebar.chat", lookup_str, &bold);
+        break;
+    case THEME_TITLE_DND:
+        _theme_prep_fgnd("titlebar.dnd", lookup_str, &bold);
+        break;
+    case THEME_TITLE_XA:
+        _theme_prep_fgnd("titlebar.xa", lookup_str, &bold);
+        break;
+    case THEME_STATUS_TEXT:
+        _theme_prep_fgnd("statusbar.text", lookup_str, &bold);
+        break;
+    case THEME_STATUS_BRACKET:
+        _theme_prep_fgnd("statusbar.brackets", lookup_str, &bold);
+        break;
+    case THEME_STATUS_ACTIVE:
+        _theme_prep_fgnd("statusbar.active", lookup_str, &bold);
+        break;
+    case THEME_STATUS_CURRENT:
+        _theme_prep_fgnd("statusbar.current", lookup_str, &bold);
+        break;
+    case THEME_STATUS_NEW:
+        _theme_prep_fgnd("statusbar.new", lookup_str, &bold);
+        break;
+    case THEME_STATUS_TIME:
+        _theme_prep_fgnd("statusbar.time", lookup_str, &bold);
+        break;
+    case THEME_ME:
+        _theme_prep_fgnd("me", lookup_str, &bold);
+        break;
+    case THEME_THEM:
+        _theme_prep_fgnd("them", lookup_str, &bold);
+        break;
+    case THEME_RECEIPT_SENT:
+        _theme_prep_fgnd("receipt.sent", lookup_str, &bold);
+        break;
+    case THEME_ROOMINFO:
+        _theme_prep_fgnd("roominfo", lookup_str, &bold);
+        break;
+    case THEME_ROOMMENTION:
+        _theme_prep_fgnd("roommention", lookup_str, &bold);
+        break;
+    case THEME_ROOMMENTION_TERM:
+        _theme_prep_fgnd("roommention.term", lookup_str, &bold);
+        break;
+    case THEME_ROOMTRIGGER:
+        _theme_prep_fgnd("roomtrigger", lookup_str, &bold);
+        break;
+    case THEME_ROOMTRIGGER_TERM:
+        _theme_prep_fgnd("roomtrigger.term", lookup_str, &bold);
+        break;
+    case THEME_ONLINE:
+        _theme_prep_fgnd("online", lookup_str, &bold);
+        break;
+    case THEME_OFFLINE:
+        _theme_prep_fgnd("offline", lookup_str, &bold);
+        break;
+    case THEME_AWAY:
+        _theme_prep_fgnd("away", lookup_str, &bold);
+        break;
+    case THEME_CHAT:
+        _theme_prep_fgnd("chat", lookup_str, &bold);
+        break;
+    case THEME_DND:
+        _theme_prep_fgnd("dnd", lookup_str, &bold);
+        break;
+    case THEME_XA:
+        _theme_prep_fgnd("xa", lookup_str, &bold);
+        break;
+    case THEME_TYPING:
+        _theme_prep_fgnd("typing", lookup_str, &bold);
+        break;
+    case THEME_GONE:
+        _theme_prep_fgnd("gone", lookup_str, &bold);
+        break;
+    case THEME_SUBSCRIBED:
+        _theme_prep_fgnd("subscribed", lookup_str, &bold);
+        break;
+    case THEME_UNSUBSCRIBED:
+        _theme_prep_fgnd("unsubscribed", lookup_str, &bold);
+        break;
+    case THEME_OTR_STARTED_TRUSTED:
+        _theme_prep_fgnd("otr.started.trusted", lookup_str, &bold);
+        break;
+    case THEME_OTR_STARTED_UNTRUSTED:
+        _theme_prep_fgnd("otr.started.untrusted", lookup_str, &bold);
+        break;
+    case THEME_OTR_ENDED:
+        _theme_prep_fgnd("otr.ended", lookup_str, &bold);
+        break;
+    case THEME_OTR_TRUSTED:
+        _theme_prep_fgnd("otr.trusted", lookup_str, &bold);
+        break;
+    case THEME_OTR_UNTRUSTED:
+        _theme_prep_fgnd("otr.untrusted", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_HEADER:
+        _theme_prep_fgnd("roster.header", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ONLINE:
+        _theme_prep_fgnd("roster.online", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_OFFLINE:
+        _theme_prep_fgnd("roster.offline", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_CHAT:
+        _theme_prep_fgnd("roster.chat", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_AWAY:
+        _theme_prep_fgnd("roster.away", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_DND:
+        _theme_prep_fgnd("roster.dnd", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_XA:
+        _theme_prep_fgnd("roster.xa", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ONLINE_ACTIVE:
+        _theme_prep_fgnd("roster.online.active", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_OFFLINE_ACTIVE:
+        _theme_prep_fgnd("roster.offline.active", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_CHAT_ACTIVE:
+        _theme_prep_fgnd("roster.chat.active", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_AWAY_ACTIVE:
+        _theme_prep_fgnd("roster.away.active", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_DND_ACTIVE:
+        _theme_prep_fgnd("roster.dnd.active", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_XA_ACTIVE:
+        _theme_prep_fgnd("roster.xa.active", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ONLINE_UNREAD:
+        _theme_prep_fgnd("roster.online.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_OFFLINE_UNREAD:
+        _theme_prep_fgnd("roster.offline.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_CHAT_UNREAD:
+        _theme_prep_fgnd("roster.chat.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_AWAY_UNREAD:
+        _theme_prep_fgnd("roster.away.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_DND_UNREAD:
+        _theme_prep_fgnd("roster.dnd.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_XA_UNREAD:
+        _theme_prep_fgnd("roster.xa.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ROOM:
+        _theme_prep_fgnd("roster.room", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ROOM_UNREAD:
+        _theme_prep_fgnd("roster.room.unread", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ROOM_TRIGGER:
+        _theme_prep_fgnd("roster.room.trigger", lookup_str, &bold);
+        break;
+    case THEME_ROSTER_ROOM_MENTION:
+        _theme_prep_fgnd("roster.room.mention", lookup_str, &bold);
+        break;
+    case THEME_OCCUPANTS_HEADER:
+        _theme_prep_fgnd("occupants.header", lookup_str, &bold);
+        break;
+    case THEME_UNTRUSTED:
+        _theme_prep_fgnd("untrusted", lookup_str, &bold);
+        break;
+    case THEME_CMD_WINS_UNREAD:
+        _theme_prep_fgnd("cmd.wins.unread", lookup_str, &bold);
+        break;
+    case THEME_WHITE:
+        g_string_append(lookup_str, "white");
+        bold = FALSE;
+        break;
+    case THEME_WHITE_BOLD:
+        g_string_append(lookup_str, "white");
+        bold = TRUE;
+        break;
+    case THEME_GREEN:
+        g_string_append(lookup_str, "green");
+        bold = FALSE;
+        break;
+    case THEME_GREEN_BOLD:
+        g_string_append(lookup_str, "green");
+        bold = TRUE;
+        break;
+    case THEME_RED:
+        g_string_append(lookup_str, "red");
+        bold = FALSE;
+        break;
+    case THEME_RED_BOLD:
+        g_string_append(lookup_str, "red");
+        bold = TRUE;
+        break;
+    case THEME_YELLOW:
+        g_string_append(lookup_str, "yellow");
+        bold = FALSE;
+        break;
+    case THEME_YELLOW_BOLD:
+        g_string_append(lookup_str, "yellow");
+        bold = TRUE;
+        break;
+    case THEME_BLUE:
+        g_string_append(lookup_str, "blue");
+        bold = FALSE;
+        break;
+    case THEME_BLUE_BOLD:
+        g_string_append(lookup_str, "blue");
+        bold = TRUE;
+        break;
+    case THEME_CYAN:
+        g_string_append(lookup_str, "cyan");
+        bold = FALSE;
+        break;
+    case THEME_CYAN_BOLD:
+        g_string_append(lookup_str, "cyan");
+        bold = TRUE;
+        break;
+    case THEME_BLACK:
+        g_string_append(lookup_str, "black");
+        bold = FALSE;
+        break;
+    case THEME_BLACK_BOLD:
+        g_string_append(lookup_str, "black");
+        bold = TRUE;
+        break;
+    case THEME_MAGENTA:
+        g_string_append(lookup_str, "magenta");
+        bold = FALSE;
+        break;
+    case THEME_MAGENTA_BOLD:
+        g_string_append(lookup_str, "magenta");
+        bold = TRUE;
+        break;
+    default:
+        g_string_append(lookup_str, "default");
+        bold = FALSE;
+        break;
     }
 
     g_string_append(lookup_str, "_");
diff --git a/src/config/theme.h b/src/config/theme.h
index 86fd534e..ef076925 100644
--- a/src/config/theme.h
+++ b/src/config/theme.h
@@ -143,20 +143,20 @@ typedef enum {
     THEME_TRACKBAR,
 } theme_item_t;
 
-void theme_init(const char *const theme_name);
+void theme_init(const char* const theme_name);
 void theme_init_colours(void);
-gboolean theme_load(const char *const theme_name, gboolean load_theme_prefs);
-gboolean theme_exists(const char *const theme_name);
+gboolean theme_load(const char* const theme_name, gboolean load_theme_prefs);
+gboolean theme_exists(const char* const theme_name);
 GSList* theme_list(void);
 void theme_close(void);
-int theme_hash_attrs(const char *str);
+int theme_hash_attrs(const char* str);
 int theme_attrs(theme_item_t attrs);
-char* theme_get_string(char *str);
-void theme_free_string(char *str);
-theme_item_t theme_main_presence_attrs(const char *const presence);
-theme_item_t theme_roster_unread_presence_attrs(const char *const presence);
-theme_item_t theme_roster_active_presence_attrs(const char *const presence);
-theme_item_t theme_roster_presence_attrs(const char *const presence);
+char* theme_get_string(char* str);
+void theme_free_string(char* str);
+theme_item_t theme_main_presence_attrs(const char* const presence);
+theme_item_t theme_roster_unread_presence_attrs(const char* const presence);
+theme_item_t theme_roster_active_presence_attrs(const char* const presence);
+theme_item_t theme_roster_presence_attrs(const char* const presence);
 char* theme_get_bkgnd(void);
 
 #endif
diff --git a/src/config/tlscerts.c b/src/config/tlscerts.c
index 69c600ce..6b4d759f 100644
--- a/src/config/tlscerts.c
+++ b/src/config/tlscerts.c
@@ -45,14 +45,14 @@
 #include "config/tlscerts.h"
 #include "tools/autocomplete.h"
 
-static char *tlscerts_loc;
-static GKeyFile *tlscerts;
+static char* tlscerts_loc;
+static GKeyFile* tlscerts;
 
 static void _save_tlscerts(void);
 
 static Autocomplete certs_ac;
 
-static char *current_fp;
+static char* current_fp;
 
 void
 tlscerts_init(void)
@@ -69,7 +69,7 @@ tlscerts_init(void)
 
     certs_ac = autocomplete_new();
     gsize len = 0;
-    gchar **groups = g_key_file_get_groups(tlscerts, &len);
+    gchar** groups = g_key_file_get_groups(tlscerts, &len);
 
     int i = 0;
     for (i = 0; i < g_strv_length(groups); i++) {
@@ -81,7 +81,7 @@ tlscerts_init(void)
 }
 
 void
-tlscerts_set_current(const char *const fp)
+tlscerts_set_current(const char* const fp)
 {
     if (current_fp) {
         free(current_fp);
@@ -105,7 +105,7 @@ tlscerts_clear_current(void)
 }
 
 gboolean
-tlscerts_exists(const char *const fingerprint)
+tlscerts_exists(const char* const fingerprint)
 {
     return g_key_file_has_group(tlscerts, fingerprint);
 }
@@ -113,24 +113,24 @@ tlscerts_exists(const char *const fingerprint)
 GList*
 tlscerts_list(void)
 {
-    GList *res = NULL;
+    GList* res = NULL;
     gsize len = 0;
-    gchar **groups = g_key_file_get_groups(tlscerts, &len);
+    gchar** groups = g_key_file_get_groups(tlscerts, &len);
 
     int i = 0;
     for (i = 0; i < g_strv_length(groups); i++) {
-        char *fingerprint = strdup(groups[i]);
+        char* fingerprint = strdup(groups[i]);
         int version = g_key_file_get_integer(tlscerts, fingerprint, "version", NULL);
-        char *serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
-        char *subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
-        char *issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
-        char *notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
-        char *notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
-        char *keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
-        char *signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
+        char* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
+        char* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
+        char* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
+        char* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
+        char* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
+        char* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
+        char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
 
-        TLSCertificate *cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
-            notafter, keyalg, signaturealg);
+        TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
+                                            notafter, keyalg, signaturealg);
 
         free(fingerprint);
         free(serialnumber);
@@ -152,11 +152,11 @@ tlscerts_list(void)
 }
 
 TLSCertificate*
-tlscerts_new(const char *const fingerprint, int version, const char *const serialnumber, const char *const subjectname,
-    const char *const issuername, const char *const notbefore, const char *const notafter,
-    const char *const key_alg, const char *const signature_alg)
+tlscerts_new(const char* const fingerprint, int version, const char* const serialnumber, const char* const subjectname,
+             const char* const issuername, const char* const notbefore, const char* const notafter,
+             const char* const key_alg, const char* const signature_alg)
 {
-    TLSCertificate *cert = malloc(sizeof(TLSCertificate));
+    TLSCertificate* cert = malloc(sizeof(TLSCertificate));
 
     if (fingerprint) {
         cert->fingerprint = strdup(fingerprint);
@@ -287,7 +287,7 @@ tlscerts_new(const char *const fingerprint, int version, const char *const seria
 }
 
 void
-tlscerts_add(TLSCertificate *cert)
+tlscerts_add(TLSCertificate* cert)
 {
     if (!cert) {
         return;
@@ -326,9 +326,9 @@ tlscerts_add(TLSCertificate *cert)
 }
 
 gboolean
-tlscerts_revoke(const char *const fingerprint)
+tlscerts_revoke(const char* const fingerprint)
 {
-    gboolean result =  g_key_file_remove_group(tlscerts, fingerprint, NULL);
+    gboolean result = g_key_file_remove_group(tlscerts, fingerprint, NULL);
     if (result) {
         autocomplete_remove(certs_ac, fingerprint);
     }
@@ -339,23 +339,23 @@ tlscerts_revoke(const char *const fingerprint)
 }
 
 TLSCertificate*
-tlscerts_get_trusted(const char * const fingerprint)
+tlscerts_get_trusted(const char* const fingerprint)
 {
     if (!g_key_file_has_group(tlscerts, fingerprint)) {
         return NULL;
     }
 
     int version = g_key_file_get_integer(tlscerts, fingerprint, "version", NULL);
-    char *serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
-    char *subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
-    char *issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
-    char *notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
-    char *notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
-    char *keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
-    char *signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
+    char* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
+    char* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
+    char* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
+    char* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
+    char* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
+    char* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
+    char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
 
-    TLSCertificate *cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
-        notafter, keyalg, signaturealg);
+    TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
+                                        notafter, keyalg, signaturealg);
 
     free(serialnumber);
     free(subjectname);
@@ -369,7 +369,7 @@ tlscerts_get_trusted(const char * const fingerprint)
 }
 
 char*
-tlscerts_complete(const char *const prefix, gboolean previous, void *context)
+tlscerts_complete(const char* const prefix, gboolean previous, void* context)
 {
     return autocomplete_complete(certs_ac, prefix, TRUE, previous);
 }
@@ -381,7 +381,7 @@ tlscerts_reset_ac(void)
 }
 
 void
-tlscerts_free(TLSCertificate *cert)
+tlscerts_free(TLSCertificate* cert)
 {
     if (cert) {
         free(cert->serialnumber);
@@ -433,7 +433,7 @@ static void
 _save_tlscerts(void)
 {
     gsize g_data_size;
-    gchar *g_tlscerts_data = g_key_file_to_data(tlscerts, &g_data_size, NULL);
+    gchar* g_tlscerts_data = g_key_file_to_data(tlscerts, &g_data_size, NULL);
     g_file_set_contents(tlscerts_loc, g_tlscerts_data, g_data_size, NULL);
     g_chmod(tlscerts_loc, S_IRUSR | S_IWUSR);
     g_free(g_tlscerts_data);
diff --git a/src/config/tlscerts.h b/src/config/tlscerts.h
index 920a8fce..ba3b6894 100644
--- a/src/config/tlscerts.h
+++ b/src/config/tlscerts.h
@@ -38,59 +38,60 @@
 
 #include <glib.h>
 
-typedef struct tls_cert_t {
+typedef struct tls_cert_t
+{
     int version;
-    char *serialnumber;
-    char *subjectname;
-    char *subject_country;
-    char *subject_state;
-    char *subject_distinguishedname;
-    char *subject_serialnumber;
-    char *subject_commonname;
-    char *subject_organisation;
-    char *subject_organisation_unit;
-    char *subject_email;
-    char *issuername;
-    char *issuer_country;
-    char *issuer_state;
-    char *issuer_distinguishedname;
-    char *issuer_serialnumber;
-    char *issuer_commonname;
-    char *issuer_organisation;
-    char *issuer_organisation_unit;
-    char *issuer_email;
-    char *notbefore;
-    char *notafter;
-    char *fingerprint;
-    char *key_alg;
-    char *signature_alg;
+    char* serialnumber;
+    char* subjectname;
+    char* subject_country;
+    char* subject_state;
+    char* subject_distinguishedname;
+    char* subject_serialnumber;
+    char* subject_commonname;
+    char* subject_organisation;
+    char* subject_organisation_unit;
+    char* subject_email;
+    char* issuername;
+    char* issuer_country;
+    char* issuer_state;
+    char* issuer_distinguishedname;
+    char* issuer_serialnumber;
+    char* issuer_commonname;
+    char* issuer_organisation;
+    char* issuer_organisation_unit;
+    char* issuer_email;
+    char* notbefore;
+    char* notafter;
+    char* fingerprint;
+    char* key_alg;
+    char* signature_alg;
 } TLSCertificate;
 
 void tlscerts_init(void);
 
-TLSCertificate* tlscerts_new(const char *const fingerprint, int version, const char *const serialnumber, const char *const subjectname,
-    const char *const issuername, const char *const notbefore, const char *const notafter,
-    const char *const key_alg, const char *const signature_alg);
+TLSCertificate* tlscerts_new(const char* const fingerprint, int version, const char* const serialnumber, const char* const subjectname,
+                             const char* const issuername, const char* const notbefore, const char* const notafter,
+                             const char* const key_alg, const char* const signature_alg);
 
-void tlscerts_set_current(const char *const fp);
+void tlscerts_set_current(const char* const fp);
 
 char* tlscerts_get_current(void);
 
 void tlscerts_clear_current(void);
 
-gboolean tlscerts_exists(const char *const fingerprint);
+gboolean tlscerts_exists(const char* const fingerprint);
 
-void tlscerts_add(TLSCertificate *cert);
+void tlscerts_add(TLSCertificate* cert);
 
-gboolean tlscerts_revoke(const char *const fingerprint);
+gboolean tlscerts_revoke(const char* const fingerprint);
 
-TLSCertificate* tlscerts_get_trusted(const char *const fingerprint);
+TLSCertificate* tlscerts_get_trusted(const char* const fingerprint);
 
-void tlscerts_free(TLSCertificate *cert);
+void tlscerts_free(TLSCertificate* cert);
 
 GList* tlscerts_list(void);
 
-char* tlscerts_complete(const char *const prefix, gboolean previous, void *context);
+char* tlscerts_complete(const char* const prefix, gboolean previous, void* context);
 
 void tlscerts_reset_ac(void);