From aedecee962ab3bf72402bde5783cf953d6e24fd0 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Sun, 12 Apr 2020 00:06:36 +0200 Subject: [PATCH] Get MAM since yesterday Later we will have several options. Getting everything since last timestamp (if none everything at all). Getting everything since today + configure time (1 week). Should also have a reload all command like conversations once you cleared the history. All MAM messages should be written into sql db. And then probably displayed from there so that regular history works too. --- src/xmpp/iq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index b36ca229..e6d34d9d 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -2508,7 +2508,13 @@ iq_mam_request(ProfChatWin *win) xmpp_ctx_t * const ctx = connection_get_ctx(); char *id = connection_create_stanza_id(); - xmpp_stanza_t *iq = stanza_create_mam_iq(ctx, win->barejid, "2020-01-06T00:00:00Z"); + + GDateTime *timestamp = g_date_time_new_now_local(); + timestamp = g_date_time_add_days(timestamp, -1); + gchar *datestr = g_date_time_format(timestamp,"%FT%T%:::z"); + xmpp_stanza_t *iq = stanza_create_mam_iq(ctx, win->barejid, datestr); + g_free(datestr); + g_date_time_unref(timestamp); // iq_id_handler_add(id, _http_upload_response_id_handler, NULL, upload); free(id);