Skip to content

Commit

Permalink
only add friends proxies when setting is turned on
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Feb 24, 2024
1 parent 45bcd86 commit b416f30
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/main/kotlin/com/zoffcc/applications/trifa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1487,30 +1487,33 @@ class MainActivity

if (data!![0].toUByte().toInt() == TRIFAGlobals.CONTROL_PROXY_MESSAGE_TYPE.CONTROL_PROXY_MESSAGE_TYPE_PROXY_PUBKEY_FOR_FRIEND.value)
{
if (length == (TOX_PUBLIC_KEY_SIZE + 1).toLong())
if (DB_PREF__use_other_toxproxies)
{
val relay_pubkey: String = bytes_to_hex(data).substring(2)
val new_friendnumber = tox_friend_add_norequest(relay_pubkey)
if (new_friendnumber > -1)
if (length == (TOX_PUBLIC_KEY_SIZE + 1).toLong())
{
if (new_friendnumber != UINT32_MAX_JAVA)
val relay_pubkey: String = bytes_to_hex(data).substring(2)
val new_friendnumber = tox_friend_add_norequest(relay_pubkey)
if (new_friendnumber > -1)
{
update_savedata_file_wrapper()
if (new_friendnumber != UINT32_MAX_JAVA)
{
update_savedata_file_wrapper()

Log.i(TAG, "friend_lossless_packet_cb:recevied CONTROL_PROXY_MESSAGE_TYPE_PROXY_PUBKEY_FOR_FRIEND")
Log.i(TAG, "friend_lossless_packet_cb:recevied pubkey:" + relay_pubkey.uppercase())
HelperFriend.add_friend_to_system(relay_pubkey.uppercase(), true, fpubkey)
Log.i(TAG, "friend_lossless_packet_cb:recevied CONTROL_PROXY_MESSAGE_TYPE_PROXY_PUBKEY_FOR_FRIEND")
Log.i(TAG, "friend_lossless_packet_cb:recevied pubkey:" + relay_pubkey.uppercase())
HelperFriend.add_friend_to_system(relay_pubkey.uppercase(), true, fpubkey)

try
{
contactstore.add(item = ContactItem(name = "Relay #" + relay_pubkey.uppercase().take(6),
isConnected = 0,
pubkey = relay_pubkey.uppercase(),
is_relay = true))
} catch (_: Exception)
{
try
{
contactstore.add(item = ContactItem(name = "Relay #" + relay_pubkey.uppercase().take(6),
isConnected = 0,
pubkey = relay_pubkey.uppercase(),
is_relay = true))
} catch (_: Exception)
{
}
SnackBarToast("Friend Relay updated or added")
}
SnackBarToast("Friend Relay updated or added")
}
}
}
Expand Down

0 comments on commit b416f30

Please sign in to comment.