1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Remove win_vprintln_ch

This commit is contained in:
James Booth 2016-10-15 17:17:17 +01:00
parent 478c749ff9
commit 5488fd6e72
5 changed files with 33 additions and 47 deletions

View File

@ -5140,44 +5140,44 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
win_printf_line(current, THEME_DEFAULT, '-', "");
ProfMucWin *mucwin = (ProfMucWin *)current;
win_vprintln_ch(window, '!', "Notification settings for %s:", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Notification settings for %s:", mucwin->roomjid);
if (prefs_has_room_notify(mucwin->roomjid)) {
if (prefs_get_room_notify(mucwin->roomjid)) {
win_vprintln_ch(window, '!', " Message : ON");
win_printf_line(window, THEME_DEFAULT, '!', " Message : ON");
} else {
win_vprintln_ch(window, '!', " Message : OFF");
win_printf_line(window, THEME_DEFAULT, '!', " Message : OFF");
}
} else {
if (prefs_get_boolean(PREF_NOTIFY_ROOM)) {
win_vprintln_ch(window, '!', " Message : ON (global setting)");
win_printf_line(window, THEME_DEFAULT, '!', " Message : ON (global setting)");
} else {
win_vprintln_ch(window, '!', " Message : OFF (global setting)");
win_printf_line(window, THEME_DEFAULT, '!', " Message : OFF (global setting)");
}
}
if (prefs_has_room_notify_mention(mucwin->roomjid)) {
if (prefs_get_room_notify_mention(mucwin->roomjid)) {
win_vprintln_ch(window, '!', " Mention : ON");
win_printf_line(window, THEME_DEFAULT, '!', " Mention : ON");
} else {
win_vprintln_ch(window, '!', " Mention : OFF");
win_printf_line(window, THEME_DEFAULT, '!', " Mention : OFF");
}
} else {
if (prefs_get_boolean(PREF_NOTIFY_ROOM_MENTION)) {
win_vprintln_ch(window, '!', " Mention : ON (global setting)");
win_printf_line(window, THEME_DEFAULT, '!', " Mention : ON (global setting)");
} else {
win_vprintln_ch(window, '!', " Mention : OFF (global setting)");
win_printf_line(window, THEME_DEFAULT, '!', " Mention : OFF (global setting)");
}
}
if (prefs_has_room_notify_trigger(mucwin->roomjid)) {
if (prefs_get_room_notify_trigger(mucwin->roomjid)) {
win_vprintln_ch(window, '!', " Triggers : ON");
win_printf_line(window, THEME_DEFAULT, '!', " Triggers : ON");
} else {
win_vprintln_ch(window, '!', " Triggers : OFF");
win_printf_line(window, THEME_DEFAULT, '!', " Triggers : OFF");
}
} else {
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TRIGGER)) {
win_vprintln_ch(window, '!', " Triggers : ON (global setting)");
win_printf_line(window, THEME_DEFAULT, '!', " Triggers : ON (global setting)");
} else {
win_vprintln_ch(window, '!', " Triggers : OFF (global setting)");
win_printf_line(window, THEME_DEFAULT, '!', " Triggers : OFF (global setting)");
}
}
win_printf_line(current, THEME_DEFAULT, '-', "");
@ -5394,7 +5394,7 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
} else {
ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify(mucwin->roomjid, TRUE);
win_vprintln_ch(window, '!', "Notifications enabled for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Notifications enabled for %s", mucwin->roomjid);
}
}
} else if (g_strcmp0(args[0], "off") == 0) {
@ -5409,7 +5409,7 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
} else {
ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify(mucwin->roomjid, FALSE);
win_vprintln_ch(window, '!', "Notifications disabled for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Notifications disabled for %s", mucwin->roomjid);
}
}
} else if (g_strcmp0(args[0], "mention") == 0) {
@ -5425,7 +5425,7 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
} else {
ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_mention(mucwin->roomjid, TRUE);
win_vprintln_ch(window, '!', "Mention notifications enabled for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Mention notifications enabled for %s", mucwin->roomjid);
}
} else if (g_strcmp0(args[1], "off") == 0) {
ProfWin *window = wins_get_current();
@ -5434,7 +5434,7 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
} else {
ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_mention(mucwin->roomjid, FALSE);
win_vprintln_ch(window, '!', "Mention notifications disabled for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Mention notifications disabled for %s", mucwin->roomjid);
}
} else {
cons_bad_cmd_usage(command);
@ -5453,7 +5453,7 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
} else {
ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_trigger(mucwin->roomjid, TRUE);
win_vprintln_ch(window, '!', "Custom trigger notifications enabled for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Custom trigger notifications enabled for %s", mucwin->roomjid);
}
} else if (g_strcmp0(args[1], "off") == 0) {
ProfWin *window = wins_get_current();
@ -5462,7 +5462,7 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
} else {
ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_trigger(mucwin->roomjid, FALSE);
win_vprintln_ch(window, '!', "Custom trigger notifications disabled for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Custom trigger notifications disabled for %s", mucwin->roomjid);
}
} else {
cons_bad_cmd_usage(command);
@ -5481,9 +5481,9 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
ProfMucWin *mucwin = (ProfMucWin*)window;
gboolean res = prefs_reset_room_notify(mucwin->roomjid);
if (res) {
win_vprintln_ch(window, '!', "Notification settings set to global defaults for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "Notification settings set to global defaults for %s", mucwin->roomjid);
} else {
win_vprintln_ch(window, '!', "No custom notification settings for %s", mucwin->roomjid);
win_printf_line(window, THEME_DEFAULT, '!', "No custom notification settings for %s", mucwin->roomjid);
}
}
}

