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

Always use string format in win_printf

This commit is contained in:
James Booth 2016-10-12 00:40:41 +01:00
parent 97898ee082
commit 24f0dc2734
9 changed files with 63 additions and 63 deletions

View File

@ -85,7 +85,7 @@ api_cons_show_themed(const char *const group, const char *const key, const char
char *parsed = str_replace(message, "\r\n", "\n"); char *parsed = str_replace(message, "\r\n", "\n");
theme_item_t themeitem = plugin_themes_get(group, key, def); theme_item_t themeitem = plugin_themes_get(group, key, def);
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
win_printf(console, '-', 0, NULL, 0, themeitem, "", parsed); win_printf(console, '-', 0, NULL, 0, themeitem, "", "%s", parsed);
free(parsed); free(parsed);
@ -368,7 +368,7 @@ api_win_show(const char *tag, const char *line)
} }
ProfWin *window = (ProfWin*)pluginwin; ProfWin *window = (ProfWin*)pluginwin;
win_printf(window, '!', 0, NULL, 0, 0, "", line); win_printf(window, '!', 0, NULL, 0, 0, "", "%s", line);
return 1; return 1;
} }
@ -393,7 +393,7 @@ api_win_show_themed(const char *tag, const char *const group, const char *const
theme_item_t themeitem = plugin_themes_get(group, key, def); theme_item_t themeitem = plugin_themes_get(group, key, def);
ProfWin *window = (ProfWin*)pluginwin; ProfWin *window = (ProfWin*)pluginwin;
win_printf(window, '!', 0, NULL, 0, themeitem, "", line); win_printf(window, '!', 0, NULL, 0, themeitem, "", "%s", line);
return 1; return 1;
} }

View File

@ -308,7 +308,7 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
if (request_receipt && id) { if (request_receipt && id) {
win_print_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id); win_print_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id);
} else { } else {
win_printf((ProfWin*)chatwin, enc_char, 0, NULL, 0, THEME_TEXT_ME, "me", message); win_printf((ProfWin*)chatwin, enc_char, 0, NULL, 0, THEME_TEXT_ME, "me", "%s", message);
} }
} }
@ -322,7 +322,7 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, const char *const message, prof_en
enc_char = prefs_get_pgp_char(); enc_char = prefs_get_pgp_char();
} }
win_printf((ProfWin*)chatwin, enc_char, 0, NULL, 0, THEME_TEXT_ME, "me", message); win_printf((ProfWin*)chatwin, enc_char, 0, NULL, 0, THEME_TEXT_ME, "me", "%s", message);
int num = wins_get_num((ProfWin*)chatwin); int num = wins_get_num((ProfWin*)chatwin);
status_bar_active(num); status_bar_active(num);
} }
@ -401,11 +401,11 @@ _chatwin_history(ProfChatWin *chatwin, const char *const contact)
char mm[3]; memcpy(mm, &line[3], 2); mm[2] = '\0'; int imm = atoi(mm); char mm[3]; memcpy(mm, &line[3], 2); mm[2] = '\0'; int imm = atoi(mm);
char ss[3]; memcpy(ss, &line[6], 2); ss[2] = '\0'; int iss = atoi(ss); char ss[3]; memcpy(ss, &line[6], 2); ss[2] = '\0'; int iss = atoi(ss);
GDateTime *timestamp = g_date_time_new_local(2000, 1, 1, ihh, imm, iss); GDateTime *timestamp = g_date_time_new_local(2000, 1, 1, ihh, imm, iss);
win_printf((ProfWin*)chatwin, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", curr->data+11); win_printf((ProfWin*)chatwin, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", "%s", curr->data+11);
g_date_time_unref(timestamp); g_date_time_unref(timestamp);
// header // header
} else { } else {
win_printf((ProfWin*)chatwin, '-', 0, NULL, 0, 0, "", curr->data); win_printf((ProfWin*)chatwin, '-', 0, NULL, 0, 0, "", "%s", curr->data);
} }
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }

View File

