1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge branch 'master' into pgp

This commit is contained in:
James Booth 2015-04-30 21:24:06 +01:00
commit 7730674f45
4 changed files with 13 additions and 36 deletions

View File

@ -1342,7 +1342,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);
@ -3191,7 +3193,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) {
@ -3226,19 +3228,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;
}
@ -3259,7 +3257,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.");
@ -4239,7 +4237,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.");

View File

@ -281,13 +281,6 @@ ui_load_colours(void)
}
}
gboolean
ui_win_exists(int index)
{
ProfWin *window = wins_get_by_num(index);
return (window != NULL);
}
gboolean
ui_xmlconsole_exists(void)
{
@ -882,7 +875,8 @@ ui_switch_win(ProfWin *win)
gboolean
ui_switch_win_num(const int i)
{
if (ui_win_exists(i)) {
ProfWin *window = wins_get_by_num(i);
if (window) {
ProfWin *old_current = wins_get_current();
if (old_current->type == WIN_MUC_CONFIG) {
ProfMucConfWin *confwin = (ProfMucConfWin*)old_current;
@ -1257,12 +1251,6 @@ ui_current_win_is_otr(void)
}
}
int
ui_current_win_index(void)
{
return wins_get_current_num();
}
win_type_t
ui_win_type(int index)
{

View File

@ -98,7 +98,6 @@ int ui_close_read_wins(void);
// current window actions
void ui_clear_current(void);
win_type_t ui_current_win_type(void);
int ui_current_win_index(void);
gboolean ui_current_win_is_otr(void);
ProfChatWin *ui_get_current_chat(void);
@ -110,7 +109,6 @@ 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);
gboolean ui_win_exists(int index);
int ui_win_unread(int index);
char * ui_ask_password(void);

View File

@ -135,11 +135,6 @@ win_type_t ui_current_win_type(void)
return (win_type_t)mock();
}
int ui_current_win_index(void)
{
return 0;
}
gboolean ui_current_win_is_otr(void)
{
return (gboolean)mock();
@ -180,10 +175,6 @@ win_type_t ui_win_type(int index)
}
void ui_close_win(int index) {}
gboolean ui_win_exists(int index)
{
return FALSE;
}
int ui_win_unread(int index)
{