mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Allow utf8 in roster room private char
This commit is contained in:
parent
8fc359ba2d
commit
fa2881fcea
@ -2798,8 +2798,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
|
||||
cons_show("Roster room private char removed.");
|
||||
rosterwin_roster();
|
||||
} else {
|
||||
prefs_set_roster_room_private_char(args[3][0]);
|
||||
cons_show("Roster room private char set to %c.", args[3][0]);
|
||||
prefs_set_roster_room_private_char(args[3]);
|
||||
cons_show("Roster room private char set to %s.", args[3]);
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1206,30 +1206,22 @@ prefs_clear_roster_room_char(void)
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL);
|
||||
}
|
||||
|
||||
char
|
||||
char*
|
||||
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);
|
||||
if (!resultstr) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = resultstr[0];
|
||||
}
|
||||
free(resultstr);
|
||||
char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_roster_room_private_char(char ch)
|
||||
prefs_set_roster_room_private_char(char* ch)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = ch;
|
||||
str[1] = '\0';
|
||||
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", str);
|
||||
if (g_utf8_strlen(ch, 4) == 1) {
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", ch);
|
||||
} else {
|
||||
log_error("Could not set roster resource char: %s", ch);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -269,8 +269,8 @@ void prefs_clear_roster_private_char(void);
|
||||
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);
|
||||
char* prefs_get_roster_room_private_char(void);
|
||||
void prefs_set_roster_room_private_char(char* ch);
|
||||
void prefs_clear_roster_room_private_char(void);
|
||||
char prefs_get_occupants_char(void);
|
||||
void prefs_set_occupants_char(char ch);
|
||||
|
@ -456,8 +456,8 @@ _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);
|
||||
if (ch && strlen(ch) > 0) {
|
||||
prefs_set_roster_room_private_char(ch[0]);
|
||||
if (ch && g_utf8_strlen(ch, 4) == 1) {
|
||||
prefs_set_roster_room_private_char(ch);
|
||||
g_free(ch);
|
||||
}
|
||||
}
|
||||
|
@ -1507,11 +1507,13 @@ cons_roster_setting(void)
|
||||
cons_show("Roster room char (/roster) : none");
|
||||
}
|
||||
|
||||
char room_priv_ch = prefs_get_roster_room_private_char();
|
||||
if (room_priv_ch)
|
||||
char* room_priv_ch = prefs_get_roster_room_private_char();
|
||||
if (room_priv_ch) {
|
||||
cons_show("Roster room private char (/roster) : %c", room_priv_ch);
|
||||
else
|
||||
free(room_priv_ch);
|
||||
} else {
|
||||
cons_show("Roster room private char (/roster) : none");
|
||||
}
|
||||
|
||||
char* private_ch = prefs_get_roster_private_char();
|
||||
if (private_ch) {
|
||||
|
@ -857,9 +857,10 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
|
||||
g_string_append_printf(privmsg, "(%d) ", privwin->unread);
|
||||
}
|
||||
|
||||
char ch = prefs_get_roster_room_private_char();
|
||||
ch = prefs_get_roster_room_private_char();
|
||||
if (ch) {
|
||||
g_string_append_printf(privmsg, "%c", ch);
|
||||
g_string_append_printf(privmsg, "%s", ch);
|
||||
free(ch);
|
||||
}
|
||||
|
||||
char* nick = privwin->fulljid + strlen(mucwin->roomjid) + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user