1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Merge pull request #1607 from profanity-im/utf8indicatorchar

Allow more UI indicator signs to be utf8 "characters"
This commit is contained in:
Michael Vetter 2021-10-22 17:08:14 +02:00 committed by GitHub
commit 56846a5b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 202 additions and 230 deletions

View File

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
matrix: matrix:
flavor: [debian, fedora, ubuntu] flavor: [debian, fedora]
name: Linux name: Linux
steps: steps:

View File

@ -2388,8 +2388,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("Roster header char removed."); cons_show("Roster header char removed.");
rosterwin_roster(); rosterwin_roster();
} else { } else {
prefs_set_roster_header_char(args[2][0]); prefs_set_roster_header_char(args[2]);
cons_show("Roster header char set to %c.", args[2][0]); cons_show("Roster header char set to %s.", args[2]);
rosterwin_roster(); rosterwin_roster();
} }
} else { } else {
@ -2407,8 +2407,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("Roster contact char removed."); cons_show("Roster contact char removed.");
rosterwin_roster(); rosterwin_roster();
} else { } else {
prefs_set_roster_contact_char(args[2][0]); prefs_set_roster_contact_char(args[2]);
cons_show("Roster contact char set to %c.", args[2][0]); cons_show("Roster contact char set to %s.", args[2]);
rosterwin_roster(); rosterwin_roster();
} }
} else if (g_strcmp0(args[1], "indent") == 0) { } else if (g_strcmp0(args[1], "indent") == 0) {
@ -2442,8 +2442,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("Roster resource char removed."); cons_show("Roster resource char removed.");
rosterwin_roster(); rosterwin_roster();
} else { } else {
prefs_set_roster_resource_char(args[2][0]); prefs_set_roster_resource_char(args[2]);
cons_show("Roster resource char set to %c.", args[2][0]); cons_show("Roster resource char set to %s.", args[2]);
rosterwin_roster(); rosterwin_roster();
} }
} else if (g_strcmp0(args[1], "indent") == 0) { } else if (g_strcmp0(args[1], "indent") == 0) {
@ -2680,8 +2680,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("Roster private room chat char removed."); cons_show("Roster private room chat char removed.");
rosterwin_roster(); rosterwin_roster();
} else { } else {
prefs_set_roster_private_char(args[2][0]); prefs_set_roster_private_char(args[2]);
cons_show("Roster private room chat char set to %c.", args[2][0]); cons_show("Roster private room chat char set to %s.", args[2]);
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
@ -2720,8 +2720,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("Roster room char removed."); cons_show("Roster room char removed.");
rosterwin_roster(); rosterwin_roster();
} else { } else {
prefs_set_roster_room_char(args[2][0]); prefs_set_roster_room_char(args[2]);
cons_show("Roster room char set to %c.", args[2][0]); cons_show("Roster room char set to %s.", args[2]);
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
@ -2798,8 +2798,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("Roster room private char removed."); cons_show("Roster room private char removed.");
rosterwin_roster(); rosterwin_roster();
} else { } else {
prefs_set_roster_room_private_char(args[3][0]); prefs_set_roster_room_private_char(args[3]);
cons_show("Roster room private char set to %c.", args[3][0]); cons_show("Roster room private char set to %s.", args[3]);
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
@ -4414,8 +4414,8 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
occupantswin_occupants_all(); occupantswin_occupants_all();
} else { } else {
prefs_set_occupants_char(args[1][0]); prefs_set_occupants_char(args[1]);
cons_show("Occupants char set to %c.", args[1][0]); cons_show("Occupants char set to %s.", args[1]);
occupantswin_occupants_all(); occupantswin_occupants_all();
} }
@ -4470,8 +4470,8 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
occupantswin_occupants_all(); occupantswin_occupants_all();
} else { } else {
prefs_set_occupants_header_char(args[2][0]); prefs_set_occupants_header_char(args[2]);
cons_show("Occupants header char set to %c.", args[2][0]); cons_show("Occupants header char set to %s.", args[2]);
occupantswin_occupants_all(); occupantswin_occupants_all();
} }

