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
This commit is contained in:
Cory McWilliams 2021-01-03 19:29:13 +00:00
parent 01ff073af0
commit 6ffdae6274

View File

@ -410,11 +410,20 @@ static void _tf_ssb_rpc_on_connections_changed(tf_ssb_t* ssb, tf_ssb_change_t ch
return; return;
} }
char connection_id[k_id_base64_len];
char 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); 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++) { for (int i = 0; ids && ids[i]; i++) {
tf_ssb_rpc_send_createHistoryStream(connection, ids[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); free(ids);
} }