Notification: use datetime

FossilOrigin-Name: f28ee17d1bf4d069ed7a53eda5e2bcf3b3c74c940da8b8692377a79d99a43c7e
This commit is contained in:
nekobit 2022-08-17 04:38:20 +00:00
parent dd066dad54
commit 1dcc0b67c0
2 changed files with 5 additions and 4 deletions

View File

@ -15,6 +15,7 @@
#ifndef MASTODONT_NOTIFICATION
#define MASTODONT_NOTIFICATION
#include <time.h>
#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;

View File

@ -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 = {