View File

@ -902,30 +902,23 @@ prefs_get_occupants_size(void)
} }
} }
char char*
prefs_get_occupants_char(void) prefs_get_occupants_char(void)
{ {
char result = 0;
char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL); char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
if (!resultstr) {
result = 0;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_occupants_char(char ch) prefs_set_occupants_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster resource char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.char", str); }
} }
void void
@ -955,30 +948,22 @@ prefs_set_occupants_indent(gint value)
g_key_file_set_integer(prefs, PREF_GROUP_UI, "occupants.indent", value); g_key_file_set_integer(prefs, PREF_GROUP_UI, "occupants.indent", value);
} }
char char*
prefs_get_occupants_header_char(void) prefs_get_occupants_header_char(void)
{ {
char result = 0; char* result = 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;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_occupants_header_char(char ch) prefs_set_occupants_header_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.header.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster resource char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.header.char", str); }
} }
void void
@ -1080,31 +1065,29 @@ prefs_set_omemo_char(char* ch)
return _prefs_set_encryption_char(ch, PREF_GROUP_OMEMO, "omemo.char"); return _prefs_set_encryption_char(ch, PREF_GROUP_OMEMO, "omemo.char");
} }
char char*
prefs_get_roster_header_char(void) prefs_get_roster_header_char(void)
{ {
char result = 0; char* result = NULL;
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) { if (resultstr) {
result = 0; result = resultstr;
} else {
result = resultstr[0];
} }
free(resultstr);
return result; return result;
} }
void void
prefs_set_roster_header_char(char ch) prefs_set_roster_header_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.header.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster header char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.header.char", str);
} }
}
void void
prefs_clear_roster_header_char(void) prefs_clear_roster_header_char(void)
@ -1112,30 +1095,22 @@ prefs_clear_roster_header_char(void)
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.header.char", NULL); g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.header.char", NULL);
} }
char char*
prefs_get_roster_contact_char(void) prefs_get_roster_contact_char(void)
{ {
char result = 0; char* result = 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;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_roster_contact_char(char ch) prefs_set_roster_contact_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.contact.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster contact char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.contact.char", str); }
} }
void void
@ -1144,30 +1119,22 @@ prefs_clear_roster_contact_char(void)
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.contact.char", NULL); g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.contact.char", NULL);
} }
char char*
prefs_get_roster_resource_char(void) prefs_get_roster_resource_char(void)
{ {
char result = 0; char* result = 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;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_roster_resource_char(char ch) prefs_set_roster_resource_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.resource.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster resource char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.resource.char", str); }
} }
void void
@ -1176,30 +1143,22 @@ prefs_clear_roster_resource_char(void)
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.resource.char", NULL); g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.resource.char", NULL);
} }
char char*
prefs_get_roster_private_char(void) prefs_get_roster_private_char(void)
{ {
char result = 0; char* result = 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;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_roster_private_char(char ch) prefs_set_roster_private_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.private.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster resource char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.private.char", str); }
} }
void void
@ -1208,30 +1167,22 @@ prefs_clear_roster_private_char(void)
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.private.char", NULL); g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.private.char", NULL);
} }
char char*
prefs_get_roster_room_char(void) prefs_get_roster_room_char(void)
{ {
char result = 0; char* result = 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;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_roster_room_char(char ch) prefs_set_roster_room_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster resource char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.char", str); }
} }
void void
@ -1240,30 +1191,22 @@ prefs_clear_roster_room_char(void)
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL); g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL);
} }
char char*
prefs_get_roster_room_private_char(void) prefs_get_roster_room_private_char(void)
{ {
char result = 0; char* result = 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;
} else {
result = resultstr[0];
}
free(resultstr);
return result; return result;
} }
void void
prefs_set_roster_room_private_char(char ch) prefs_set_roster_room_private_char(char* ch)
{ {
char str[2]; if (g_utf8_strlen(ch, 4) == 1) {
str[0] = ch; g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", ch);
str[1] = '\0'; } else {
log_error("Could not set roster resource char: %s", ch);
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", str); }
} }
void void

View File

@ -254,29 +254,29 @@ gboolean prefs_set_omemo_char(char* ch);
char* prefs_get_ox_char(void); 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); char* prefs_get_roster_header_char(void);
void prefs_set_roster_header_char(char ch); void prefs_set_roster_header_char(char* ch);
void prefs_clear_roster_header_char(void); void prefs_clear_roster_header_char(void);
char prefs_get_roster_contact_char(void); char* prefs_get_roster_contact_char(void);
void prefs_set_roster_contact_char(char ch); void prefs_set_roster_contact_char(char* ch);
void prefs_clear_roster_contact_char(void); void prefs_clear_roster_contact_char(void);
char prefs_get_roster_resource_char(void); char* prefs_get_roster_resource_char(void);
void prefs_set_roster_resource_char(char ch); void prefs_set_roster_resource_char(char* ch);
void prefs_clear_roster_resource_char(void); void prefs_clear_roster_resource_char(void);
char prefs_get_roster_private_char(void); char* prefs_get_roster_private_char(void);
void prefs_set_roster_private_char(char ch); void prefs_set_roster_private_char(char* ch);
void prefs_clear_roster_private_char(void); void prefs_clear_roster_private_char(void);
char prefs_get_roster_room_char(void); char* prefs_get_roster_room_char(void);
void prefs_set_roster_room_char(char ch); void prefs_set_roster_room_char(char* ch);
void prefs_clear_roster_room_char(void); void prefs_clear_roster_room_char(void);
char prefs_get_roster_room_private_char(void); char* prefs_get_roster_room_private_char(void);
void prefs_set_roster_room_private_char(char ch); void prefs_set_roster_room_private_char(char* ch);
void prefs_clear_roster_room_private_char(void); void prefs_clear_roster_room_private_char(void);
char prefs_get_occupants_char(void); char* prefs_get_occupants_char(void);
void prefs_set_occupants_char(char ch); void prefs_set_occupants_char(char* ch);
void prefs_clear_occupants_char(void); void prefs_clear_occupants_char(void);
char prefs_get_occupants_header_char(void); char* prefs_get_occupants_header_char(void);
void prefs_set_occupants_header_char(char ch); void prefs_set_occupants_header_char(char* ch);
void prefs_clear_occupants_header_char(void); void prefs_clear_occupants_header_char(void);
gint prefs_get_roster_contact_indent(void); gint prefs_get_roster_contact_indent(void);