@ -74,7 +74,7 @@ void
cons_show_word(const char *const word) cons_show_word(const char *const word)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", word); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", word);
} }
void void
@ -181,7 +181,7 @@ cons_show_error(const char *const msg, ...)
va_start(arg, msg); va_start(arg, msg);
GString *fmt_msg = g_string_new(NULL); GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg); g_string_vprintf(fmt_msg, msg, arg);
win_printf(console, '-', 0, NULL, 0, THEME_ERROR, "", fmt_msg->str); win_printf(console, '-', 0, NULL, 0, THEME_ERROR, "", "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE); g_string_free(fmt_msg, TRUE);
va_end(arg); va_end(arg);
@ -562,19 +562,19 @@ cons_show_caps(const char *const fulljid, resource_presence_t presence)
DiscoIdentity *identity = caps->identity; DiscoIdentity *identity = caps->identity;
win_printf(console, '-', 0, NULL, NO_EOL, 0, "", "Identity: "); win_printf(console, '-', 0, NULL, NO_EOL, 0, "", "Identity: ");
if (identity->name) { if (identity->name) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->name); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->name);
if (identity->category || identity->type) { if (identity->category || identity->type) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->type) { if (identity->type) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->type); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->type);
if (identity->category) { if (identity->category) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->category) { if (identity->category) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->category); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->category);
} }
win_newline(console); win_newline(console);
} }
@ -1016,19 +1016,19 @@ cons_show_account(ProfAccount *account)
DiscoIdentity *identity = caps->identity; DiscoIdentity *identity = caps->identity;
win_printf(console, '-', 0, NULL, NO_EOL, 0, "", " Identity: "); win_printf(console, '-', 0, NULL, NO_EOL, 0, "", " Identity: ");
if (identity->name) { if (identity->name) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->name); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->name);
if (identity->category || identity->type) { if (identity->category || identity->type) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->type) { if (identity->type) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->type); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->type);
if (identity->category) { if (identity->category) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->category) { if (identity->category) {
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->category); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->category);
} }
win_newline(console); win_newline(console);
} }
@ -2184,14 +2184,14 @@ _cons_theme_bar_prop(theme_item_t theme, char *prop)
GString *propstr = g_string_new(" "); GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop); g_string_append_printf(propstr, "%-24s", prop);
win_printf(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str); win_printf(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", "%s", propstr->str);
g_string_free(propstr, TRUE); g_string_free(propstr, TRUE);
GString *valstr = g_string_new(" "); GString *valstr = g_string_new(" ");
char *setting = theme_get_string(prop); char *setting = theme_get_string(prop);
g_string_append_printf(valstr, "%s ", setting); g_string_append_printf(valstr, "%s ", setting);
theme_free_string(setting); theme_free_string(setting);
win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, theme, "", valstr->str); win_printf(console, '-', 0, NULL, NO_DATE | NO_EOL, theme, "", "%s", valstr->str);
win_printf(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", ""); win_printf(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", "");
g_string_free(valstr, TRUE); g_string_free(valstr, TRUE);
} }
@ -2203,14 +2203,14 @@ _cons_theme_prop(theme_item_t theme, char *prop)
GString *propstr = g_string_new(" "); GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop); g_string_append_printf(propstr, "%-24s", prop);
win_printf(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str); win_printf(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", "%s", propstr->str);
g_string_free(propstr, TRUE); g_string_free(propstr, TRUE);
GString *valstr = g_string_new(""); GString *valstr = g_string_new("");
char *setting = theme_get_string(prop); char *setting = theme_get_string(prop);
g_string_append_printf(valstr, "%s", setting); g_string_append_printf(valstr, "%s", setting);
theme_free_string(setting); theme_free_string(setting);
win_printf(console, '-', 0, NULL, NO_DATE, theme, "", valstr->str); win_printf(console, '-', 0, NULL, NO_DATE, theme, "", "%s", valstr->str);
g_string_free(valstr, TRUE); g_string_free(valstr, TRUE);
} }
@ -2393,7 +2393,7 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
} else { } else {
presence_colour = theme_main_presence_attrs("offline"); presence_colour = theme_main_presence_attrs("offline");
} }
win_printf(console, '-', 0, NULL, NO_EOL, presence_colour, "", title->str); win_printf(console, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", title->str);
g_string_free(title, TRUE); g_string_free(title, TRUE);

View File

@ -435,7 +435,7 @@ ui_handle_otr_error(const char *const barejid, const char *const message)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
win_printf((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_ERROR, "", message); win_printf((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_ERROR, "", "%s", message);
} else { } else {
cons_show_error("%s - %s", barejid, message); cons_show_error("%s - %s", barejid, message);
} }
@ -752,7 +752,7 @@ ui_current_print_formatted_line(const char show_char, int attrs, const char *con
va_start(arg, msg); va_start(arg, msg);
GString *fmt_msg = g_string_new(NULL); GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg); g_string_vprintf(fmt_msg, msg, arg);
win_printf(current, show_char, 0, NULL, 0, attrs, "", fmt_msg->str); win_printf(current, show_char, 0, NULL, 0, attrs, "", "%s", fmt_msg->str);
va_end(arg); va_end(arg);
g_string_free(fmt_msg, TRUE); g_string_free(fmt_msg, TRUE);
} }
@ -760,14 +760,14 @@ ui_current_print_formatted_line(const char show_char, int attrs, const char *con
void void
ui_win_error_line(ProfWin *window, const char *const msg) ui_win_error_line(ProfWin *window, const char *const msg)
{ {
win_printf(window, '-', 0, NULL, 0, THEME_ERROR, "", msg); win_printf(window, '-', 0, NULL, 0, THEME_ERROR, "", "%s", msg);
} }
void void
ui_current_error_line(const char *const msg) ui_current_error_line(const char *const msg)
{ {
ProfWin *current = wins_get_current(); ProfWin *current = wins_get_current();
win_printf(current, '-', 0, NULL, 0, THEME_ERROR, "", msg); win_printf(current, '-', 0, NULL, 0, THEME_ERROR, "", "%s", msg);
} }
void void
@ -1158,7 +1158,7 @@ ui_handle_room_configuration_form_error(const char *const roomjid, const char *c
g_string_append(message_str, message); g_string_append(message_str, message);
} }
win_printf(window, '-', 0, NULL, 0, THEME_ERROR, "", message_str->str); win_printf(window, '-', 0, NULL, 0, THEME_ERROR, "", "%s", message_str->str);
g_string_free(message_str, TRUE); g_string_free(message_str, TRUE);
} }
@ -1237,7 +1237,7 @@ ui_show_lines(ProfWin *window, gchar** lines)
if (lines) { if (lines) {
int i; int i;
for (i = 0; lines[i] != NULL; i++) { for (i = 0; lines[i] != NULL; i++) {
win_printf(window, '-', 0, NULL, 0, 0, "", lines[i]); win_printf(window, '-', 0, NULL, 0, 0, "", "%s", lines[i]);
} }
} }
} }
@ -1274,7 +1274,7 @@ ui_handle_software_version_error(const char *const roomjid, const char *const me
g_string_append(message_str, message); g_string_append(message_str, message);
} }
win_printf(window, '-', 0, NULL, 0, THEME_ERROR, "", message_str->str); win_printf(window, '-', 0, NULL, 0, THEME_ERROR, "", "%s", message_str->str);
g_string_free(message_str, TRUE); g_string_free(message_str, TRUE);
} }

