about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-19 00:03:11 +0100
committerJames Booth <boothj5@gmail.com>2014-04-19 00:03:36 +0100
commit71aea78e90da371ca3a290f3bcd1925a7bdbcba1 (patch)
treefbb5c015eb2f6541e3925bdfe73ddae37efc0baf /src
parent8f2c0a66bfeb4ac38989b31fbaaf83f1dd7017e6 (diff)
downloadprofani-tty-71aea78e90da371ca3a290f3bcd1925a7bdbcba1.tar.gz
Open new window when otr session started by contact
fixes #331
Diffstat (limited to 'src')
-rw-r--r--src/ui/core.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index b6acc925..6e7b992a 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -751,21 +751,26 @@ static void
 _ui_gone_secure(const char * const recipient, gboolean trusted)
 {
     ProfWin *window = wins_get_by_recipient(recipient);
-    if (window != NULL) {
-        window->is_otr = TRUE;
-        window->is_trusted = trusted;
-        if (trusted) {
-            win_vprint_line(window, '!', COLOUR_OTR_STARTED_TRUSTED, "OTR session started (trusted).");
-        } else {
-            win_vprint_line(window, '!', COLOUR_OTR_STARTED_UNTRUSTED, "OTR session started (untrusted).");
-        }
+    if (window == NULL) {
+        window = wins_new(recipient, WIN_CHAT);
+    }
 
-        if (wins_is_current(window)) {
-            GString *recipient_str = _get_recipient_string(window);
-            title_bar_set_recipient(recipient_str->str);
-            g_string_free(recipient_str, TRUE);
-            win_update_virtual(window);
-        }
+    window->is_otr = TRUE;
+    window->is_trusted = trusted;
+    if (trusted) {
+        win_vprint_line(window, '!', COLOUR_OTR_STARTED_TRUSTED, "OTR session started (trusted).");
+    } else {
+        win_vprint_line(window, '!', COLOUR_OTR_STARTED_UNTRUSTED, "OTR session started (untrusted).");
+    }
+
+    if (wins_is_current(window)) {
+        GString *recipient_str = _get_recipient_string(window);
+        title_bar_set_recipient(recipient_str->str);
+        g_string_free(recipient_str, TRUE);
+        win_update_virtual(window);
+    } else {
+        int num = wins_get_num(window);
+        status_bar_new(num);
     }
 }