about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/event/server_events.c7
-rw-r--r--src/otr/otr.c2
-rw-r--r--src/ui/core.c14
3 files changed, 10 insertions, 13 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index b4845b11..eb3e96e7 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -645,8 +645,8 @@ sv_ev_incoming_message(ProfMessage* message)
     chatwin = wins_get_chat(looking_for_jid);
 
     if (!chatwin) {
-        ProfWin* window = wins_new_chat(looking_for_jid);
-        chatwin = (ProfChatWin*)window;
+        chatwin = chatwin_new(looking_for_jid);
+        ProfWin* window = (ProfWin*)chatwin;
         new_win = TRUE;
 
         if (prefs_get_boolean(PREF_MAM)) {
@@ -689,8 +689,7 @@ sv_ev_incoming_carbon(ProfMessage* message)
     gboolean new_win = FALSE;
     ProfChatWin* chatwin = wins_get_chat(message->from_jid->barejid);
     if (!chatwin) {
-        ProfWin* window = wins_new_chat(message->from_jid->barejid);
-        chatwin = (ProfChatWin*)window;
+        chatwin = chatwin_new(message->from_jid->barejid);
         new_win = TRUE;
 
 #ifdef HAVE_OMEMO
diff --git a/src/otr/otr.c b/src/otr/otr.c
index 3297ce57..bbad51d5 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -151,7 +151,7 @@ cb_gone_secure(void* opdata, ConnContext* context)
 {
     ProfChatWin* chatwin = wins_get_chat(context->username);
     if (!chatwin) {
-        chatwin = (ProfChatWin*)wins_new_chat(context->username);
+        chatwin = chatwin_new(context->username);
     }
 
     chatwin_otr_secured(chatwin, otr_is_trusted(context->username));
diff --git a/src/ui/core.c b/src/ui/core.c
index 5ce42e50..7bcac08b 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -768,20 +768,18 @@ ui_print_system_msg_from_recipient(const char* const barejid, const char* messag
         return;
 
     ProfChatWin* chatwin = wins_get_chat(barejid);
-    ProfWin* window = (ProfWin*)chatwin;
-    if (window == NULL) {
-        window = wins_new_chat(barejid);
-        if (window) {
-            chatwin = (ProfChatWin*)window;
-            int num = wins_get_num(window);
+    if (chatwin == NULL) {
+        chatwin = chatwin_new(barejid);
+        if (chatwin) {
+            int num = wins_get_num((ProfWin*)chatwin);
             status_bar_active(num, WIN_CHAT, chatwin->barejid);
         } else {
-            window = wins_get_console();
+            chatwin = (ProfChatWin*)wins_get_console();
             status_bar_active(1, WIN_CONSOLE, "console");
         }
     }
 
-    win_println(window, THEME_DEFAULT, "-", "*%s %s", barejid, message);
+    win_println((ProfWin*)chatwin, THEME_DEFAULT, "-", "*%s %s", barejid, message);
 }
 
 void