aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-10-15 17:17:17 +0100
committerJames Booth <boothj5@gmail.com>2016-10-15 17:17:17 +0100
commit5488fd6e72de5c2143dfb5532043e9e1f9fb8343 (patch)
tree1ba83bbcd1ddefdd6b23494f8fdf2920bf9813e7
parent478c749ff96a78bdd97d4cc9928f8f3b25eec067 (diff)
downloadprofani-tty-5488fd6e72de5c2143dfb5532043e9e1f9fb8343.tar.gz
Remove win_vprintln_ch
-rw-r--r--src/command/cmd_funcs.c42
-rw-r--r--src/ui/chatwin.c24
-rw-r--r--src/ui/ui.h1
-rw-r--r--src/ui/window.c12
-rw-r--r--tests/unittests/ui/stub_ui.c1
5 files changed, 33 insertions, 47 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index b4b802b9..9c6ea3c4 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -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);
}
}
}
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 05a259f7..ba2bdc38 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -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;
diff --git a/src/ui/ui.h b/src/ui/ui.h
index c858a889..fbc6babb 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -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);
diff --git a/src/ui/window.c b/src/ui/window.c
index 13edd847..f5ab998f 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1116,18 +1116,6 @@ win_println(ProfWin *window, int pad, const char *const 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)
{
win_printf(window, '-', 0, NULL, NO_DATE, THEME_DEFAULT, "", "");
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 1d357c54..bbd6fd34 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -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)
{