From 1c3eadbf1cba45bfba839cc6bf4e0ea249e6df1c Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 20:35:01 +0000 Subject: [PATCH 01/11] Removed ui_get_chat_recipients --- src/profanity.c | 2 +- src/ui/core.c | 12 +----------- src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 4 ---- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/profanity.c b/src/profanity.c index 28eb4bf4..e4db293d 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -132,7 +132,7 @@ prof_handle_idle(void) { jabber_conn_status_t status = jabber_get_connection_status(); if (status == JABBER_CONNECTED) { - GSList *recipients = ui_get_chat_recipients(); + GSList *recipients = wins_get_chat_recipients(); GSList *curr = recipients; while (curr) { diff --git a/src/ui/core.c b/src/ui/core.c index 75fa61fb..0f451d61 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -76,17 +76,14 @@ #include "xmpp/xmpp.h" static char *win_title; - static int inp_size; - static gboolean perform_resize = FALSE; +static GTimer *ui_idle_time; #ifdef HAVE_LIBXSS static Display *display; #endif -static GTimer *ui_idle_time; - static void _ui_draw_term_title(void); void @@ -307,13 +304,6 @@ ui_contact_typing(const char *const barejid, const char *const resource) } } -GSList* -ui_get_chat_recipients(void) -{ - GSList *recipients = wins_get_chat_recipients(); - return recipients; -} - void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp) { diff --git a/src/ui/ui.h b/src/ui/ui.h index b3753dbb..171e0dc6 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -63,7 +63,6 @@ void ui_update(void); void ui_close(void); void ui_redraw(void); void ui_resize(void); -GSList* ui_get_chat_recipients(void); void ui_switch_win(ProfWin *window); void ui_sigwinch_handler(int sig); void ui_handle_otr_error(const char *const barejid, const char *const message); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index b98f630a..3a2336c7 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -64,10 +64,6 @@ void ui_update(void) {} void ui_close(void) {} void ui_redraw(void) {} void ui_resize(void) {} -GSList* ui_get_chat_recipients(void) -{ - return NULL; -} void ui_switch_win(ProfWin *win) {} From 2ea0e1e9384f298264aac4df99fcf4d93a807564 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 20:39:43 +0000 Subject: [PATCH 02/11] Removed ui_titlebar_presence --- src/profanity.c | 8 ++++---- src/ui/core.c | 6 ------ src/ui/titlebar.h | 1 - src/ui/ui.h | 4 +++- tests/unittests/ui/stub_ui.c | 4 +++- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/profanity.c b/src/profanity.c index e4db293d..a3afb3c2 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -227,7 +227,7 @@ _check_autoaway(void) } prefs_free_string(message); - ui_titlebar_presence(CONTACT_AWAY); + title_bar_set_presence(CONTACT_AWAY); } } else if (g_strcmp0(mode, "idle") == 0) { activity_state = ACTIVITY_ST_IDLE; @@ -267,7 +267,7 @@ _check_autoaway(void) } prefs_free_string(message); - ui_titlebar_presence(CONTACT_XA); + title_bar_set_presence(CONTACT_XA); } else if (check && (idle_ms < away_time_ms)) { activity_state = ACTIVITY_ST_ACTIVE; @@ -276,7 +276,7 @@ _check_autoaway(void) // send saved presence without last activity cl_ev_presence_send(saved_presence, saved_status, 0); contact_presence_t contact_pres = contact_presence_from_resource_presence(saved_presence); - ui_titlebar_presence(contact_pres); + title_bar_set_presence(contact_pres); } break; case ACTIVITY_ST_XA: @@ -288,7 +288,7 @@ _check_autoaway(void) // send saved presence without last activity cl_ev_presence_send(saved_presence, saved_status, 0); contact_presence_t contact_pres = contact_presence_from_resource_presence(saved_presence); - ui_titlebar_presence(contact_pres); + title_bar_set_presence(contact_pres); } break; } diff --git a/src/ui/core.c b/src/ui/core.c index 0f451d61..d9f8a6b1 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -394,12 +394,6 @@ ui_group_removed(const char *const contact, const char *const group) rosterwin_roster(); } -void -ui_titlebar_presence(contact_presence_t presence) -{ - title_bar_set_presence(presence); -} - void ui_handle_login_account_success(ProfAccount *account, int secured) { diff --git a/src/ui/titlebar.h b/src/ui/titlebar.h index 4e11107e..9328bd13 100644 --- a/src/ui/titlebar.h +++ b/src/ui/titlebar.h @@ -39,7 +39,6 @@ void create_title_bar(void); void title_bar_update_virtual(void); void title_bar_resize(void); void title_bar_console(void); -void title_bar_set_presence(contact_presence_t presence); void title_bar_set_connected(gboolean connected); void title_bar_set_tls(gboolean secured); void title_bar_switch(void); diff --git a/src/ui/ui.h b/src/ui/ui.h index 171e0dc6..c8e62069 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -132,7 +132,6 @@ void ui_prune_wins(void); gboolean ui_swap_wins(int source_win, int target_win); void ui_clear_win(ProfWin *window); void ui_auto_away(char *message, gint time, resource_presence_t res_presence); -void ui_titlebar_presence(contact_presence_t presence); void ui_handle_login_account_success(ProfAccount *account, int secured); void ui_update_presence(const resource_presence_t resource_presence, const char *const message, const char *const show); void ui_statusbar_new(const int win); @@ -300,6 +299,9 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l void cons_show_contact_offline(PContact contact, char *resource, char *status); void cons_theme_colours(void); +// title bar +void title_bar_set_presence(contact_presence_t presence); + // status bar void status_bar_inactive(const int win); void status_bar_active(const int win); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 3a2336c7..5a5f0da1 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -294,7 +294,6 @@ gboolean ui_swap_wins(int source_win, int target_win) return FALSE; } -void ui_titlebar_presence(contact_presence_t presence) {} void ui_handle_login_account_success(ProfAccount *account, int secured) {} void ui_update_presence(const resource_presence_t resource_presence, const char * const message, const char * const show) {} @@ -465,6 +464,9 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l void cons_show_contact_offline(PContact contact, char *resource, char *status) {} void cons_theme_colours(void) {} +// title bar +void title_bar_set_presence(contact_presence_t presence) {} + // status bar void status_bar_inactive(const int win) {} void status_bar_active(const int win) {} From 14a81fbbbe41c4950e6965897029c85488fc3d3f Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 20:46:52 +0000 Subject: [PATCH 03/11] Removed ui_handle_recipient_not_found --- src/ui/core.c | 12 ------------ src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 6 ------ 3 files changed, 19 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index d9f8a6b1..4536cd43 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -426,18 +426,6 @@ ui_update_presence(const resource_presence_t resource_presence, } } -void -ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg) -{ - // intended recipient was invalid chat room - ProfMucWin *mucwin = wins_get_muc(recipient); - if (mucwin) { - cons_show_error("Room %s not found: %s", recipient, err_msg); - win_vprint((ProfWin*) mucwin, '!', 0, NULL, 0, THEME_ERROR, "", "Room %s not found: %s", recipient, err_msg); - return; - } -} - void ui_handle_recipient_error(const char *const recipient, const char *const err_msg) { diff --git a/src/ui/ui.h b/src/ui/ui.h index c8e62069..3da97e22 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -106,7 +106,6 @@ void ui_contact_not_in_group(const char *const contact, const char *const group) void ui_group_added(const char *const contact, const char *const group); void ui_group_removed(const char *const contact, const char *const group); void ui_contact_offline(char *barejid, char *resource, char *status); -void ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg); void ui_handle_recipient_error(const char *const recipient, const char *const err_msg); void ui_handle_error(const char *const err_msg); void ui_clear_win_title(void); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 5a5f0da1..d5596ffb 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -243,12 +243,6 @@ void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status) void ui_contact_offline(char *barejid, char *resource, char *status) {} -void ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg) -{ - check_expected(recipient); - check_expected(err_msg); -} - void ui_handle_recipient_error(const char * const recipient, const char * const err_msg) { check_expected(recipient); From 75bce88b8a6abef4d995291e8db3f2ac3013ee4c Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 20:59:36 +0000 Subject: [PATCH 04/11] Renamed ui_switch_win -> ui_focus_win --- src/command/commands.c | 18 +++++++++--------- src/ui/core.c | 12 ++++++------ src/ui/inputwin.c | 6 +++--- src/ui/ui.h | 2 +- src/window_list.c | 6 +++--- tests/unittests/ui/stub_ui.c | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index a3c45d76..bbc06083 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -912,7 +912,7 @@ cmd_win(ProfWin *window, const char *const command, gchar **args) if (!focuswin) { cons_show("Window %d does not exist.", num); } else { - ui_switch_win(focuswin); + ui_focus_win(focuswin); } return TRUE; @@ -1499,7 +1499,7 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args) if (!privwin) { privwin = ui_new_private_win(full_jid->str); } - ui_switch_win((ProfWin*)privwin); + ui_focus_win((ProfWin*)privwin); if (msg) { cl_ev_send_priv_msg(privwin, msg); @@ -1524,7 +1524,7 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args) if (!chatwin) { chatwin = chatwin_new(barejid); } - ui_switch_win((ProfWin*)chatwin); + ui_focus_win((ProfWin*)chatwin); if (msg) { cl_ev_send_msg(chatwin, msg); @@ -2745,7 +2745,7 @@ cmd_form(ProfWin *window, const char *const command, gchar **args) if (!new_current) { new_current = wins_get_console(); } - ui_switch_win(new_current); + ui_focus_win(new_current); wins_close_by_num(num); } @@ -3094,7 +3094,7 @@ cmd_room(ProfWin *window, const char *const command, gchar **args) ProfMucConfWin *confwin = wins_get_muc_conf(mucwin->roomjid); if (confwin) { - ui_switch_win((ProfWin*)confwin); + ui_focus_win((ProfWin*)confwin); } else { iq_request_room_config_form(mucwin->roomjid); } @@ -4399,10 +4399,10 @@ cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args) { ProfXMLWin *xmlwin = wins_get_xmlconsole(); if (xmlwin) { - ui_switch_win((ProfWin*)xmlwin); + ui_focus_win((ProfWin*)xmlwin); } else { ProfWin *window = wins_new_xmlconsole(); - ui_switch_win(window); + ui_focus_win(window); } return TRUE; @@ -4712,7 +4712,7 @@ cmd_pgp(ProfWin *window, const char *const command, gchar **args) if (!chatwin) { chatwin = chatwin_new(barejid); } - ui_switch_win((ProfWin*)chatwin); + ui_focus_win((ProfWin*)chatwin); } else { chatwin = (ProfChatWin*)window; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); @@ -4913,7 +4913,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args) if (!chatwin) { chatwin = chatwin_new(barejid); } - ui_switch_win((ProfWin*)chatwin); + ui_focus_win((ProfWin*)chatwin); if (chatwin->pgp_send) { ui_current_print_formatted_line('!', 0, "You must disable PGP encryption before starting an OTR session."); diff --git a/src/ui/core.c b/src/ui/core.c index 4536cd43..09657238 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -664,7 +664,7 @@ ui_win_has_unsaved_form(int num) } void -ui_switch_win(ProfWin *window) +ui_focus_win(ProfWin *window) { assert(window != NULL); @@ -869,7 +869,7 @@ ui_room_join(const char *const roomjid, gboolean focus) if (focus) { - ui_switch_win(window); + ui_focus_win(window); } else { int num = wins_get_num(window); status_bar_active(num); @@ -883,7 +883,7 @@ void ui_switch_to_room(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - ui_switch_win(window); + ui_focus_win(window); } void @@ -1339,7 +1339,7 @@ ui_handle_room_configuration(const char *const roomjid, DataForm *form) ProfMucConfWin *confwin = (ProfMucConfWin*)window; assert(confwin->memcheck == PROFCONFWIN_MEMCHECK); - ui_switch_win(window); + ui_focus_win(window); ui_show_form(confwin); win_print(window, '-', 0, NULL, 0, 0, "", ""); @@ -1391,11 +1391,11 @@ ui_handle_room_config_submit_result(const char *const roomjid) } if (muc_window) { - ui_switch_win((ProfWin*)muc_window); + ui_focus_win((ProfWin*)muc_window); win_print(muc_window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room configuration successful"); } else { ProfWin *console = wins_get_console(); - ui_switch_win(console); + ui_focus_win(console); cons_show("Room configuration successful: %s", roomjid); } } else { diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index d875b77d..ac9fb477 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -456,7 +456,7 @@ _go_to_win(int i) { ProfWin *window = wins_get_by_num(i); if (window) { - ui_switch_win(window); + ui_focus_win(window); } } @@ -535,7 +535,7 @@ _inp_rl_altleft_handler(int count, int key) { ProfWin *window = wins_get_previous(); if (window) { - ui_switch_win(window); + ui_focus_win(window); } return 0; } @@ -545,7 +545,7 @@ _inp_rl_altright_handler(int count, int key) { ProfWin *window = wins_get_next(); if (window) { - ui_switch_win(window); + ui_focus_win(window); } return 0; } diff --git a/src/ui/ui.h b/src/ui/ui.h index 3da97e22..fd9072f3 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -63,7 +63,7 @@ void ui_update(void); void ui_close(void); void ui_redraw(void); void ui_resize(void); -void ui_switch_win(ProfWin *window); +void ui_focus_win(ProfWin *window); void ui_sigwinch_handler(int sig); void ui_handle_otr_error(const char *const barejid, const char *const message); unsigned long ui_get_idle_time(void); diff --git a/src/window_list.c b/src/window_list.c index 6e3f85b1..46da0e75 100644 --- a/src/window_list.c +++ b/src/window_list.c @@ -536,7 +536,7 @@ wins_swap(int source_win, int target_win) } if (wins_get_current_num() == source_win) { wins_set_current_by_num(target_win); - ui_switch_win(console); + ui_focus_win(console); } return TRUE; @@ -557,7 +557,7 @@ wins_swap(int source_win, int target_win) status_bar_active(source_win); } if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) { - ui_switch_win(console); + ui_focus_win(console); } return TRUE; } @@ -617,7 +617,7 @@ wins_tidy(void) windows = new_windows; current = 1; ProfWin *console = wins_get_console(); - ui_switch_win(console); + ui_focus_win(console); g_list_free(keys); return TRUE; } else { diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index d5596ffb..217f315f 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -65,7 +65,7 @@ void ui_close(void) {} void ui_redraw(void) {} void ui_resize(void) {} -void ui_switch_win(ProfWin *win) {} +void ui_focus_win(ProfWin *win) {} #ifdef HAVE_LIBOTR void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) {} From df5b93987f3a157e49b3d9078044fd0d0e88f17c Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:03:30 +0000 Subject: [PATCH 05/11] Removed ui_tidy_wins --- src/command/commands.c | 6 +++--- src/ui/core.c | 6 ------ src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 3 --- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index bbc06083..a5718eb8 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -857,7 +857,7 @@ cmd_wins(ProfWin *window, const char *const command, gchar **args) if (args[0] == NULL) { cons_show_wins(); } else if (strcmp(args[0], "tidy") == 0) { - if (ui_tidy_wins()) { + if (wins_tidy()) { cons_show("Windows tidied."); } else { cons_show("No tidy needed."); @@ -889,7 +889,7 @@ cmd_wins(ProfWin *window, const char *const command, gchar **args) if (g_strcmp0(args[1], "on") == 0) { cons_show("Window autotidy enabled"); prefs_set_boolean(PREF_WINS_AUTO_TIDY, TRUE); - ui_tidy_wins(); + wins_tidy(); } else if (g_strcmp0(args[1], "off") == 0) { cons_show("Window autotidy disabled"); prefs_set_boolean(PREF_WINS_AUTO_TIDY, FALSE); @@ -3600,7 +3600,7 @@ cmd_close(ProfWin *window, const char *const command, gchar **args) // Tidy up the window list. if (prefs_get_boolean(PREF_WINS_AUTO_TIDY)) { - ui_tidy_wins(); + wins_tidy(); } return TRUE; diff --git a/src/ui/core.c b/src/ui/core.c index 09657238..74b6bbc1 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -712,12 +712,6 @@ ui_close_win(int index) status_bar_active(1); } -gboolean -ui_tidy_wins(void) -{ - return wins_tidy(); -} - void ui_prune_wins(void) { diff --git a/src/ui/ui.h b/src/ui/ui.h index fd9072f3..0c4ee8eb 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -126,7 +126,6 @@ void ui_hide_all_room_rosters(void); void ui_handle_software_version_error(const char *const roomjid, const char *const message); void ui_show_software_version(const char *const jid, const char *const presence, const char *const name, const char *const version, const char *const os); -gboolean ui_tidy_wins(void); void ui_prune_wins(void); gboolean ui_swap_wins(int source_win, int target_win); void ui_clear_win(ProfWin *window); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 217f315f..bc1c08b4 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -279,9 +279,6 @@ void ui_redraw_all_room_rosters(void) {} void ui_show_all_room_rosters(void) {} void ui_hide_all_room_rosters(void) {} -gboolean ui_tidy_wins(void) { - return TRUE; -} void ui_prune_wins(void) {} gboolean ui_swap_wins(int source_win, int target_win) { From bcd19c6d16a3ff6892ad6aa41b68a2f97277239d Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:05:21 +0000 Subject: [PATCH 06/11] Removed ui_swap_wins --- src/command/commands.c | 2 +- src/ui/core.c | 6 ------ src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 4 ---- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index a5718eb8..8d0aeac9 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -875,7 +875,7 @@ cmd_wins(ProfWin *window, const char *const command, gchar **args) } else if (source_win == 10 || target_win == 10) { cons_show("Window 10 does not exist"); } else if (source_win != target_win) { - gboolean swapped = ui_swap_wins(source_win, target_win); + gboolean swapped = wins_swap(source_win, target_win); if (swapped) { cons_show("Swapped windows %d <-> %d", source_win, target_win); } else { diff --git a/src/ui/core.c b/src/ui/core.c index 74b6bbc1..9681a455 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -751,12 +751,6 @@ ui_prune_wins(void) } } -gboolean -ui_swap_wins(int source_win, int target_win) -{ - return wins_swap(source_win, target_win); -} - win_type_t ui_win_type(int index) { diff --git a/src/ui/ui.h b/src/ui/ui.h index 0c4ee8eb..27026620 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -127,7 +127,6 @@ void ui_handle_software_version_error(const char *const roomjid, const char *con void ui_show_software_version(const char *const jid, const char *const presence, const char *const name, const char *const version, const char *const os); void ui_prune_wins(void); -gboolean ui_swap_wins(int source_win, int target_win); void ui_clear_win(ProfWin *window); void ui_auto_away(char *message, gint time, resource_presence_t res_presence); void ui_handle_login_account_success(ProfAccount *account, int secured); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index bc1c08b4..b8414315 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -280,10 +280,6 @@ void ui_show_all_room_rosters(void) {} void ui_hide_all_room_rosters(void) {} void ui_prune_wins(void) {} -gboolean ui_swap_wins(int source_win, int target_win) -{ - return FALSE; -} void ui_handle_login_account_success(ProfAccount *account, int secured) {} void ui_update_presence(const resource_presence_t resource_presence, From 2089eebf09332a6ebb0dc584123d8b9486d2fc82 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:07:04 +0000 Subject: [PATCH 07/11] Removed ui_win_type --- src/ui/core.c | 7 ------- src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 6 ------ 3 files changed, 14 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index 9681a455..6dc85827 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -751,13 +751,6 @@ ui_prune_wins(void) } } -win_type_t -ui_win_type(int index) -{ - ProfWin *window = wins_get_by_num(index); - return window->type; -} - void ui_current_print_line(const char *const msg, ...) { diff --git a/src/ui/ui.h b/src/ui/ui.h index 27026620..87e0f30f 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -78,7 +78,6 @@ void ui_current_print_line(const char *const msg, ...); void ui_current_print_formatted_line(const char show_char, int attrs, const char *const msg, ...); void ui_current_error_line(const char *const msg); void ui_win_error_line(ProfWin *window, const char *const msg); -win_type_t ui_win_type(int index); void ui_close_win(int index); int ui_win_unread(int index); char* ui_ask_password(void); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index b8414315..900ab2df 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -136,12 +136,6 @@ void ui_current_print_formatted_line(const char show_char, int attrs, const char void ui_current_error_line(const char * const msg) {} void ui_win_error_line(ProfWin *window, const char * const msg) {} - -win_type_t ui_win_type(int index) -{ - return WIN_CONSOLE; -} - void ui_close_win(int index) {} int ui_win_unread(int index) From 7f5b563a8164360034949e302c7715cddd4490c1 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:11:47 +0000 Subject: [PATCH 08/11] Removed ui_handle_room_join_error --- src/ui/core.c | 6 ------ src/ui/ui.h | 1 - src/xmpp/presence.c | 2 +- tests/unittests/ui/stub_ui.c | 1 - 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index 6dc85827..37bc5b15 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -867,12 +867,6 @@ ui_switch_to_room(const char *const roomjid) ui_focus_win(window); } -void -ui_handle_room_join_error(const char *const roomjid, const char *const err) -{ - cons_show_error("Error joining room %s, reason: %s", roomjid, err); -} - void ui_room_destroy(const char *const roomjid) { diff --git a/src/ui/ui.h b/src/ui/ui.h index 87e0f30f..eecafe97 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -109,7 +109,6 @@ void ui_handle_recipient_error(const char *const recipient, const char *const er void ui_handle_error(const char *const err_msg); void ui_clear_win_title(void); void ui_goodbye_title(void); -void ui_handle_room_join_error(const char *const roomjid, const char *const err); void ui_handle_room_configuration(const char *const roomjid, DataForm *form); void ui_handle_room_configuration_form_error(const char *const roomjid, const char *const message); void ui_handle_room_config_submit_result(const char *const roomjid); diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index e335dbff..0743cbe2 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -390,7 +390,7 @@ _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, if (muc_active(fulljid->barejid)) { muc_leave(fulljid->barejid); } - ui_handle_room_join_error(fulljid->barejid, error_cond); + cons_show_error("Error joining room %s, reason: %s", fulljid->barejid, error_cond); jid_destroy(fulljid); return 1; } diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 900ab2df..b7c34f14 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -250,7 +250,6 @@ void ui_handle_error(const char * const err_msg) void ui_clear_win_title(void) {} void ui_goodbye_title(void) {} -void ui_handle_room_join_error(const char * const roomjid, const char * const err) {} void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {} void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {} void ui_handle_room_config_submit_result(const char * const roomjid) {} From 84adec83f970eeb0ff912ee016c69e48f2061550 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:14:55 +0000 Subject: [PATCH 09/11] Removed ui_unread --- src/ui/core.c | 8 +------- src/ui/notifier.c | 2 +- src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 4 ---- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index 37bc5b15..5221f592 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -972,12 +972,6 @@ ui_room_banned(const char *const roomjid, const char *const actor, const char *c } } -gint -ui_unread(void) -{ - return wins_get_total_unread(); -} - int ui_win_unread(int index) { @@ -1107,7 +1101,7 @@ _ui_draw_term_title(void) if (status == JABBER_CONNECTED) { const char * const jid = jabber_get_fulljid(); - gint unread = ui_unread(); + gint unread = wins_get_total_unread(); if (unread != 0) { snprintf(new_win_title, sizeof(new_win_title), diff --git a/src/ui/notifier.c b/src/ui/notifier.c index 3c24324f..9127b1e7 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -149,7 +149,7 @@ notify_remind(void) gdouble elapsed = g_timer_elapsed(remind_timer, NULL); gint remind_period = prefs_get_notify_remind(); if (remind_period > 0 && elapsed >= remind_period) { - gint unread = ui_unread(); + gint unread = wins_get_total_unread(); gint open = muc_invites_count(); gint subs = presence_sub_request_count(); diff --git a/src/ui/ui.h b/src/ui/ui.h index eecafe97..d3f5b91b 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -70,7 +70,6 @@ unsigned long ui_get_idle_time(void); void ui_reset_idle_time(void); ProfPrivateWin* ui_new_private_win(const char *const fulljid); void ui_print_system_msg_from_recipient(const char *const barejid, const char *message); -gint ui_unread(void); void ui_close_connected_win(int index); int ui_close_all_wins(void); int ui_close_read_wins(void); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index b7c34f14..fbb060b2 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -94,10 +94,6 @@ ProfChatWin* chatwin_new(const char * const barejid) } void ui_print_system_msg_from_recipient(const char * const barejid, const char *message) {} -gint ui_unread(void) -{ - return 0; -} void ui_close_connected_win(int index) {} int ui_close_all_wins(void) From 022d20bbdc69cc4831317ac3092310b86d8ca7d8 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:21:52 +0000 Subject: [PATCH 10/11] Removed ui_clear_win --- src/command/commands.c | 2 +- src/ui/core.c | 6 ------ src/ui/ui.h | 2 +- src/ui/window.h | 2 -- tests/unittests/ui/stub_ui.c | 3 +-- 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index 8d0aeac9..7c456a9b 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -3530,7 +3530,7 @@ cmd_tiny(ProfWin *window, const char *const command, gchar **args) gboolean cmd_clear(ProfWin *window, const char *const command, gchar **args) { - ui_clear_win(window); + win_clear(window); return TRUE; } diff --git a/src/ui/core.c b/src/ui/core.c index 5221f592..f7621ff3 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1074,12 +1074,6 @@ ui_clear_win_title(void) printf("%c]0;%c", '\033', '\007'); } -void -ui_clear_win(ProfWin *window) -{ - win_clear(window); -} - void ui_goodbye_title(void) { diff --git a/src/ui/ui.h b/src/ui/ui.h index d3f5b91b..b52badfd 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -124,7 +124,6 @@ void ui_handle_software_version_error(const char *const roomjid, const char *con void ui_show_software_version(const char *const jid, const char *const presence, const char *const name, const char *const version, const char *const os); void ui_prune_wins(void); -void ui_clear_win(ProfWin *window); void ui_auto_away(char *message, gint time, resource_presence_t res_presence); void ui_handle_login_account_success(ProfAccount *account, int secured); void ui_update_presence(const resource_presence_t resource_presence, const char *const message, const char *const show); @@ -332,6 +331,7 @@ 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); // desktop notifications void notifier_initialise(void); diff --git a/src/ui/window.h b/src/ui/window.h index 07191fc0..643cdf7b 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -72,8 +72,6 @@ void win_mark_received(ProfWin *window, const char *const id); gboolean win_has_active_subwin(ProfWin *window); -void win_clear(ProfWin *window); - void win_page_up(ProfWin *window); void win_page_down(ProfWin *window); void win_sub_page_down(ProfWin *window); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index fbb060b2..6e205d14 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -139,8 +139,6 @@ int ui_win_unread(int index) return 0; } -void ui_clear_win(ProfWin *window) {} - char * ui_ask_password(void) { return mock_ptr_type(char *); @@ -505,6 +503,7 @@ 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) {} // desktop notifier actions void notifier_uninit(void) {} From eece15d92ca8f022da31763f5a62b6f0b8c2805e Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 21:24:12 +0000 Subject: [PATCH 11/11] Removed ui_statusbar_new --- src/command/commands.c | 2 +- src/ui/core.c | 6 ------ src/ui/ui.h | 1 - tests/unittests/ui/stub_ui.c | 1 - 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index 7c456a9b..f7965576 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1467,7 +1467,7 @@ cmd_who(ProfWin *window, const char *const command, gchar **args) } if (window->type != WIN_CONSOLE && window->type != WIN_MUC) { - ui_statusbar_new(1); + status_bar_new(1); } return TRUE; diff --git a/src/ui/core.c b/src/ui/core.c index f7621ff3..6b154f64 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1081,12 +1081,6 @@ ui_goodbye_title(void) if(result == -1) log_error("Error printing title on shutdown"); } -void -ui_statusbar_new(const int win) -{ - status_bar_new(win); -} - static void _ui_draw_term_title(void) { diff --git a/src/ui/ui.h b/src/ui/ui.h index b52badfd..c93e6a81 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -127,7 +127,6 @@ void ui_prune_wins(void); void ui_auto_away(char *message, gint time, resource_presence_t res_presence); void ui_handle_login_account_success(ProfAccount *account, int secured); void ui_update_presence(const resource_presence_t resource_presence, const char *const message, const char *const show); -void ui_statusbar_new(const int win); void ui_write(char *line, int offset); void ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void)); gboolean ui_win_has_unsaved_form(int num); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 6e205d14..8fa40ff7 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -271,7 +271,6 @@ void ui_prune_wins(void) {} void ui_handle_login_account_success(ProfAccount *account, int secured) {} void ui_update_presence(const resource_presence_t resource_presence, const char * const message, const char * const show) {} -void ui_statusbar_new(const int win) {} char* inp_readline(void) {