View File

@ -48,7 +48,7 @@ mucconfwin_show_form(ProfMucConfWin *confwin)
ProfWin *window = (ProfWin*) confwin; ProfWin *window = (ProfWin*) confwin;
if (confwin->form->title) { if (confwin->form->title) {
win_printf(window, '-', 0, NULL, NO_EOL, 0, "", "Form title: "); win_printf(window, '-', 0, NULL, NO_EOL, 0, "", "Form title: ");
win_printf(window, '-', 0, NULL, NO_DATE, 0, "", confwin->form->title); win_printf(window, '-', 0, NULL, NO_DATE, 0, "", "%s", confwin->form->title);
} else { } else {
win_printf(window, '-', 0, NULL, 0, 0, "", "Configuration for room %s.", confwin->roomjid); win_printf(window, '-', 0, NULL, 0, 0, "", "Configuration for room %s.", confwin->roomjid);
} }
@ -64,7 +64,7 @@ mucconfwin_show_form(ProfMucConfWin *confwin)
if ((g_strcmp0(field->type, "fixed") == 0) && field->values) { if ((g_strcmp0(field->type, "fixed") == 0) && field->values) {
if (field->values) { if (field->values) {
char *value = field->values->data; char *value = field->values->data;
win_printf(window, '-', 0, NULL, 0, 0, "", value); win_printf(window, '-', 0, NULL, 0, 0, "", "%s", value);
} }
} else if (g_strcmp0(field->type, "hidden") != 0 && field->var) { } else if (g_strcmp0(field->type, "hidden") != 0 && field->var) {
char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var); char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var);
@ -111,7 +111,7 @@ mucconfwin_field_help(ProfMucConfWin *confwin, char *tag)
ProfWin *window = (ProfWin*) confwin; ProfWin *window = (ProfWin*) confwin;
FormField *field = form_get_field_by_tag(confwin->form, tag); FormField *field = form_get_field_by_tag(confwin->form, tag);
if (field) { if (field) {
win_printf(window, '-', 0, NULL, NO_EOL, 0, "", field->label); win_printf(window, '-', 0, NULL, NO_EOL, 0, "", "%s", field->label);
if (field->required) { if (field->required) {
win_printf(window, '-', 0, NULL, NO_DATE, 0, "", " (Required):"); win_printf(window, '-', 0, NULL, NO_DATE, 0, "", " (Required):");
} else { } else {
@ -194,7 +194,7 @@ mucconfwin_form_help(ProfMucConfWin *confwin)
if (confwin->form->instructions) { if (confwin->form->instructions) {
ProfWin *window = (ProfWin*) confwin; ProfWin *window = (ProfWin*) confwin;
win_printf(window, '-', 0, NULL, 0, 0, "", "Supplied instructions:"); win_printf(window, '-', 0, NULL, 0, 0, "", "Supplied instructions:");
win_printf(window, '-', 0, NULL, 0, 0, "", confwin->form->instructions); win_printf(window, '-', 0, NULL, 0, 0, "", "%s", confwin->form->instructions);
win_printf(window, '-', 0, NULL, 0, 0, "", ""); win_printf(window, '-', 0, NULL, 0, 0, "", "");
} }
} }
@ -223,7 +223,7 @@ _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
if (g_strcmp0(field->var, "muc#roomconfig_roomsecret") == 0) { if (g_strcmp0(field->var, "muc#roomconfig_roomsecret") == 0) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]");
} else { } else {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "%s", value);
} }
} }
} }
@ -303,7 +303,7 @@ _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
if (curr_value) { if (curr_value) {
char *value = curr_value->data; char *value = curr_value->data;
if (value) { if (value) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "%s", value);
} }
} }
win_newline(window); win_newline(window);
@ -320,7 +320,7 @@ _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
if (curr_value) { if (curr_value) {
char *value = curr_value->data; char *value = curr_value->data;
if (value) { if (value) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", value); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", value);
} }
} }
win_newline(window); win_newline(window);