View File

@ -138,41 +138,41 @@ chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *da
switch (event) {
case PROF_OTR_SMP_INIT:
win_vprintln_ch((ProfWin*)chatwin, '!',
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!',
"%s wants to authenticate your identity, use '/otr secret <secret>'.", chatwin->barejid);
break;
case PROF_OTR_SMP_INIT_Q:
win_vprintln_ch((ProfWin*)chatwin, '!',
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!',
"%s wants to authenticate your identity with the following question:", chatwin->barejid);
win_vprintln_ch((ProfWin*)chatwin, '!', " %s", (char*)data);
win_vprintln_ch((ProfWin*)chatwin, '!', "use '/otr answer <answer>'.");
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', " %s", (char*)data);
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "use '/otr answer <answer>'.");
break;
case PROF_OTR_SMP_SENDER_FAIL:
win_vprintln_ch((ProfWin*)chatwin, '!',
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!',
"Authentication failed, the secret you entered does not match the secret entered by %s.",
chatwin->barejid);
break;
case PROF_OTR_SMP_RECEIVER_FAIL:
win_vprintln_ch((ProfWin*)chatwin, '!',
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!',
"Authentication failed, the secret entered by %s does not match yours.", chatwin->barejid);
break;
case PROF_OTR_SMP_ABORT:
win_vprintln_ch((ProfWin*)chatwin, '!', "SMP session aborted.");
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "SMP session aborted.");
break;
case PROF_OTR_SMP_SUCCESS:
win_vprintln_ch((ProfWin*)chatwin, '!', "Authentication successful.");
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "Authentication successful.");
break;
case PROF_OTR_SMP_SUCCESS_Q:
win_vprintln_ch((ProfWin*)chatwin, '!', "%s successfully authenticated you.", chatwin->barejid);
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "%s successfully authenticated you.", chatwin->barejid);
break;
case PROF_OTR_SMP_FAIL_Q:
win_vprintln_ch((ProfWin*)chatwin, '!', "%s failed to authenticate you.", chatwin->barejid);
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "%s failed to authenticate you.", chatwin->barejid);
break;
case PROF_OTR_SMP_AUTH:
win_vprintln_ch((ProfWin*)chatwin, '!', "Authenticating %s...", chatwin->barejid);
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "Authenticating %s...", chatwin->barejid);
break;
case PROF_OTR_SMP_AUTH_WAIT:
win_vprintln_ch((ProfWin*)chatwin, '!', "Awaiting authentication from %s...", chatwin->barejid);
win_printf_line((ProfWin*)chatwin, THEME_DEFAULT, '!', "Awaiting authentication from %s...", chatwin->barejid);
break;
default:
break;

View File

@ -364,7 +364,6 @@ void win_show_occupant_info(ProfWin *window, const char *const room, Occupant *o
void win_show_contact(ProfWin *window, PContact contact);
void win_show_info(ProfWin *window, PContact contact);
void win_println(ProfWin *window, int pad, const char *const message);
void win_vprintln_ch(ProfWin *window, char ch, const char *const message, ...);
void win_clear(ProfWin *window);
char* win_to_string(ProfWin *window);

View File

@ -1115,18 +1115,6 @@ win_println(ProfWin *window, int pad, const char *const message)
win_printf(window, '-', pad, NULL, 0, THEME_DEFAULT, "", "%s", message);
}
void
win_vprintln_ch(ProfWin *window, char ch, const char *const message, ...)
{
va_list arg;
va_start(arg, message);
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
win_printf_line(window, THEME_DEFAULT, ch, "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);
}
void
win_newline(ProfWin *window)
{

View File

@ -529,7 +529,6 @@ void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *
void win_show_contact(ProfWin *window, PContact contact) {}
void win_show_info(ProfWin *window, PContact contact) {}
void win_println(ProfWin *window, int pad, const char * const message) {}
void win_vprintln_ch(ProfWin *window, char ch, const char *const message, ...) {}
void win_clear(ProfWin *window) {}
char* win_to_string(ProfWin *window)
{