diff --git a/src/account.c b/src/account.c index d4ec25a..9ddbbf9 100644 --- a/src/account.c +++ b/src/account.c @@ -122,7 +122,6 @@ static void fetch_account_page(struct session* ssn, struct mstdnt_relationship* relationships = NULL; size_t relationships_len = 0; - int lookup_type = config_experimental_lookup ? MSTDNT_LOOKUP_ACCT : MSTDNT_LOOKUP_ID; if (mastodont_get_account(api, lookup_type, id, &acct, &storage)) @@ -358,8 +357,7 @@ void content_account_bookmarks(struct session* ssn, mastodont_t* api, char** dat struct mstdnt_storage storage = { 0 }; char* status_format = NULL, *navigation_box = NULL, - *output = NULL, - *page = NULL; + *output = NULL; char* start_id; struct mstdnt_bookmarks_args args = { @@ -391,11 +389,8 @@ void content_account_bookmarks(struct session* ssn, mastodont_t* api, char** dat NULL); } - easprintf(&page, "%s%s", - STR_NULL_EMPTY(status_format), + easprintf(&output, data_bookmarks_page_html, status_format, STR_NULL_EMPTY(navigation_box)); - - easprintf(&output, data_bookmarks_page_html, page); struct base_page b = { .category = BASE_CAT_BOOKMARKS, @@ -413,7 +408,6 @@ void content_account_bookmarks(struct session* ssn, mastodont_t* api, char** dat if (status_format) free(status_format); if (navigation_box) free(navigation_box); if (output) free(output); - if (page) free(page); } void content_account_favourites(struct session* ssn, mastodont_t* api, char** data) @@ -454,12 +448,8 @@ void content_account_favourites(struct session* ssn, mastodont_t* api, char** da statuses[status_count-1].id, NULL); } - - easprintf(&page, "%s%s", - STR_NULL_EMPTY(status_format), - STR_NULL_EMPTY(navigation_box)); - - easprintf(&output, data_favourites_page_html, page); + easprintf(&output, data_favourites_page_html, status_format, + navigation_box ? navigation_box : ""); struct base_page b = { .category = BASE_CAT_FAVOURITES, @@ -477,5 +467,4 @@ void content_account_favourites(struct session* ssn, mastodont_t* api, char** da if (status_format) free(status_format); if (navigation_box) free(navigation_box); if (output) free(output); - if (page) free(page); } diff --git a/src/notifications.c b/src/notifications.c index d12b275..b97bfd8 100644 --- a/src/notifications.c +++ b/src/notifications.c @@ -185,8 +185,8 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data) .exclude_visibilities = 0, .include_types = 0, .with_muted = 1, - .max_id = NULL, - .min_id = NULL, + .max_id = ssn->post.max_id, + .min_id = ssn->post.min_id, .since_id = NULL, .offset = 0, .limit = 20, @@ -195,12 +195,12 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data) if (mastodont_get_notifications(api, &args, &storage, ¬ifs, ¬ifs_len) == 0) { notif_html = construct_notifications(api, notifs, notifs_len, NULL); - mstdnt_cleanup_notifications(notifs, notifs_len); start_id = ssn->post.start_id ? ssn->post.start_id : notifs[0].id; navigation_box = construct_navigation_box(start_id, notifs[0].id, notifs[notifs_len-1].id, NULL); + mstdnt_cleanup_notifications(notifs, notifs_len); } else notif_html = construct_error(storage.error, E_NOTICE, 1, NULL); @@ -209,7 +209,7 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data) easprintf(&page, data_notifications_page_html, notif_html ? notif_html : "", - navigation_box); + navigation_box ? navigation_box : ""); struct base_page b = { .category = BASE_CAT_NOTIFICATIONS, diff --git a/src/status.c b/src/status.c index 69c8895..2cfbe4a 100644 --- a/src/status.c +++ b/src/status.c @@ -365,6 +365,8 @@ char* construct_status(mastodont_t* api, size_t favourites_len = 0; size_t reblogs_len = 0; + if (!status) return NULL; + // If focused, show status interactions if ((flags & STATUS_FOCUSED) == STATUS_FOCUSED && (status->reblogs_count || status->favourites_count)) @@ -493,6 +495,7 @@ static char* construct_status_voidwrap(void* passed, size_t index, int* res) char* construct_statuses(mastodont_t* api, struct mstdnt_status* statuses, size_t size, size_t* ret_size) { + if (!(statuses && size)) return NULL; struct status_args args = { .api = api, .status = statuses, diff --git a/static/bookmarks_page.html b/static/bookmarks_page.html index 7d08ba4..457168a 100644 --- a/static/bookmarks_page.html +++ b/static/bookmarks_page.html @@ -4,3 +4,4 @@
%s
+%s diff --git a/static/favourites_page.html b/static/favourites_page.html index c5f84a8..1a9b227 100644 --- a/static/favourites_page.html +++ b/static/favourites_page.html @@ -4,3 +4,4 @@
%s
+%s