1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Return new window on new chat win event

This commit is contained in:
James Booth 2015-04-29 22:10:32 +01:00
parent 8de308c96a
commit 0df8b8beff
3 changed files with 9 additions and 12 deletions

View File

@ -1332,11 +1332,10 @@ cmd_msg(gchar **args, struct cmd_help_t help)
return TRUE;
} else {
ProfWin *window = (ProfWin*)wins_get_chat(barejid);
if (window) {
ui_ev_focus_win(window);
} else {
ui_ev_new_chat_win(barejid);
if (!window) {
window = ui_ev_new_chat_win(barejid);
}
ui_ev_focus_win(window);
#ifdef HAVE_LIBOTR
if (otr_is_secure(barejid)) {
@ -4171,11 +4170,10 @@ cmd_otr(gchar **args, struct cmd_help_t help)
}
ProfWin *window = (ProfWin*)wins_get_chat(barejid);
if (window) {
ui_ev_focus_win(window);
} else {
ui_ev_new_chat_win(barejid);
if (!window) {
window = ui_ev_new_chat_win(barejid);
}
ui_ev_focus_win(window);
if (ui_current_win_is_otr()) {
ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");

View File

@ -40,9 +40,8 @@ ui_ev_focus_win(ProfWin *win)
ui_switch_win(win);
}
void
ProfWin*
ui_ev_new_chat_win(const char * const barejid)
{
ProfWin *win = ui_new_chat_win(barejid);
ui_switch_win(win);
return ui_new_chat_win(barejid);
}

View File

@ -36,6 +36,6 @@
#define UI_EVENTS_H
void ui_ev_focus_win(ProfWin *win);
void ui_ev_new_chat_win(const char * const barejid);
ProfWin* ui_ev_new_chat_win(const char * const barejid);
#endif