about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-07-05 11:12:29 +0300
committerMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-07-05 11:12:29 +0300
commit4d6e95d6911eab8fc9f6ddc0706c7b2ac5a25437 (patch)
tree2ff208c64cfdfb01df37672014b6676369621997 /src/xmpp
parent6429698f18b8b1fe3f8252402104c9701e62b620 (diff)
downloadprofani-tty-4d6e95d6911eab8fc9f6ddc0706c7b2ac5a25437.tar.gz
Add loading history message on initial MAM request
This prevents scrolling to top and initiating another MAM request while
still fetching the initial one.
Also free timestamp object in database.c
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/iq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 098d19db..1c851cbd 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -67,6 +67,7 @@
 #include "xmpp/roster.h"
 #include "xmpp/muc.h"
 #include "src/database.h"
+#include "ui/window.h"
 
 #ifdef HAVE_OMEMO
 #include "omemo/omemo.h"
@@ -2681,7 +2682,9 @@ _mam_rsm_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
         if (fin) {
             gboolean is_complete = g_strcmp0(xmpp_stanza_get_attribute(fin, "complete"), "true") == 0;
             MamRsmUserdata* data = (MamRsmUserdata*)userdata;
+            ProfWin* window = (ProfWin*)data->win;
 
+            buffer_remove_entry(window->layout->buffer, 0);
             if (is_complete || data->end_datestr) {
                 chatwin_old_history(data->win, is_complete ? NULL : data->start_datestr);
                 return 0;
@@ -2690,6 +2693,8 @@ _mam_rsm_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
 
             xmpp_stanza_t* set = xmpp_stanza_get_child_by_name_and_ns(fin, STANZA_TYPE_SET, STANZA_NS_RSM);
             if (set) {
+                win_print_loading_history(window);
+
                 char* firstid = NULL;
                 xmpp_stanza_t* first = xmpp_stanza_get_child_by_name(set, STANZA_NAME_FIRST);
                 firstid = xmpp_stanza_get_text(first);