mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Allow utf8 in roster rooms char
This commit is contained in:
parent
7faf15a18c
commit
8fc359ba2d
@ -2720,8 +2720,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
|
||||
cons_show("Roster room char removed.");
|
||||
rosterwin_roster();
|
||||
} else {
|
||||
prefs_set_roster_room_char(args[2][0]);
|
||||
cons_show("Roster room char set to %c.", args[2][0]);
|
||||
prefs_set_roster_room_char(args[2]);
|
||||
cons_show("Roster room char set to %s.", args[2]);
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1182,30 +1182,22 @@ prefs_clear_roster_private_char(void)
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.private.char", NULL);
|
||||
}
|
||||
|
||||
char
|
||||
char*
|
||||
prefs_get_roster_room_char(void)
|
||||
{
|
||||
char result = 0;
|
||||
|
||||
char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL);
|
||||
if (!resultstr) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = resultstr[0];
|
||||
}
|
||||
free(resultstr);
|
||||
char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_roster_room_char(char ch)
|
||||
prefs_set_roster_room_char(char* ch)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = ch;
|
||||
str[1] = '\0';
|
||||
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.char", str);
|
||||
if (g_utf8_strlen(ch, 4) == 1) {
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.char", ch);
|
||||
} else {
|
||||
log_error("Could not set roster resource char: %s", ch);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -266,8 +266,8 @@ void prefs_clear_roster_resource_char(void);
|
||||
char* prefs_get_roster_private_char(void);
|
||||
void prefs_set_roster_private_char(char* ch);
|
||||
void prefs_clear_roster_private_char(void);
|
||||
char prefs_get_roster_room_char(void);
|
||||
void prefs_set_roster_room_char(char ch);
|
||||
char* prefs_get_roster_room_char(void);
|
||||
void prefs_set_roster_room_char(char* ch);
|
||||
void prefs_clear_roster_room_char(void);
|
||||
char prefs_get_roster_room_private_char(void);
|
||||
void prefs_set_roster_room_private_char(char ch);
|
||||
|
@ -448,8 +448,8 @@ _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);
|
||||
if (ch && strlen(ch) > 0) {
|
||||
prefs_set_roster_room_char(ch[0]);
|
||||
if (ch && g_utf8_strlen(ch, 4) == 1) {
|
||||
prefs_set_roster_room_char(ch);
|
||||
g_free(ch);
|
||||
}
|
||||
}
|
||||
|
@ -1499,11 +1499,13 @@ cons_roster_setting(void)
|
||||
cons_show("Roster resource char (/roster) : none");
|
||||
}
|
||||
|
||||
char room_ch = prefs_get_roster_room_char();
|
||||
if (room_ch)
|
||||
cons_show("Roster room char (/roster) : %c", room_ch);
|
||||
else
|
||||
char* room_ch = prefs_get_roster_room_char();
|
||||
if (room_ch) {
|
||||
cons_show("Roster room char (/roster) : %s", room_ch);
|
||||
free(room_ch);
|
||||
} else {
|
||||
cons_show("Roster room char (/roster) : none");
|
||||
}
|
||||
|
||||
char room_priv_ch = prefs_get_roster_room_private_char();
|
||||
if (room_priv_ch)
|
||||
|
@ -756,9 +756,10 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
|
||||
indent--;
|
||||
}
|
||||
}
|
||||
char ch = prefs_get_roster_room_char();
|
||||
char* ch = prefs_get_roster_room_char();
|
||||
if (ch) {
|
||||
g_string_append_printf(msg, "%c", ch);
|
||||
g_string_append_printf(msg, "%s", ch);
|
||||
free(ch);
|
||||
}
|
||||
|
||||
char* unreadpos = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
|
||||
@ -856,7 +857,7 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
|
||||
g_string_append_printf(privmsg, "(%d) ", privwin->unread);
|
||||
}
|
||||
|
||||
ch = prefs_get_roster_room_private_char();
|
||||
char ch = prefs_get_roster_room_private_char();
|
||||
if (ch) {
|
||||
g_string_append_printf(privmsg, "%c", ch);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user