View File

@ -182,7 +182,7 @@ mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features)
if (identity->category) { if (identity->category) {
identity_str = g_string_append(identity_str, identity->category); identity_str = g_string_append(identity_str, identity->category);
} }
win_printf(window, '!', 0, NULL, 0, 0, "", identity_str->str); win_printf(window, '!', 0, NULL, 0, 0, "", "%s", identity_str->str);
g_string_free(identity_str, TRUE); g_string_free(identity_str, TRUE);
identities = g_slist_next(identities); identities = g_slist_next(identities);
} }
@ -355,7 +355,7 @@ mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp,
g_string_append(line, message); g_string_append(line, message);
} }
win_printf(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", line->str); win_printf(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", "%s", line->str);
g_string_free(line, TRUE); g_string_free(line, TRUE);
plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp); plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp);
@ -371,10 +371,10 @@ _mucwin_print_mention(ProfWin *window, const char *const message, const char *co
pos = GPOINTER_TO_INT(curr->data); pos = GPOINTER_TO_INT(curr->data);
char *before_str = g_strndup(message + last_pos, pos - last_pos); char *before_str = g_strndup(message + last_pos, pos - last_pos);
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION, "", before_str); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION, "", "%s", before_str);
g_free(before_str); g_free(before_str);
char *nick_str = g_strndup(message + pos, strlen(nick)); char *nick_str = g_strndup(message + pos, strlen(nick));
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION_TERM, "", nick_str); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION_TERM, "", "%s", nick_str);
g_free(nick_str); g_free(nick_str);
last_pos = pos + strlen(nick); last_pos = pos + strlen(nick);
@ -382,7 +382,7 @@ _mucwin_print_mention(ProfWin *window, const char *const message, const char *co
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }
if (last_pos < strlen(message)) { if (last_pos < strlen(message)) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMMENTION, "", &message[last_pos]); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMMENTION, "", "%s", &message[last_pos]);
} else { } else {
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMMENTION, "", ""); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMMENTION, "", "");
} }
@ -442,7 +442,7 @@ _mucwin_print_triggers(ProfWin *window, const char *const message, GList *trigge
// no triggers found // no triggers found
if (first_trigger_pos == -1) { if (first_trigger_pos == -1) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMTRIGGER, "", message); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMTRIGGER, "", "%s", message);
} else { } else {
if (first_trigger_pos > 0) { if (first_trigger_pos > 0) {
char message_section[strlen(message) + 1]; char message_section[strlen(message) + 1];
@ -452,7 +452,7 @@ _mucwin_print_triggers(ProfWin *window, const char *const message, GList *trigge
i++; i++;
} }
message_section[i] = '\0'; message_section[i] = '\0';
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMTRIGGER, "", message_section); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMTRIGGER, "", "%s", message_section);
} }
char trigger_section[first_trigger_len + 1]; char trigger_section[first_trigger_len + 1];
int i = 0; int i = 0;
@ -463,10 +463,10 @@ _mucwin_print_triggers(ProfWin *window, const char *const message, GList *trigge
trigger_section[i] = '\0'; trigger_section[i] = '\0';
if (first_trigger_pos + first_trigger_len < strlen(message)) { if (first_trigger_pos + first_trigger_len < strlen(message)) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMTRIGGER_TERM, "", trigger_section); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMTRIGGER_TERM, "", "%s", trigger_section);
_mucwin_print_triggers(window, &message[first_trigger_pos + first_trigger_len], triggers); _mucwin_print_triggers(window, &message[first_trigger_pos + first_trigger_len], triggers);
} else { } else {
win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMTRIGGER_TERM, "", trigger_section); win_printf(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMTRIGGER_TERM, "", "%s", trigger_section);
} }
} }
} }
@ -487,10 +487,10 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes
win_printf(window, '-', 0, NULL, NO_ME | NO_EOL, THEME_ROOMTRIGGER, nick, ""); win_printf(window, '-', 0, NULL, NO_ME | NO_EOL, THEME_ROOMTRIGGER, nick, "");
_mucwin_print_triggers(window, message, triggers); _mucwin_print_triggers(window, message, triggers);
} else { } else {
win_printf(window, '-', 0, NULL, NO_ME, THEME_TEXT_THEM, nick, message); win_printf(window, '-', 0, NULL, NO_ME, THEME_TEXT_THEM, nick, "%s", message);
} }
} else { } else {
win_printf(window, '-', 0, NULL, 0, THEME_TEXT_ME, nick, message); win_printf(window, '-', 0, NULL, 0, THEME_TEXT_ME, nick, "%s", message);
} }
} }

