From 72f613a014080c4b4988d749ee5f682aed253546 Mon Sep 17 00:00:00 2001 From: MarcoPolo-PasTonMolo Date: Sun, 10 Jul 2022 12:28:14 +0300 Subject: [PATCH] Handle MAM when chatwin gets created from incoming message --- src/event/server_events.c | 6 ++++++ src/ui/chatwin.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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);