about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-10-26 23:04:45 +0000
committerJames Booth <boothj5@gmail.com>2015-10-26 23:04:45 +0000
commit4fb0b4b0da41525a8c9d70937fcc538aae2877cb (patch)
tree599636699965a46ab83285dd5f98e7d82eb19d8e /src/ui
parent2efaa464bf6629a4f59be2834ce646d7abb8ecda (diff)
downloadprofani-tty-4fb0b4b0da41525a8c9d70937fcc538aae2877cb.tar.gz
ui_gone_secure takes ProfChatWin
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/chatwin.c16
-rw-r--r--src/ui/ui.h2
2 files changed, 5 insertions, 13 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 1f25d642..07159760 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -54,20 +54,12 @@ ui_message_receipt(ProfChatWin *chatwin, const char *const id)
 }
 
 void
-ui_gone_secure(const char *const barejid, gboolean trusted)
+ui_gone_secure(ProfChatWin *chatwin, gboolean trusted)
 {
-    ProfWin *window = NULL;
-
-    ProfChatWin *chatwin = wins_get_chat(barejid);
-    if (chatwin) {
-        window = (ProfWin*)chatwin;
-    } else {
-        window = wins_new_chat(barejid);
-        chatwin = (ProfChatWin*)window;
-    }
-
     chatwin->is_otr = TRUE;
     chatwin->otr_is_trusted = trusted;
+
+    ProfWin *window = (ProfWin*) chatwin;
     if (trusted) {
         win_print(window, '!', 0, NULL, 0, THEME_OTR_STARTED_TRUSTED, "", "OTR session started (trusted).");
     } else {
@@ -84,7 +76,7 @@ ui_gone_secure(const char *const barejid, gboolean trusted)
         if (ui_index == 10) {
             ui_index = 0;
         }
-        cons_show("%s started an OTR session (%d).", barejid, ui_index);
+        cons_show("%s started an OTR session (%d).", chatwin->barejid, ui_index);
         cons_alert();
     }
 }
diff --git a/src/ui/ui.h b/src/ui/ui.h
index c4d8d8cb..693cda39 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -62,7 +62,7 @@ GSList* ui_get_chat_recipients(void);
 void ui_switch_win(ProfWin *window);
 void ui_sigwinch_handler(int sig);
 
-void ui_gone_secure(const char *const barejid, gboolean trusted);
+void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted);
 void ui_gone_insecure(const char *const barejid);
 void ui_trust(const char *const barejid);
 void ui_untrust(const char *const barejid);