View File

@ -406,40 +406,40 @@ _load_preferences(void)
// with custom set functions // with custom set functions
if (g_key_file_has_key(theme, "ui", "occupants.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_occupants_char(ch[0]); prefs_set_occupants_char(ch);
g_free(ch); g_free(ch);
} }
} }
if (g_key_file_has_key(theme, "ui", "occupants.header.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_occupants_header_char(ch[0]); prefs_set_occupants_header_char(ch);
g_free(ch); g_free(ch);
} }
} }
if (g_key_file_has_key(theme, "ui", "roster.header.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_roster_header_char(ch[0]); prefs_set_roster_header_char(ch);
g_free(ch); g_free(ch);
} }
} }
if (g_key_file_has_key(theme, "ui", "roster.contact.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_roster_contact_char(ch[0]); prefs_set_roster_contact_char(ch);
g_free(ch); g_free(ch);
} }
} }
if (g_key_file_has_key(theme, "ui", "roster.resource.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_roster_resource_char(ch[0]); prefs_set_roster_resource_char(ch);
g_free(ch); g_free(ch);
} }
} else { } else {
@ -448,24 +448,24 @@ _load_preferences(void)
if (g_key_file_has_key(theme, "ui", "roster.rooms.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_roster_room_char(ch[0]); prefs_set_roster_room_char(ch);
g_free(ch); g_free(ch);
} }
} }
if (g_key_file_has_key(theme, "ui", "roster.rooms.private.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_roster_room_private_char(ch[0]); prefs_set_roster_room_private_char(ch);
g_free(ch); g_free(ch);
} }
} }
if (g_key_file_has_key(theme, "ui", "roster.private.char", NULL)) { 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) { if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_roster_private_char(ch[0]); prefs_set_roster_private_char(ch);
g_free(ch); g_free(ch);
} }
} }

