about summary refs log tree commit diff stats
path: root/src/config/preferences.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-04-23 13:50:58 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-04-23 14:13:03 +0200
commit566022786d458802223340dffc450529637775ca (patch)
treeb32c7ab1f26ba60835e53a805ee34580b9ccb4ed /src/config/preferences.c
parent82ddd8857846b2bdfe4cc14ebe6ea8edc4f710b2 (diff)
downloadprofani-tty-566022786d458802223340dffc450529637775ca.tar.gz
Add occupants header char
`/occupants header char` now sets a character that is displayed before
the role (moderator, visitor..) in a room. Similar to `/roster header
char` is displaying a char for the roster.

Regards https://github.com/boothj5/profanity/issues/690
Diffstat (limited to 'src/config/preferences.c')
-rw-r--r--src/config/preferences.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 30cd34c2..adc15dda 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -772,6 +772,40 @@ prefs_set_occupants_indent(gint value)
     _save_prefs();
 }
 
+char
+prefs_get_occupants_header_char(void)
+{
+    char result = 0;
+
+    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL);
+    if (!resultstr) {
+        result =  0;
+    } else {
+        result = resultstr[0];
+    }
+    free(resultstr);
+
+    return result;
+}
+
+void
+prefs_set_occupants_header_char(char ch)
+{
+    char str[2];
+    str[0] = ch;
+    str[1] = '\0';
+
+    g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.header.char", str);
+    _save_prefs();
+}
+
+void
+prefs_clear_occupants_header_char(void)
+{
+    g_key_file_remove_key(prefs, PREF_GROUP_UI, "occupants.header.char", NULL);
+    _save_prefs();
+}
+
 void
 prefs_set_roster_size(gint value)
 {