From 83ee4a27cb04f1fc314536e72993476d59bd42a2 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Fri, 22 Oct 2021 16:29:08 +0200 Subject: Allow utf8 in roster resource char --- src/ui/console.c | 10 ++++++---- src/ui/rosterwin.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/console.c b/src/ui/console.c index d6306dcc..d86fb158 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1491,11 +1491,13 @@ cons_roster_setting(void) cons_show("Roster contact char (/roster) : none"); } - char resource_ch = prefs_get_roster_resource_char(); - if (resource_ch) - cons_show("Roster resource char (/roster) : %c", resource_ch); - else + char* resource_ch = prefs_get_roster_resource_char(); + if (resource_ch) { + cons_show("Roster resource char (/roster) : %s", resource_ch); + free(resource_ch); + } else { cons_show("Roster resource char (/roster) : none"); + } char room_ch = prefs_get_roster_room_char(); if (room_ch) diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index a3dfffba..91b8e7cc 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -317,6 +317,7 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit* layout, ProfChatWin* chatwin) char *ch = prefs_get_roster_contact_char(); if (ch) { g_string_append_printf(msg, "%s", ch); + free(ch); } char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD); @@ -379,6 +380,7 @@ _rosterwin_contact(ProfLayoutSplit* layout, PContact contact) char *ch = prefs_get_roster_contact_char(); if (ch) { g_string_append_printf(msg, "%s", ch); + free(ch); } char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD); @@ -527,9 +529,10 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde wattron(layout->subwin, theme_attrs(resource_presence_colour)); GString* msg = g_string_new(""); - char ch = prefs_get_roster_resource_char(); + char* ch = prefs_get_roster_resource_char(); if (ch) { - g_string_append_printf(msg, "%c", ch); + g_string_append_printf(msg, "%s", ch); + free(ch); } else { g_string_append(msg, " "); } @@ -590,9 +593,10 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde g_string_append(msg, " "); this_indent--; } - char ch = prefs_get_roster_resource_char(); + char* ch = prefs_get_roster_resource_char(); if (ch) { - g_string_append_printf(msg, "%c", ch); + g_string_append_printf(msg, "%s", ch); + free(ch); } g_string_append(msg, resource->name); if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) { -- cgit 1.4.1-2-gfad0