mirror of
https://git.checksum.fail/alec/slon.git
synced 2025-12-08 12:09:55 +02:00
Everywhere: Make session->send() callable
This commit is contained in:
@@ -157,7 +157,7 @@ U0 @slon_api_v1_accounts_post(SlonHttpSession* session)
|
||||
relationship->set("requested", FALSE, JSON_BOOLEAN);
|
||||
relationship->set("domain_blocking", FALSE, JSON_BOOLEAN);
|
||||
relationship->set("endorsed", FALSE, JSON_BOOLEAN);
|
||||
@slon_http_send_json(session, relationship);
|
||||
session->send(relationship);
|
||||
goto slon_api_v1_accounts_post_return;
|
||||
}
|
||||
session->status(404);
|
||||
@@ -229,7 +229,7 @@ U0 @slon_api_v1_accounts_get(SlonHttpSession* session)
|
||||
}
|
||||
}
|
||||
|
||||
@slon_http_send_json(session, relationships);
|
||||
session->send(relationships);
|
||||
Json.Delete(relationships);
|
||||
goto slon_api_v1_accounts_get_return;
|
||||
} else {
|
||||
@@ -240,7 +240,7 @@ U0 @slon_api_v1_accounts_get(SlonHttpSession* session)
|
||||
SLON_AUTH_ACCOUNT_ID
|
||||
acct = @slon_api_account_by_id(account_id);
|
||||
if (acct) {
|
||||
@slon_http_send_json(session, acct);
|
||||
session->send(acct);
|
||||
} else {
|
||||
session->status(404);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ U0 @slon_api_v1_accounts_get(SlonHttpSession* session)
|
||||
U8* method = path_segments[4];
|
||||
if (!StrICmp("following", method)) {
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
goto slon_api_v1_accounts_get_return;
|
||||
}
|
||||
if (!StrICmp("statuses", method)) {
|
||||
@@ -329,7 +329,7 @@ U0 @slon_api_v1_accounts_get(SlonHttpSession* session)
|
||||
}
|
||||
}
|
||||
|
||||
@slon_http_send_json(session, statuses);
|
||||
session->send(statuses);
|
||||
|
||||
Json.Delete(statuses);
|
||||
goto slon_api_v1_accounts_get_return;
|
||||
@@ -339,7 +339,7 @@ U0 @slon_api_v1_accounts_get(SlonHttpSession* session)
|
||||
// Return the Account profile
|
||||
JsonObject* profile_object = Json.Clone(acct);
|
||||
profile_object->unset("source");
|
||||
@slon_http_send_json(session, profile_object);
|
||||
session->send(profile_object);
|
||||
Json.Delete(profile_object);
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ U0 @slon_api_v1_accounts_patch(SlonHttpSession* session)
|
||||
|
||||
@slon_db_save_accounts_to_disk;
|
||||
@slon_db_actors_update_user(acct);
|
||||
@slon_http_send_json(session, acct);
|
||||
session->send(acct);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ U0 @slon_api_v1_apps_post(SlonHttpSession* session)
|
||||
db->o("apps")->set(client_id, credential_app, JSON_OBJECT);
|
||||
@slon_db_save_apps_to_disk;
|
||||
|
||||
@slon_http_send_json(session, credential_app);
|
||||
session->send(credential_app);
|
||||
|
||||
@slon_free(session, id);
|
||||
@slon_free(session, client_id);
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_blocks_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_bookmarks_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_conversations_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_custom_emojis_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_favourites_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_filters_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_follow_requests_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ U0 @slon_api_v1_followed_tags_get(SlonHttpSession* session)
|
||||
if (@slon_api_authorized(session)) {
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ U0 @slon_api_v1_notifications_get(SlonHttpSession* session)
|
||||
// SLON_AUTH_ACCOUNT_ID
|
||||
// FIXME: Implement this
|
||||
if (String.EndsWith("policy", @slon_http_request_path(session))) {
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_OBJECT);
|
||||
session->send(SLON_EMPTY_JSON_OBJECT);
|
||||
} else {
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
}
|
||||
} else {
|
||||
session->status(401);
|
||||
|
||||
@@ -8,7 +8,7 @@ U0 @slon_api_v1_statuses_delete(SlonHttpSession* session)
|
||||
|
||||
JsonArray* statuses = db->o("statuses")->a(account_id);
|
||||
if (!statuses || !statuses->length) {
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_OBJECT);
|
||||
session->send(SLON_EMPTY_JSON_OBJECT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ U0 @slon_api_v1_statuses_delete(SlonHttpSession* session)
|
||||
slon_api_v1_statuses_delete_return:
|
||||
Free(path_segments);
|
||||
@slon_free(session, path);
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_OBJECT);
|
||||
session->send(SLON_EMPTY_JSON_OBJECT);
|
||||
} else {
|
||||
session->status(401);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ U0 @slon_api_v1_statuses_post(SlonHttpSession* session)
|
||||
}
|
||||
}
|
||||
|
||||
@slon_http_send_json(session, status);
|
||||
session->send(status);
|
||||
|
||||
Json.Delete(status_app);
|
||||
Json.Delete(account_object);
|
||||
|
||||
@@ -6,7 +6,7 @@ U0 @slon_api_v1_timelines_home(SlonHttpSession* session, U8* account_id)
|
||||
// Return the Account's Home timeline
|
||||
JsonArray* status_array = db->o("timelines")->o("home")->a(account_id);
|
||||
if (!status_array) {
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ U0 @slon_api_v1_timelines_home(SlonHttpSession* session, U8* account_id)
|
||||
}
|
||||
}
|
||||
|
||||
@slon_http_send_json(session, statuses);
|
||||
session->send(statuses);
|
||||
|
||||
Json.Delete(statuses);
|
||||
}
|
||||
@@ -94,13 +94,13 @@ U0 @slon_api_v1_timelines_get(SlonHttpSession* session)
|
||||
|
||||
if (!StrICmp("public", path_segments[3])) {
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
goto slon_api_v1_timelines_get_return;
|
||||
}
|
||||
|
||||
if (!StrICmp("tag", path_segments[3])) {
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
goto slon_api_v1_timelines_get_return;
|
||||
}
|
||||
|
||||
@@ -112,13 +112,13 @@ U0 @slon_api_v1_timelines_get(SlonHttpSession* session)
|
||||
|
||||
if (!StrICmp("link", path_segments[3])) {
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
goto slon_api_v1_timelines_get_return;
|
||||
}
|
||||
|
||||
if (!StrICmp("list", path_segments[3])) {
|
||||
// FIXME: Implement this
|
||||
@slon_http_send_json(session, SLON_EMPTY_JSON_ARRAY);
|
||||
session->send(SLON_EMPTY_JSON_ARRAY);
|
||||
goto slon_api_v1_timelines_get_return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user