diff --git a/src/about.c b/src/about.c index 924085c..22b6379 100644 --- a/src/about.c +++ b/src/about.c @@ -20,7 +20,7 @@ #include "base_page.h" #include "about.h" -void content_about(PATH_ARGS) +int content_about(PATH_ARGS) { PERL_STACK_INIT; HV* session_hv = perlify_session(ssn); @@ -42,7 +42,7 @@ void content_about(PATH_ARGS) } -void content_about_license(PATH_ARGS) +int content_about_license(PATH_ARGS) { PERL_STACK_INIT; HV* session_hv = perlify_session(ssn); diff --git a/src/about.h b/src/about.h index da37397..b43be61 100644 --- a/src/about.h +++ b/src/about.h @@ -22,7 +22,7 @@ #include "session.h" #include "path.h" -void content_about_license(PATH_ARGS); -void content_about(PATH_ARGS); +int content_about_license(PATH_ARGS); +int content_about(PATH_ARGS); #endif /* ABOUT_H */ diff --git a/src/account.c b/src/account.c index a62dcd8..d663e54 100644 --- a/src/account.c +++ b/src/account.c @@ -286,7 +286,7 @@ static void fetch_account_page(FCGX_Request* req, tb_free(data); } -void content_account_statuses(PATH_ARGS) +int content_account_statuses(PATH_ARGS) { struct mstdnt_account_statuses_args args = { .pinned = 0, @@ -305,22 +305,22 @@ void content_account_statuses(PATH_ARGS) fetch_account_page(req, ssn, api, data[0], &args, ACCT_TAB_STATUSES, account_statuses_cb); } -void content_account_followers(PATH_ARGS) +int content_account_followers(PATH_ARGS) { fetch_account_page(req, ssn, api, data[0], NULL, ACCT_TAB_NONE, account_followers_cb); } -void content_account_following(PATH_ARGS) +int content_account_following(PATH_ARGS) { fetch_account_page(req, ssn, api, data[0], NULL, ACCT_TAB_NONE, account_following_cb); } -void content_account_scrobbles(PATH_ARGS) +int content_account_scrobbles(PATH_ARGS) { fetch_account_page(req, ssn, api, data[0], NULL, ACCT_TAB_SCROBBLES, account_scrobbles_cb); } -void content_account_pinned(PATH_ARGS) +int content_account_pinned(PATH_ARGS) { struct mstdnt_account_statuses_args args = { .pinned = 1, @@ -339,7 +339,7 @@ void content_account_pinned(PATH_ARGS) fetch_account_page(req, ssn, api, data[0], &args, ACCT_TAB_PINNED, account_statuses_cb); } -void content_account_media(PATH_ARGS) +int content_account_media(PATH_ARGS) { struct mstdnt_account_statuses_args args = { .pinned = 0, @@ -358,7 +358,7 @@ void content_account_media(PATH_ARGS) fetch_account_page(req, ssn, api, data[0], &args, ACCT_TAB_MEDIA, account_statuses_cb); } -void content_account_action(PATH_ARGS) +int content_account_action(PATH_ARGS) { char* referer = GET_ENV("HTTP_REFERER", req); struct mstdnt_storage storage = { 0 }; @@ -388,7 +388,7 @@ void content_account_action(PATH_ARGS) redirect(req, REDIRECT_303, referer); } -void content_account_bookmarks(PATH_ARGS) +int content_account_bookmarks(PATH_ARGS) { size_t statuses_len = 0; struct mstdnt_status* statuses = NULL; @@ -407,7 +407,7 @@ void content_account_bookmarks(PATH_ARGS) content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_BOOKMARKS, "Bookmarks", 0, 1); } -void content_account_blocked(PATH_ARGS) +int content_account_blocked(PATH_ARGS) { struct mstdnt_account_args args = { .max_id = keystr(ssn->post.max_id), @@ -439,7 +439,7 @@ void content_account_blocked(PATH_ARGS) tb_free(result); } -void content_account_muted(PATH_ARGS) +int content_account_muted(PATH_ARGS) { struct mstdnt_account_args args = { .max_id = keystr(ssn->post.max_id), @@ -471,7 +471,7 @@ void content_account_muted(PATH_ARGS) tb_free(result); } -void content_account_favourites(PATH_ARGS) +int content_account_favourites(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); diff --git a/src/account.h b/src/account.h index 97876b4..e6b90ab 100644 --- a/src/account.h +++ b/src/account.h @@ -58,17 +58,17 @@ struct account_page void get_account_info(mastodont_t* api, struct session* ssn); -void content_account_followers(PATH_ARGS); -void content_account_following(PATH_ARGS); -void content_account_statuses(PATH_ARGS); -void content_account_scrobbles(PATH_ARGS); -void content_account_pinned(PATH_ARGS); -void content_account_blocked(PATH_ARGS); -void content_account_muted(PATH_ARGS); -void content_account_media(PATH_ARGS); -void content_account_action(PATH_ARGS); -void content_account_favourites(PATH_ARGS); -void content_account_bookmarks(PATH_ARGS); +int content_account_followers(PATH_ARGS); +int content_account_following(PATH_ARGS); +int content_account_statuses(PATH_ARGS); +int content_account_scrobbles(PATH_ARGS); +int content_account_pinned(PATH_ARGS); +int content_account_blocked(PATH_ARGS); +int content_account_muted(PATH_ARGS); +int content_account_media(PATH_ARGS); +int content_account_action(PATH_ARGS); +int content_account_favourites(PATH_ARGS); +int content_account_bookmarks(PATH_ARGS); HV* perlify_account(const struct mstdnt_account* acct); AV* perlify_accounts(const struct mstdnt_account* accounts, size_t len); diff --git a/src/attachments.c b/src/attachments.c index ff49388..d5099e9 100644 --- a/src/attachments.c +++ b/src/attachments.c @@ -134,7 +134,7 @@ HV* perlify_attachment(const struct mstdnt_attachment* const attachment) PERLIFY_MULTI(attachment, attachments, mstdnt_attachment) -void api_attachment_create(PATH_ARGS) +int api_attachment_create(PATH_ARGS) { struct mstdnt_storage *att_storage = NULL; struct mstdnt_attachment* attachments = NULL; diff --git a/src/attachments.h b/src/attachments.h index 131b3da..4271a89 100644 --- a/src/attachments.h +++ b/src/attachments.h @@ -34,7 +34,7 @@ int try_upload_media(struct mstdnt_storage** storage, char*** media_ids); void cleanup_media_storages(struct session* ssn, struct mstdnt_storage* storage); void cleanup_media_ids(struct session* ssn, char** media_ids); -void api_attachment_create(PATH_ARGS); +int api_attachment_create(PATH_ARGS); // Perl HV* perlify_attachment(const struct mstdnt_attachment* const attachment); diff --git a/src/conversations.c b/src/conversations.c index 4ae075a..7ddd1be 100644 --- a/src/conversations.c +++ b/src/conversations.c @@ -26,7 +26,7 @@ #include "error.h" #include "base_page.h" -void content_chats(PATH_ARGS) +int content_chats(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -74,7 +74,7 @@ void content_chats(PATH_ARGS) tb_free(dup); } -void content_chat_view(PATH_ARGS) +int content_chat_view(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); diff --git a/src/conversations.h b/src/conversations.h index 453897a..b5bcd09 100644 --- a/src/conversations.h +++ b/src/conversations.h @@ -23,8 +23,8 @@ #include #include "session.h" -void content_chats(PATH_ARGS); -void content_chat_view(PATH_ARGS); +int content_chats(PATH_ARGS); +int content_chat_view(PATH_ARGS); AV* perlify_chats(const struct mstdnt_chat* chats, size_t chats_len); HV* perlify_chat(const struct mstdnt_chat* chat); diff --git a/src/emoji.c b/src/emoji.c index 7d5fc20..df969a6 100644 --- a/src/emoji.c +++ b/src/emoji.c @@ -66,7 +66,7 @@ static char* construct_emoji_voidwrap(void* passed, size_t index, size_t* res) #define EMOJI_PICKER_ARGS(this_index) { .status_id = status_id, .index = this_index } -void content_emoji_picker(PATH_ARGS) +int content_emoji_picker(PATH_ARGS) { char* picker = construct_emoji_picker(NULL, NULL); diff --git a/src/emoji.h b/src/emoji.h index 9d9e8cf..91a8ba4 100644 --- a/src/emoji.h +++ b/src/emoji.h @@ -34,7 +34,7 @@ enum emoji_picker_cat }; char* construct_emoji(struct emoji_info* emoji, char* status_id, size_t* size); -void content_emoji_picker(PATH_ARGS); +int content_emoji_picker(PATH_ARGS); char* construct_emoji_picker(char* status_id, size_t* size); // Perl diff --git a/src/index.c b/src/index.c index 6dc5722..07938aa 100644 --- a/src/index.c +++ b/src/index.c @@ -19,7 +19,7 @@ #include #include "timeline.h" -void content_index(FCGX_Request* req, struct session* ssn, mastodont_t* api) +int content_index(FCGX_Request* req, struct session* ssn, mastodont_t* api) { // Check logins content_tl_home(req, ssn, api, NULL); diff --git a/src/index.h b/src/index.h index 8ed4c61..06c824e 100644 --- a/src/index.h +++ b/src/index.h @@ -21,6 +21,6 @@ #include #include "session.h" -void content_index(FCGX_Request* req, struct session* ssn, mastodont_t* api); +int content_index(FCGX_Request* req, struct session* ssn, mastodont_t* api); #endif // INDEX_H diff --git a/src/lists.c b/src/lists.c index 90f89aa..5b6d4cf 100644 --- a/src/lists.c +++ b/src/lists.c @@ -30,7 +30,7 @@ #include "string_helpers.h" #include "http.h" -void content_lists(PATH_ARGS) +int content_lists(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -79,7 +79,7 @@ void content_lists(PATH_ARGS) tb_free(dup); } -void list_edit(PATH_ARGS) +int list_edit(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); diff --git a/src/lists.h b/src/lists.h index 9d55d84..9dd669b 100644 --- a/src/lists.h +++ b/src/lists.h @@ -23,9 +23,9 @@ #include "session.h" /** Creates the main lists view */ -void content_lists(PATH_ARGS); +int content_lists(PATH_ARGS); /** Creates a list and then redirects */ -void list_edit(PATH_ARGS); +int list_edit(PATH_ARGS); /** Converts list to perl hash */ HV* perlify_list(const struct mstdnt_list* list); diff --git a/src/login.c b/src/login.c index 77677ed..40605b0 100644 --- a/src/login.c +++ b/src/login.c @@ -41,7 +41,7 @@ static void apply_access_token(REQUEST_T req, char* token) config_url_prefix[0] != '\0' ? config_url_prefix : "/"); } -void content_login_oauth(PATH_ARGS) +int content_login_oauth(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -123,7 +123,7 @@ void content_login_oauth(PATH_ARGS) if (decode_url) curl_free(decode_url); } -void content_login(PATH_ARGS) +int content_login(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); diff --git a/src/login.h b/src/login.h index c7ae6a6..2fc21f6 100644 --- a/src/login.h +++ b/src/login.h @@ -23,7 +23,7 @@ #include "session.h" #include "path.h" -void content_login_oauth(PATH_ARGS); -void content_login(PATH_ARGS); +int content_login_oauth(PATH_ARGS); +int content_login(PATH_ARGS); #endif // LOGIN_H diff --git a/src/main.c b/src/main.c index 280ccf8..f809742 100644 --- a/src/main.c +++ b/src/main.c @@ -53,7 +53,7 @@ void boot_DynaLoader (pTHX_ CV* cv); #ifdef DEBUG static int quit = 0; -static void exit_treebird(PATH_ARGS) +static int exit_treebird(PATH_ARGS) { quit = 1; exit(1); @@ -127,8 +127,9 @@ static struct path_info paths[] = { { "/treebird_api/v1/attachment", api_attachment_create }, }; -static void application(mastodont_t* api, REQUEST_T req) +static int application(mastodont_t* api, REQUEST_T req) { + int rc; propagate_memory(); // Default config @@ -175,7 +176,7 @@ static void application(mastodont_t* api, REQUEST_T req) // Load current account information get_account_info(api, &ssn); - handle_paths(req, &ssn, api, paths, sizeof(paths)/sizeof(paths[0])); + rc = handle_paths(req, &ssn, api, paths, sizeof(paths)/sizeof(paths[0])); // Cleanup if (cookies_str) tb_free(cookies_str); @@ -200,9 +201,10 @@ static void fcgi_start(mastodont_t* api) rc = FCGX_Accept_r(&req); if (rc < 0) break; - application(api, &req); + rc = application(api, &req); - FCGX_Finish_r(&req); + if (rc) + FCGX_Finish_r(&req); } } #else diff --git a/src/memory_page.c b/src/memory_page.c index a74b2c5..6015936 100644 --- a/src/memory_page.c +++ b/src/memory_page.c @@ -20,7 +20,7 @@ #include "base_page.h" #include "memory.h" -void content_memory_stats(PATH_ARGS) +int content_memory_stats(PATH_ARGS) { PERL_STACK_INIT; HV* session_hv = perlify_session(ssn); diff --git a/src/memory_page.h b/src/memory_page.h index 94fe8ef..9630ef5 100644 --- a/src/memory_page.h +++ b/src/memory_page.h @@ -22,6 +22,6 @@ #include "session.h" #include "path.h" -void content_memory_stats(PATH_ARGS); +int content_memory_stats(PATH_ARGS); #endif // MEMORY_PAGE_H diff --git a/src/notifications.c b/src/notifications.c index e0cbf1a..f8eee77 100644 --- a/src/notifications.c +++ b/src/notifications.c @@ -32,7 +32,7 @@ #include "account.h" #include "../config.h" -void content_notifications(PATH_ARGS) +int content_notifications(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -83,7 +83,7 @@ void content_notifications(PATH_ARGS) tb_free(dup); } -void content_notifications_compact(PATH_ARGS) +int content_notifications_compact(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -128,7 +128,7 @@ void content_notifications_compact(PATH_ARGS) tb_free(page); } -void content_notifications_clear(PATH_ARGS) +int content_notifications_clear(PATH_ARGS) { char* referer = GET_ENV("HTTP_REFERER", req); struct mstdnt_args m_args; @@ -147,7 +147,7 @@ void content_notifications_clear(PATH_ARGS) redirect(req, REDIRECT_303, referer); } -void content_notifications_read(PATH_ARGS) +int content_notifications_read(PATH_ARGS) { char* referer = GET_ENV("HTTP_REFERER", req); struct mstdnt_args m_args; @@ -200,7 +200,7 @@ HV* perlify_notification(const struct mstdnt_notification* const notif) PERLIFY_MULTI(notification, notifications, mstdnt_notification) -void api_notifications(PATH_ARGS) +int api_notifications(PATH_ARGS) { send_result(req, NULL, "application/json", "{\"status\":0}", 0); } diff --git a/src/notifications.h b/src/notifications.h index 50b4339..1e60c8e 100644 --- a/src/notifications.h +++ b/src/notifications.h @@ -25,12 +25,12 @@ #include "cgi.h" // Page contents -void content_notifications(PATH_ARGS); -void content_notifications_compact(PATH_ARGS); -void content_notifications_clear(PATH_ARGS); -void content_notifications_read(PATH_ARGS); +int content_notifications(PATH_ARGS); +int content_notifications_compact(PATH_ARGS); +int content_notifications_clear(PATH_ARGS); +int content_notifications_read(PATH_ARGS); -void api_notifications(PATH_ARGS); +int api_notifications(PATH_ARGS); HV* perlify_notification(const struct mstdnt_notification* const notif); AV* perlify_notifications(const struct mstdnt_notification* const notif, size_t len); diff --git a/src/page_config.c b/src/page_config.c index 4a55cb3..16c7aed 100644 --- a/src/page_config.c +++ b/src/page_config.c @@ -40,7 +40,7 @@ enum config_category CONFIG_CAT_ACCOUNT }; -void content_config_general(PATH_ARGS) +int content_config_general(PATH_ARGS) { PERL_STACK_INIT; HV* session_hv = perlify_session(ssn); @@ -64,7 +64,7 @@ void content_config_general(PATH_ARGS) } -void content_config_appearance(PATH_ARGS) +int content_config_appearance(PATH_ARGS) { PERL_STACK_INIT; HV* session_hv = perlify_session(ssn); @@ -87,7 +87,7 @@ void content_config_appearance(PATH_ARGS) tb_free(dup); } -void content_config(PATH_ARGS) +int content_config(PATH_ARGS) { redirect(req, REDIRECT_303, "/config/general"); } diff --git a/src/page_config.h b/src/page_config.h index 5152755..bae047b 100644 --- a/src/page_config.h +++ b/src/page_config.h @@ -24,9 +24,9 @@ #include "session.h" #include "cgi.h" -void content_config_appearance(PATH_ARGS); -void content_config_general(PATH_ARGS); -//void content_config_account(PATH_ARGS); -void content_config(PATH_ARGS); +int content_config_appearance(PATH_ARGS); +int content_config_general(PATH_ARGS); +//int content_config_account(PATH_ARGS); +int content_config(PATH_ARGS); #endif // PAGE_CONFIG_H diff --git a/src/path.c b/src/path.c index a7f91d0..1e70a2e 100644 --- a/src/path.c +++ b/src/path.c @@ -28,7 +28,7 @@ int parse_path(REQUEST_T req, mastodont_t* api, struct path_info* path_info) { - int res = 0; + int res = -1; int fail = 0, fin = 0; char* p = path_info->path + 1; char* p2 = GET_ENV("PATH_INFO", req) + 1; @@ -85,11 +85,11 @@ int parse_path(REQUEST_T req, breakpt: if (!fail) { - path_info->callback(req, ssn, api, data); + res = path_info->callback(req, ssn, api, data); } else { - res = 1; + res = -1; } // Cleanup @@ -101,22 +101,23 @@ breakpt: return res; } -void handle_paths(REQUEST_T req, +int handle_paths(REQUEST_T req, struct session* ssn, mastodont_t* api, struct path_info* paths, size_t paths_len) { + int res; char* path = GET_ENV("PATH_INFO", req); // "default" path if (path == NULL || (path && strcmp(path, "/") == 0)) { - content_index(req, ssn, api); + return content_index(req, ssn, api); } else { // Generic path for (size_t i = 0; i < paths_len; ++i) { - if (parse_path(req, ssn, api, paths + i) == 0) + if ((res = parse_path(req, ssn, api, paths + i)) != -1) return; } diff --git a/src/path.h b/src/path.h index 407e0ab..d43b875 100644 --- a/src/path.h +++ b/src/path.h @@ -30,10 +30,10 @@ struct path_info { char* path; - void (*callback)(PATH_ARGS); + int (*callback)(PATH_ARGS); }; -void handle_paths( +int handle_paths( REQUEST_T req, struct session* ssn, mastodont_t* api, diff --git a/src/search.c b/src/search.c index 602ea3f..1ad4165 100644 --- a/src/search.c +++ b/src/search.c @@ -29,7 +29,7 @@ #include "error.h" #include "account.h" -void content_search_all(PATH_ARGS) +int content_search_all(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -102,7 +102,7 @@ void content_search_all(PATH_ARGS) tb_free(dup); } -void content_search_statuses(PATH_ARGS) +int content_search_statuses(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -149,7 +149,7 @@ void content_search_statuses(PATH_ARGS) tb_free(dup); } -void content_search_accounts(PATH_ARGS) +int content_search_accounts(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -195,7 +195,7 @@ void content_search_accounts(PATH_ARGS) tb_free(dup); } -void content_search_hashtags(PATH_ARGS) +int content_search_hashtags(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); diff --git a/src/search.h b/src/search.h index 7d30abf..a961949 100644 --- a/src/search.h +++ b/src/search.h @@ -23,10 +23,10 @@ #include "path.h" #include "global_perl.h" -void content_search_all(PATH_ARGS); -void content_search_statuses(PATH_ARGS); -void content_search_accounts(PATH_ARGS); -void content_search_hashtags(PATH_ARGS); +int content_search_all(PATH_ARGS); +int content_search_statuses(PATH_ARGS); +int content_search_accounts(PATH_ARGS); +int content_search_hashtags(PATH_ARGS); HV* perlify_search_results(struct mstdnt_search_results* results); #endif /* SEARCH_H */ diff --git a/src/status.c b/src/status.c index 764432d..0924b58 100644 --- a/src/status.c +++ b/src/status.c @@ -133,7 +133,7 @@ int try_react_status(struct session* ssn, mastodont_t* api, char* id, char* emoj return 0; } -void content_status_create(PATH_ARGS) +int content_status_create(PATH_ARGS) { char* referer = getenv("HTTP_REFERER"); @@ -142,7 +142,7 @@ void content_status_create(PATH_ARGS) redirect(req, REDIRECT_303, referer); } -void content_status_react(PATH_ARGS) +int content_status_react(PATH_ARGS) { char* referer = getenv("HTTP_REFERER"); @@ -219,7 +219,7 @@ char* get_in_reply_to(mastodont_t* api, } #endif -void status_interact(PATH_ARGS) +int status_interact(PATH_ARGS) { char* referer = GET_ENV("HTTP_REFERER", req); @@ -228,7 +228,7 @@ void status_interact(PATH_ARGS) redirect(req, REDIRECT_303, referer); } -void api_status_interact(PATH_ARGS) +int api_status_interact(PATH_ARGS) { if (try_interact_status(ssn, api, keystr(ssn->post.id)) == 0) { @@ -238,22 +238,22 @@ void api_status_interact(PATH_ARGS) send_result(req, NULL, "application/json", "{\"status\":\"Couldn't load status\"}", 0); } -void status_view(PATH_ARGS) +int status_view(PATH_ARGS) { content_status(req, ssn, api, data, STATUS_FOCUSED); } -void status_emoji(PATH_ARGS) +int status_emoji(PATH_ARGS) { content_status(req, ssn, api, data, STATUS_FOCUSED | STATUS_EMOJI_PICKER); } -void status_reply(PATH_ARGS) +int status_reply(PATH_ARGS) { content_status(req, ssn, api, data, STATUS_FOCUSED | STATUS_REPLY); } -void status_view_reblogs(PATH_ARGS) +int status_view_reblogs(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -282,7 +282,7 @@ void status_view_reblogs(PATH_ARGS) mstdnt_cleanup_accounts(reblogs, reblogs_len); } -void status_view_favourites(PATH_ARGS) +int status_view_favourites(PATH_ARGS) { struct mstdnt_args m_args; set_mstdnt_args(&m_args, ssn); @@ -412,7 +412,7 @@ void content_status(PATH_ARGS, uint8_t flags) tb_free(picker); } -void notice_redirect(PATH_ARGS) +int notice_redirect(PATH_ARGS) { char* url; easprintf(&url, "%s/status/%s", config_url_prefix, data[0]); diff --git a/src/status.h b/src/status.h index 5eca5de..411c64b 100644 --- a/src/status.h +++ b/src/status.h @@ -49,8 +49,8 @@ struct interact_profile_args int try_post_status(struct session* ssn, mastodont_t* api); int try_interact_status(struct session* ssn, mastodont_t* api, char* id); -void content_status_create(PATH_ARGS); -void content_status_react(PATH_ARGS); +int content_status_create(PATH_ARGS); +int content_status_react(PATH_ARGS); // HTML Builders @@ -63,8 +63,8 @@ char* get_in_reply_to(mastodont_t* api, size_t* size); #endif -void status_view_reblogs(PATH_ARGS); -void status_view_favourites(PATH_ARGS); +int status_view_reblogs(PATH_ARGS); +int status_view_favourites(PATH_ARGS); void content_status_interactions(FCGX_Request* req, struct session* ssn, @@ -74,10 +74,10 @@ void content_status_interactions(FCGX_Request* req, size_t accts_len); // Status frontends -void status_view(PATH_ARGS); -void status_reply(PATH_ARGS); -void status_interact(PATH_ARGS); -void status_emoji(PATH_ARGS); +int status_view(PATH_ARGS); +int status_reply(PATH_ARGS); +int status_interact(PATH_ARGS); +int status_emoji(PATH_ARGS); // Above wraps to the below function void content_status(PATH_ARGS, uint8_t flags); @@ -85,10 +85,10 @@ void content_status(PATH_ARGS, uint8_t flags); void cleanup_media_ids(struct session* ssn, char** media_ids); // Redirects -void notice_redirect(PATH_ARGS); +int notice_redirect(PATH_ARGS); // API -void api_status_interact(PATH_ARGS); +int api_status_interact(PATH_ARGS); // Perl HV* perlify_status_pleroma(const struct mstdnt_status_pleroma* pleroma); diff --git a/src/timeline.c b/src/timeline.c index a428d97..1819c54 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -229,7 +229,7 @@ void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag_id) tb_free(header); } -void content_tl_home(PATH_ARGS) +int content_tl_home(PATH_ARGS) { if (keystr(ssn->cookies.logged_in)) tl_home(req, ssn, api, 0); @@ -237,30 +237,30 @@ void content_tl_home(PATH_ARGS) content_tl_federated(req, ssn, api, data); } -void content_tl_direct(PATH_ARGS) +int content_tl_direct(PATH_ARGS) { (void)data; tl_direct(req, ssn, api); } -void content_tl_federated(PATH_ARGS) +int content_tl_federated(PATH_ARGS) { (void)data; tl_public(req, ssn, api, 0, BASE_CAT_FEDERATED); } -void content_tl_local(PATH_ARGS) +int content_tl_local(PATH_ARGS) { (void)data; tl_public(req, ssn, api, 1, BASE_CAT_LOCAL); } -void content_tl_list(PATH_ARGS) +int content_tl_list(PATH_ARGS) { tl_list(req, ssn, api, data[0]); } -void content_tl_tag(PATH_ARGS) +int content_tl_tag(PATH_ARGS) { tl_tag(req, ssn, api, data[0]); } diff --git a/src/timeline.h b/src/timeline.h index a4e58f4..cb3f687 100644 --- a/src/timeline.h +++ b/src/timeline.h @@ -44,22 +44,22 @@ void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag); /* ------------------------------------------------ */ /** Federated timeline */ -void content_tl_federated(PATH_ARGS); +int content_tl_federated(PATH_ARGS); /** Home timeline. Shows federated timeline if not logged in */ -void content_tl_home(PATH_ARGS); +int content_tl_home(PATH_ARGS); /** Direct message timeline */ -void content_tl_direct(PATH_ARGS); +int content_tl_direct(PATH_ARGS); /** Local/instance timeline */ -void content_tl_local(PATH_ARGS); +int content_tl_local(PATH_ARGS); /** List timeline */ -void content_tl_list(PATH_ARGS); +int content_tl_list(PATH_ARGS); /** Hashtag timeline */ -void content_tl_tag(PATH_ARGS); +int content_tl_tag(PATH_ARGS); /** * Used to create generic timeline content. This timeline includes other features