View File

@ -1340,11 +1340,13 @@ cons_occupants_setting(void)
else else
cons_show("Occupants wrap (/occupants) : OFF"); cons_show("Occupants wrap (/occupants) : OFF");
char occupants_ch = prefs_get_occupants_char(); char* occupants_ch = prefs_get_occupants_char();
if (occupants_ch) if (occupants_ch) {
cons_show("Occupants char (/occupants) : %c", occupants_ch); cons_show("Occupants char (/occupants) : %s", occupants_ch);
else free(occupants_ch);
} else {
cons_show("Occupants char (/occupants) : none"); cons_show("Occupants char (/occupants) : none");
}
gint occupant_indent = prefs_get_occupants_indent(); gint occupant_indent = prefs_get_occupants_indent();
cons_show("Occupant indent (/occupants) : %d", occupant_indent); cons_show("Occupant indent (/occupants) : %d", occupant_indent);
@ -1352,12 +1354,14 @@ cons_occupants_setting(void)
int size = prefs_get_occupants_size(); int size = prefs_get_occupants_size();
cons_show("Occupants size (/occupants) : %d", size); cons_show("Occupants size (/occupants) : %d", size);
char header_ch = prefs_get_occupants_header_char(); char* header_ch = prefs_get_occupants_header_char();
if (header_ch) if (header_ch) {
cons_show("Occupants header char (/occupants) : %c", header_ch); cons_show("Occupants header char (/occupants) : %s", header_ch);
else free(header_ch);
} else {
cons_show("Occupants header char (/occupants) : none"); cons_show("Occupants header char (/occupants) : none");
} }
}
void void
cons_rooms_cache_setting(void) cons_rooms_cache_setting(void)
@ -1475,41 +1479,53 @@ cons_roster_setting(void)
else else
cons_show("Roster offline (/roster) : hide"); cons_show("Roster offline (/roster) : hide");
char header_ch = prefs_get_roster_header_char(); char* header_ch = prefs_get_roster_header_char();
if (header_ch) if (header_ch) {
cons_show("Roster header char (/roster) : %c", header_ch); cons_show("Roster header char (/roster) : %s", header_ch);
else free(header_ch);
} else {
cons_show("Roster header char (/roster) : none"); cons_show("Roster header char (/roster) : none");
}
char contact_ch = prefs_get_roster_contact_char(); char* contact_ch = prefs_get_roster_contact_char();
if (contact_ch) if (contact_ch) {
cons_show("Roster contact char (/roster) : %c", contact_ch); cons_show("Roster contact char (/roster) : %s", contact_ch);
else free(contact_ch);
} else {
cons_show("Roster contact char (/roster) : none"); cons_show("Roster contact char (/roster) : none");
}
char resource_ch = prefs_get_roster_resource_char(); char* resource_ch = prefs_get_roster_resource_char();
if (resource_ch) if (resource_ch) {
cons_show("Roster resource char (/roster) : %c", resource_ch); cons_show("Roster resource char (/roster) : %s", resource_ch);
else free(resource_ch);
} else {
cons_show("Roster resource char (/roster) : none"); cons_show("Roster resource char (/roster) : none");
}
char room_ch = prefs_get_roster_room_char(); char* room_ch = prefs_get_roster_room_char();
if (room_ch) if (room_ch) {
cons_show("Roster room char (/roster) : %c", room_ch); cons_show("Roster room char (/roster) : %s", room_ch);
else free(room_ch);
} else {
cons_show("Roster room char (/roster) : none"); cons_show("Roster room char (/roster) : none");
}
char room_priv_ch = prefs_get_roster_room_private_char(); char* room_priv_ch = prefs_get_roster_room_private_char();
if (room_priv_ch) if (room_priv_ch) {
cons_show("Roster room private char (/roster) : %c", room_priv_ch); cons_show("Roster room private char (/roster) : %s", room_priv_ch);
else free(room_priv_ch);
} else {
cons_show("Roster room private char (/roster) : none"); cons_show("Roster room private char (/roster) : none");
}
char private_ch = prefs_get_roster_private_char(); char* private_ch = prefs_get_roster_private_char();
if (private_ch) if (private_ch) {
cons_show("Roster private char (/roster) : %c", private_ch); cons_show("Roster private char (/roster) : %s", private_ch);
else free(private_ch);
} else {
cons_show("Roster private char (/roster) : none"); cons_show("Roster private char (/roster) : none");
}
gint contact_indent = prefs_get_roster_contact_indent(); gint contact_indent = prefs_get_roster_contact_indent();
cons_show("Roster contact indent (/roster) : %d", contact_indent); cons_show("Roster contact indent (/roster) : %d", contact_indent);

