Skip to content

Commit

Permalink
show ip addresses for group peers
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Mar 14, 2024
1 parent e91a139 commit 85179a2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions jni-c-toxcore/jni-c-toxcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7744,6 +7744,31 @@ Java_com_zoffcc_applications_trifa_MainActivity_tox_1group_1invite_1friend(JNIEn
#endif
}

JNIEXPORT jstring JNICALL
Java_com_zoffcc_applications_trifa_MainActivity_tox_1group_1get_1connection_1ip(JNIEnv *env, jobject thiz,
jlong group_number, jlong peer_id)
{
if(tox_global == NULL)
{
return NULL;
}

/*
const int ipv6_strlen_max = 39;
const int port_strlen_max = 5;
const int space_char_strlen_max = 1;
const int max_tcp_relays_per_friend = 6;
const int max_length = ((ipv6_strlen_max + space_char_strlen_max + port_strlen_max + 2) * max_tcp_relays_per_friend) + 10;
*/
// compiler hates humanity, so its a define now. silly.
#define IP_STR_MAX_STR_LEN (((39 + 1 + 5 + 2) * 6) + 10)
char ip_str[IP_STR_MAX_STR_LEN + 1];
CLEAR(ip_str);
tox_group_get_connection_ip(tox_global, (uint32_t)group_number, (uint32_t)peer_id, uint8_t *ip_str);
jstring js1 = c_safe_string_from_java((char *)ip_str, IP_STR_MAX_STR_LEN);
return js1;
}

JNIEXPORT jlong JNICALL
Java_com_zoffcc_applications_trifa_MainActivity_tox_1group_1new(JNIEnv *env, jobject thiz,
jint privacy_state, jobject group_name, jobject my_peer_name)
Expand Down

0 comments on commit 85179a2

Please sign in to comment.