From 0a6b76d6d36455a118d95b2815f1ab5f16707bff Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 30 Apr 2015 21:23:43 +0100 Subject: Removed some ui functions, inlined --- src/command/commands.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/command') diff --git a/src/command/commands.c b/src/command/commands.c index 3ef37fc1..f85af612 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1331,7 +1331,9 @@ cmd_msg(gchar **args, struct cmd_help_t help) if (!chatwin) { chatwin = ui_ev_new_chat_win(barejid); } - ui_ev_focus_win((ProfWin*)chatwin); + if (!wins_is_current((ProfWin*)chatwin)) { + ui_ev_focus_win((ProfWin*)chatwin); + } if (msg) { cl_ev_send_msg(chatwin, msg); @@ -3180,7 +3182,7 @@ cmd_close(gchar **args, struct cmd_help_t help) int count = 0; if (args[0] == NULL) { - index = ui_current_win_index(); + index = wins_get_current_num(); } else if (strcmp(args[0], "all") == 0) { count = ui_close_all_wins(); if (count == 0) { @@ -3215,19 +3217,15 @@ cmd_close(gchar **args, struct cmd_help_t help) return TRUE; } - if (!ui_win_exists(index)) { + ProfWin *window = wins_get_by_num(index); + if (!window) { cons_show("Window is not open."); return TRUE; } // check for unsaved form if (ui_win_has_unsaved_form(index)) { - ProfWin *window = wins_get_current(); - if (wins_is_current(window)) { - ui_current_print_line("You have unsaved changes, use /form submit or /form cancel"); - } else { - cons_show("Cannot close form window with unsaved changes, use /form submit or /form cancel"); - } + ui_current_print_line("You have unsaved changes, use /form submit or /form cancel"); return TRUE; } @@ -3248,7 +3246,7 @@ cmd_leave(gchar **args, struct cmd_help_t help) { jabber_conn_status_t conn_status = jabber_get_connection_status(); win_type_t win_type = ui_current_win_type(); - int index = ui_current_win_index(); + int index = wins_get_current_num(); if (win_type != WIN_MUC) { cons_show("You can only use the /leave command in a chat room."); @@ -4173,7 +4171,9 @@ cmd_otr(gchar **args, struct cmd_help_t help) if (!chatwin) { chatwin = ui_ev_new_chat_win(barejid); } - ui_ev_focus_win((ProfWin*)chatwin); + if (!wins_is_current((ProfWin*)chatwin)) { + ui_ev_focus_win((ProfWin*)chatwin); + } if (ui_current_win_is_otr()) { ui_current_print_formatted_line('!', 0, "You are already in an OTR session."); -- cgit 1.4.1-2-gfad0