From 1dcc0b67c06598a86440b5fd17be1ab7b579667b Mon Sep 17 00:00:00 2001 From: nekobit Date: Wed, 17 Aug 2022 04:38:20 +0000 Subject: [PATCH] Notification: use datetime FossilOrigin-Name: f28ee17d1bf4d069ed7a53eda5e2bcf3b3c74c940da8b8692377a79d99a43c7e --- include/mastodont_notification.h | 3 ++- src/notification.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/mastodont_notification.h b/include/mastodont_notification.h index d739b6d..6676756 100644 --- a/include/mastodont_notification.h +++ b/include/mastodont_notification.h @@ -15,6 +15,7 @@ #ifndef MASTODONT_NOTIFICATION #define MASTODONT_NOTIFICATION +#include #include "mastodont_types.h" #include "mastodont_account.h" #include "mastodont_status.h" @@ -31,7 +32,7 @@ struct mstdnt_notification_pleroma struct mstdnt_notification { char* id; - char* created_at; + time_t created_at; char* emoji; struct mstdnt_account* account; struct mstdnt_status* status; diff --git a/src/notification.c b/src/notification.c index 96b2638..07bf0e5 100644 --- a/src/notification.c +++ b/src/notification.c @@ -66,7 +66,7 @@ int mstdnt_notification_json(struct mstdnt_notification* notif, cJSON* js) struct _mstdnt_val_ref vals[] = { { "account", &(notif->account), _mstdnt_val_malloc_account_call }, - { "created_at", &(notif->created_at), _mstdnt_val_string_call }, + { "created_at", &(notif->created_at), _mstdnt_val_datetime_unix_call }, { "emoji", &(notif->emoji), _mstdnt_val_string_call }, { "id", &(notif->id), _mstdnt_val_string_call }, { "status", &(notif->status), _mstdnt_val_malloc_status_call }, @@ -205,8 +205,8 @@ int mastodont_notifications_read(mastodont_t* data, struct mstdnt_notification* notification) { struct _mstdnt_query_param params[] = { - { _MSTDNT_QUERY_STRING, "id", { .s = args->id } }, - { _MSTDNT_QUERY_STRING, "max_id", { .s = args->max_id } }, + { _MSTDNT_QUERY_STRING, "id", { .s = args ? args->id : NULL } }, + { _MSTDNT_QUERY_STRING, "max_id", { .s = args ? args->max_id : NULL } }, }; struct mastodont_request_args req_args = {