From 6ffdae62742a00f3d80da2f1ed985c1a7f6f4f7f Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 3 Jan 2021 19:29:13 +0000 Subject: [PATCH] Friends of friends of connections is one step further than intended. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3626 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.rpc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index 411ed5ce..a89c404e 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -410,11 +410,20 @@ static void _tf_ssb_rpc_on_connections_changed(tf_ssb_t* ssb, tf_ssb_change_t ch return; } + char connection_id[k_id_base64_len]; char id[k_id_base64_len]; - if (tf_ssb_connection_get_id(connection, id, sizeof(id))) { + if (tf_ssb_connection_get_id(connection, connection_id, sizeof(connection_id)) && + tf_ssb_whoami(ssb, id, sizeof(id))) { const char** ids = tf_ssb_get_following_deep(ssb, (const char*[]) { id, NULL }, 2); + bool found_connection_id = false; for (int i = 0; ids && ids[i]; i++) { tf_ssb_rpc_send_createHistoryStream(connection, ids[i]); + if (strcmp(ids[i], connection_id) == 0) { + found_connection_id = true; + } + } + if (!found_connection_id) { + tf_ssb_rpc_send_createHistoryStream(connection, connection_id); } free(ids); }