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.c6
-rw-r--r--src/ui/chatwin.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 0f18c4e9..26c4963e 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -54,6 +54,7 @@
 #include "event/common.h"
 #include "plugins/plugins.h"
 #include "ui/window_list.h"
+#include "ui/window.h"
 #include "tools/bookmark_ignore.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/muc.h"
@@ -638,6 +639,11 @@ sv_ev_incoming_message(ProfMessage* message)
         chatwin = (ProfChatWin*)window;
         new_win = TRUE;
 
+        if (prefs_get_boolean(PREF_MAM)) {
+            iq_mam_request(chatwin);
+            win_print_loading_history(window);
+        }
+
 #ifdef HAVE_OMEMO
         if (!message->is_mam) {
             if (omemo_automatic_start(message->from_jid->barejid)) {
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 530739ae..7d583b43 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -320,7 +320,10 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
         }
 
         win_insert_last_read_position_marker((ProfWin*)chatwin, chatwin->barejid);
-        win_print_incoming(window, display_name, message);
+
+        if (!win_created || !prefs_get_boolean(PREF_MAM)) {
+            win_print_incoming(window, display_name, message);
+        }
     }
 
     wins_add_urls_ac(window, message);