diff options
author | default <nobody@localhost> | 2023-02-05 17:45:00 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-02-05 17:45:00 +0100 |
commit | 71a7569467a53f8533c0eb0f5c62ed94744ed996 (patch) | |
tree | 7bebbe5d9059a1e7308ff87110cba718b6fd43c5 /data.c | |
parent | bad9f3a8c638f434bd04243791aecce950a104ba (diff) |
Deleted the type argument from object_get_my_md5() and object_get().
It was never used.
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 29 |
1 files changed, 9 insertions, 20 deletions
@@ -466,7 +466,7 @@ int object_here(char *id) } -int object_get_by_md5(const char *md5, d_char **obj, const char *type) +int object_get_by_md5(const char *md5, xs_dict **obj) /* returns a stored object, optionally of the requested type */ { int status = 404; @@ -481,19 +481,8 @@ int object_get_by_md5(const char *md5, d_char **obj, const char *type) *obj = xs_json_loads(j); - if (*obj) { + if (*obj) status = 200; - - /* specific type requested? */ - if (!xs_is_null(type)) { - char *v = xs_dict_get(*obj, "type"); - - if (xs_is_null(v) || strcmp(v, type) != 0) { - status = 404; - *obj = xs_free(*obj); - } - } - } } else *obj = NULL; @@ -502,11 +491,11 @@ int object_get_by_md5(const char *md5, d_char **obj, const char *type) } -int object_get(const char *id, d_char **obj, const char *type) +int object_get(const char *id, xs_dict **obj) /* returns a stored object, optionally of the requested type */ { xs *md5 = xs_md5_hex(id, strlen(id)); - return object_get_by_md5(md5, obj, type); + return object_get_by_md5(md5, obj); } @@ -803,7 +792,7 @@ d_char *follower_list(snac *snac) while (xs_list_iter(&p, &v)) { xs *a_obj = NULL; - if (valid_status(object_get_by_md5(v, &a_obj, NULL))) { + if (valid_status(object_get_by_md5(v, &a_obj))) { char *actor = xs_dict_get(a_obj, "id"); if (!xs_is_null(actor)) @@ -827,7 +816,7 @@ double timeline_mtime(snac *snac) int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg) /* gets a message from the timeline */ { - return object_get_by_md5(md5, msg, NULL); + return object_get_by_md5(md5, msg); } @@ -851,7 +840,7 @@ void timeline_update_indexes(snac *snac, const char *id) if (xs_startswith(id, snac->actor)) { xs *msg = NULL; - if (valid_status(object_get(id, &msg, NULL))) { + if (valid_status(object_get(id, &msg))) { /* if its ours and is public, also store in public */ if (is_msg_public(snac, msg)) object_user_cache_add(snac, id, "public"); @@ -1138,7 +1127,7 @@ void hide(snac *snac, const char *id) xs *co = NULL; /* resolve to get the id */ - if (valid_status(object_get_by_md5(v, &co, NULL))) { + if (valid_status(object_get_by_md5(v, &co))) { if ((v = xs_dict_get(co, "id")) != NULL) hide(snac, v); } @@ -1178,7 +1167,7 @@ int actor_get(snac *snac, const char *actor, d_char **data) } /* read the object */ - if (!valid_status(status = object_get(actor, &d, NULL))) + if (!valid_status(status = object_get(actor, &d))) return status; if (data) |