about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-04-29 22:10:32 +0100
committerJames Booth <boothj5@gmail.com>2015-04-29 22:10:32 +0100
commit0df8b8beff8aeeae072beee8fc3ed69f9d132fb2 (patch)
tree0adc8936ae6e69c481c647d953f958472e0c47e7 /src/command
parent8de308c96af476de607d7ba5ecee5dc7c990ffc5 (diff)
downloadprofani-tty-0df8b8beff8aeeae072beee8fc3ed69f9d132fb2.tar.gz
Return new window on new chat win event
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 44069693..f583fa44 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -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.");