From 0f81c86083e6f852f11bbec368a4ad1f94e9cb6b Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 25 Jan 2020 19:34:39 +0200 Subject: [PATCH] server: implement the :after parameter for contacts Parse the :after parameter as an iso-8601-like parameter, and use it for limiting the amount of contacts. --- mu/mu-cmd-server.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mu/mu-cmd-server.cc b/mu/mu-cmd-server.cc index 5628a824..b7360504 100644 --- a/mu/mu-cmd-server.cc +++ b/mu/mu-cmd-server.cc @@ -428,7 +428,7 @@ each_contact_sexp (const char* full_address, */ static char* contacts_to_sexp (const MuContacts *contacts, bool personal, - time_t last_seen, gint64 tstamp) + int64_t last_seen, gint64 tstamp) { g_return_val_if_fail (contacts, NULL); @@ -460,7 +460,8 @@ contacts_handler (Context& context, const Parameters& params) const auto afterstr = get_string_or(params, "after"); const auto tstampstr = get_string_or(params, "tstamp"); - const auto after = (time_t)g_ascii_strtoll (afterstr.c_str(), NULL, 10); + const auto after{afterstr.empty() ? 0 : + g_ascii_strtoll(date_to_time_t_string(afterstr, true).c_str(), {}, 10)}; const auto tstamp = g_ascii_strtoll (tstampstr.c_str(), NULL, 10); const auto contacts{mu_store_contacts(context.store)};