View File

@ -93,7 +93,7 @@ privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const message)
{ {
assert(privwin != NULL); assert(privwin != NULL);
win_printf((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message); win_printf((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", "%s", message);
} }
void void

View File

@ -683,7 +683,7 @@ win_show_occupant(ProfWin *window, Occupant *occupant)
theme_item_t presence_colour = theme_main_presence_attrs(presence_str); theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", occupant->nick); win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", occupant->nick);
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str);
if (occupant->status) { if (occupant->status) {
@ -705,9 +705,9 @@ win_show_contact(ProfWin *window, PContact contact)
theme_item_t presence_colour = theme_main_presence_attrs(presence); theme_item_t presence_colour = theme_main_presence_attrs(presence);
if (name) { if (name) {
win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", name); win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", name);
} else { } else {
win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", barejid); win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", barejid);
} }
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence);
@ -747,7 +747,7 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
theme_item_t presence_colour = theme_main_presence_attrs(presence_str); theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
win_printf(window, '!', 0, NULL, NO_EOL, presence_colour, "", occupant->nick); win_printf(window, '!', 0, NULL, NO_EOL, presence_colour, "", "%s", occupant->nick);
win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str);
if (occupant->status) { if (occupant->status) {
@ -773,19 +773,19 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
DiscoIdentity *identity = caps->identity; DiscoIdentity *identity = caps->identity;
win_printf(window, '!', 0, NULL, NO_EOL, 0, "", " Identity: "); win_printf(window, '!', 0, NULL, NO_EOL, 0, "", " Identity: ");
if (identity->name) { if (identity->name) {
win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->name); win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->name);
if (identity->category || identity->type) { if (identity->category || identity->type) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->type) { if (identity->type) {
win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->type); win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->type);
if (identity->category) { if (identity->category) {
win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->category) { if (identity->category) {
win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->category); win_printf(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->category);
} }
win_newline(window); win_newline(window);
} }
@ -830,7 +830,7 @@ win_show_info(ProfWin *window, PContact contact)
theme_item_t presence_colour = theme_main_presence_attrs(presence); theme_item_t presence_colour = theme_main_presence_attrs(presence);
win_printf(window, '-', 0, NULL, 0, 0, "", ""); win_printf(window, '-', 0, NULL, 0, 0, "", "");
win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", barejid); win_printf(window, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", barejid);
if (name) { if (name) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (%s)", name); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (%s)", name);
} }
@ -897,19 +897,19 @@ win_show_info(ProfWin *window, PContact contact)
DiscoIdentity *identity = caps->identity; DiscoIdentity *identity = caps->identity;
win_printf(window, '-', 0, NULL, NO_EOL, 0, "", " Identity: "); win_printf(window, '-', 0, NULL, NO_EOL, 0, "", " Identity: ");
if (identity->name) { if (identity->name) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->name); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->name);
if (identity->category || identity->type) { if (identity->category || identity->type) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->type) { if (identity->type) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->type); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->type);
if (identity->category) { if (identity->category) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " ");
} }
} }
if (identity->category) { if (identity->category) {
win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", identity->category); win_printf(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", "%s", identity->category);
} }
win_newline(window); win_newline(window);
} }
@ -1001,10 +1001,10 @@ win_print_incoming_message(ProfWin *window, GDateTime *timestamp,
} else if (enc_mode == PROF_MSG_PGP) { } else if (enc_mode == PROF_MSG_PGP) {
enc_char = prefs_get_pgp_char(); enc_char = prefs_get_pgp_char();
} }
win_printf(window, enc_char, 0, timestamp, NO_ME, THEME_TEXT_THEM, from, message); win_printf(window, enc_char, 0, timestamp, NO_ME, THEME_TEXT_THEM, from, "%s", message);
break; break;
case WIN_PRIVATE: case WIN_PRIVATE:
win_printf(window, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, from, message); win_printf(window, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, from, "%s", message);
break; break;
default: default:
assert(FALSE); assert(FALSE);
@ -1113,7 +1113,7 @@ win_update_entry_theme(ProfWin *window, const char *const id, theme_item_t theme
void void
win_println(ProfWin *window, int pad, const char *const message) win_println(ProfWin *window, int pad, const char *const message)
{ {
win_printf(window, '-', pad, NULL, 0, 0, "", message); win_printf(window, '-', pad, NULL, 0, 0, "", "%s", message);
} }
void void
@ -1123,7 +1123,7 @@ win_vprintln_ch(ProfWin *window, char ch, const char *const message, ...)
va_start(arg, message); va_start(arg, message);
GString *fmt_msg = g_string_new(NULL); GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg); g_string_vprintf(fmt_msg, message, arg);
win_printf(window, ch, 0, NULL, 0, 0, "", fmt_msg->str); win_printf(window, ch, 0, NULL, 0, 0, "", "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE); g_string_free(fmt_msg, TRUE);
va_end(arg); va_end(arg);
} }

