about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-12 00:06:36 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-04-12 00:06:36 +0200
commitaedecee962ab3bf72402bde5783cf953d6e24fd0 (patch)
tree8aa6a719a8a0af3121c38b3a6f009869a0f7af2c /src/xmpp
parentdd566d8d561099bbfc81b2fab22318bbad0cf3da (diff)
downloadprofani-tty-aedecee962ab3bf72402bde5783cf953d6e24fd0.tar.gz
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.
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/iq.c8
1 files changed, 7 insertions, 1 deletions
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);