From e6d44b32f4649615d299aba8991f15cdb31a5cac Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 12 Apr 2023 23:06:56 +0000 Subject: [PATCH] Seems we no longer need _tf_ssb_followingDeep. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4255 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.js.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/src/ssb.js.c b/src/ssb.js.c index 0f5d8d7d..056d6f61 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -1046,45 +1046,6 @@ static JSValue _tf_ssb_createTunnel(JSContext* context, JSValueConst this_val, i return result; } -static JSValue _tf_ssb_followingDeep(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) -{ - int depth = 2; - if (!JS_IsArray(context, argv[0])) - { - return JS_ThrowTypeError(context, "Expected argument 1 to be an array of ids."); - } - if (JS_ToInt32(context, &depth, argv[1])) - { - return JS_ThrowTypeError(context, "Could not convert argument 2 to integer."); - } - - int count = tf_util_get_length(context, argv[0]); - const char** ids = tf_malloc(count * sizeof(char*)); - for (int i = 0; i < count; i++) - { - JSValue id = JS_GetPropertyUint32(context, argv[0], i); - ids[i] = JS_ToCString(context, id); - JS_FreeValue(context, id); - } - - tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId); - const char** following_deep = tf_ssb_db_following_deep(ssb, ids, count, depth); - JSValue result = JS_NewArray(context); - int index = 0; - for (const char** id = following_deep; *id; id++) - { - JS_SetPropertyUint32(context, result, index++, JS_NewString(context, *id)); - } - tf_free(following_deep); - - for (int i = 0; i < count; i++) - { - JS_FreeCString(context, ids[i]); - } - tf_free(ids); - return result; -} - enum { k_max_private_message_recipients = 8 }; static bool _tf_ssb_get_private_key_curve25519(sqlite3* db, const char* user, const char* identity, uint8_t out_private_key[static crypto_sign_SECRETKEYBYTES]) @@ -1357,7 +1318,6 @@ void tf_ssb_register(JSContext* context, tf_ssb_t* ssb) JS_SetPropertyStr(context, object, "getBroadcasts", JS_NewCFunction(context, _tf_ssb_getBroadcasts, "getBroadcasts", 0)); JS_SetPropertyStr(context, object, "connect", JS_NewCFunction(context, _tf_ssb_connect, "connect", 1)); JS_SetPropertyStr(context, object, "createTunnel", JS_NewCFunction(context, _tf_ssb_createTunnel, "createTunnel", 3)); - JS_SetPropertyStr(context, object, "followingDeep", JS_NewCFunction(context, _tf_ssb_followingDeep, "followingDeep", 2)); /* Should be trusted only. */ JS_SetPropertyStr(context, object, "addEventListener", JS_NewCFunction(context, _tf_ssb_add_event_listener, "addEventListener", 2));