View File

@ -46,11 +46,11 @@ xmlwin_show(ProfXMLWin *xmlwin, const char *const msg)
ProfWin *window = (ProfWin*)xmlwin; ProfWin *window = (ProfWin*)xmlwin;
if (g_str_has_prefix(msg, "SENT:")) { if (g_str_has_prefix(msg, "SENT:")) {
win_printf(window, '-', 0, NULL, 0, 0, "", "SENT:"); win_printf(window, '-', 0, NULL, 0, 0, "", "SENT:");
win_printf(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]); win_printf(window, '-', 0, NULL, 0, THEME_ONLINE, "", "%s", &msg[6]);
win_printf(window, '-', 0, NULL, 0, THEME_ONLINE, "", ""); win_printf(window, '-', 0, NULL, 0, THEME_ONLINE, "", "");
} else if (g_str_has_prefix(msg, "RECV:")) { } else if (g_str_has_prefix(msg, "RECV:")) {
win_printf(window, '-', 0, NULL, 0, 0, "", "RECV:"); win_printf(window, '-', 0, NULL, 0, 0, "", "RECV:");
win_printf(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]); win_printf(window, '-', 0, NULL, 0, THEME_AWAY, "", "%s", &msg[6]);
win_printf(window, '-', 0, NULL, 0, THEME_AWAY, "", ""); win_printf(window, '-', 0, NULL, 0, THEME_AWAY, "", "");
} }
} }