View File

@ -77,9 +77,10 @@ _occuptantswin_occupant(ProfLayoutSplit* layout, GList* item, gboolean showjid,
GString* msg = g_string_new(spaces->str); GString* msg = g_string_new(spaces->str);
char ch = prefs_get_occupants_char(); char* ch = prefs_get_occupants_char();
if (ch) { if (ch) {
g_string_append_printf(msg, "%c", ch); g_string_append_printf(msg, "%s", ch);
free(ch);
} }
gboolean wrap = prefs_get_boolean(PREF_OCCUPANTS_WRAP); gboolean wrap = prefs_get_boolean(PREF_OCCUPANTS_WRAP);
@ -130,9 +131,10 @@ occupantswin_occupants(const char* const roomjid)
GString* prefix = g_string_new(" "); GString* prefix = g_string_new(" ");
char ch = prefs_get_occupants_header_char(); char* ch = prefs_get_occupants_header_char();
if (ch) { if (ch) {
g_string_append_printf(prefix, "%c", ch); g_string_append_printf(prefix, "%s", ch);
free(ch);
} }
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) { if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {

View File

@ -314,9 +314,10 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit* layout, ProfChatWin* chatwin)
indent--; indent--;
} }
} }
char ch = prefs_get_roster_contact_char(); char *ch = prefs_get_roster_contact_char();
if (ch) { 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_UNREAD); char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
@ -376,9 +377,10 @@ _rosterwin_contact(ProfLayoutSplit* layout, PContact contact)
indent--; indent--;
} }
} }
char ch = prefs_get_roster_contact_char(); char *ch = prefs_get_roster_contact_char();
if (ch) { 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_UNREAD); 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)); wattron(layout->subwin, theme_attrs(resource_presence_colour));
GString* msg = g_string_new(""); GString* msg = g_string_new("");
char ch = prefs_get_roster_resource_char(); char* ch = prefs_get_roster_resource_char();
if (ch) { if (ch) {
g_string_append_printf(msg, "%c", ch); g_string_append_printf(msg, "%s", ch);
free(ch);
} else { } else {
g_string_append(msg, " "); g_string_append(msg, " ");
} }
@ -590,9 +593,10 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
g_string_append(msg, " "); g_string_append(msg, " ");
this_indent--; this_indent--;
} }
char ch = prefs_get_roster_resource_char(); char* ch = prefs_get_roster_resource_char();
if (ch) { if (ch) {
g_string_append_printf(msg, "%c", ch); g_string_append_printf(msg, "%s", ch);
free(ch);
} }
g_string_append(msg, resource->name); g_string_append(msg, resource->name);
if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) { if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) {
@ -752,9 +756,10 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
indent--; indent--;
} }
} }
char ch = prefs_get_roster_room_char(); char* ch = prefs_get_roster_room_char();
if (ch) { 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); char* unreadpos = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
@ -854,7 +859,8 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
ch = prefs_get_roster_room_private_char(); ch = prefs_get_roster_room_private_char();
if (ch) { 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; char* nick = privwin->fulljid + strlen(mucwin->roomjid) + 1;
@ -947,9 +953,10 @@ _rosterwin_private_chats(ProfLayoutSplit* layout, GList* orphaned_privchats)
g_string_append_printf(privmsg, "(%d) ", privwin->unread); g_string_append_printf(privmsg, "(%d) ", privwin->unread);
} }
char ch = prefs_get_roster_private_char(); char* ch = prefs_get_roster_private_char();
if (ch) { if (ch) {
g_string_append_printf(privmsg, "%c", ch); g_string_append_printf(privmsg, "%s", ch);
free(ch);
} }
g_string_append(privmsg, privwin->fulljid); g_string_append(privmsg, privwin->fulljid);
@ -1028,9 +1035,10 @@ _rosterwin_unsubscribed_header(ProfLayoutSplit* layout, GList* wins)
win_sub_newline_lazy(layout->subwin); win_sub_newline_lazy(layout->subwin);
GString* header = g_string_new(" "); GString* header = g_string_new(" ");
char ch = prefs_get_roster_header_char(); char* ch = prefs_get_roster_header_char();
if (ch) { if (ch) {
g_string_append_printf(header, "%c", ch); g_string_append_printf(header, "%s", ch);
free(ch);
} }
g_string_append(header, "Unsubscribed"); g_string_append(header, "Unsubscribed");
@ -1074,9 +1082,10 @@ _rosterwin_contacts_header(ProfLayoutSplit* layout, const char* const title, GSL
win_sub_newline_lazy(layout->subwin); win_sub_newline_lazy(layout->subwin);
GString* header = g_string_new(" "); GString* header = g_string_new(" ");
char ch = prefs_get_roster_header_char(); char* ch = prefs_get_roster_header_char();
if (ch) { if (ch) {
g_string_append_printf(header, "%c", ch); g_string_append_printf(header, "%s", ch);
free(ch);
} }
g_string_append(header, title); g_string_append(header, title);
@ -1125,9 +1134,10 @@ _rosterwin_rooms_header(ProfLayoutSplit* layout, GList* rooms, char* title)
{ {
win_sub_newline_lazy(layout->subwin); win_sub_newline_lazy(layout->subwin);
GString* header = g_string_new(" "); GString* header = g_string_new(" ");
char ch = prefs_get_roster_header_char(); char* ch = prefs_get_roster_header_char();
if (ch) { if (ch) {
g_string_append_printf(header, "%c", ch); g_string_append_printf(header, "%s", ch);
free(ch);
} }
g_string_append(header, title); g_string_append(header, title);
@ -1188,9 +1198,10 @@ _rosterwin_private_header(ProfLayoutSplit* layout, GList* privs)
win_sub_newline_lazy(layout->subwin); win_sub_newline_lazy(layout->subwin);
GString* title_str = g_string_new(" "); GString* title_str = g_string_new(" ");
char ch = prefs_get_roster_header_char(); char* ch = prefs_get_roster_header_char();
if (ch) { if (ch) {
g_string_append_printf(title_str, "%c", ch); g_string_append_printf(title_str, "%s", ch);
free(ch);
} }
g_string_append(title_str, "Private chats"); g_string_append(title_str, "Private chats");