Skip to content

Commit

Permalink
show more info for filetransfer files
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Dec 15, 2024
1 parent a6528b8 commit 9696ece
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/kotlin/com/zoffcc/applications/trifa2/ChatMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,33 @@ fun message_timestamp_and_info(message: UIMessage, msg_version_int: Int)
}
val msg_v2_hash_str = if (message.msg_id_hash.isNullOrEmpty()) "" else message.msg_id_hash
val msg_v3_hash_str = if (message.msg_idv3_hash.isNullOrEmpty()) "" else message.msg_idv3_hash
var file_info_lines = ""
if (message.trifaMsgType == TRIFA_MSG_TYPE.TRIFA_MSG_FILE.value)
{
if (message.filename_fullpath.isNullOrEmpty())
{
file_info_lines = "File fullpath: " + "???" + "\n"
}
else
{
file_info_lines = "File fullpath: " + message.filename_fullpath + "\n"
}
try
{
file_info_lines = file_info_lines + "File size in bytes: " + File(message.filename_fullpath!!).length() + "\n"
}
catch(_: Exception)
{
file_info_lines = file_info_lines + "File size: " + "???" + "\n"
}
}
Tooltip("Message sent at: " + timeToString(message.sentTimeMs) + "\n" +
"Message rcvd at: " + timeToString(message.recvTimeMs) + "\n" +
"Message size in bytes: " + (if (message_size_in_bytes == 0) "unknown" else message_size_in_bytes) + "\n" +
"Message version: " + msg_version_int + "\n" +
"Message V2 Hash: " + msg_v2_hash_str + "\n" +
"Message V3 Hash: " + msg_v3_hash_str + "\n" +
file_info_lines +
"The clocks on both sides are not synchronized for security reasons, " + "\n" +
"therfore the timestamps may not be accurate") {
Text(
Expand Down
21 changes: 21 additions & 0 deletions src/main/kotlin/com/zoffcc/applications/trifa2/GroupChatMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,33 @@ fun message_timestamp_and_info(groupmessage: UIGroupMessage)
} catch (_: Exception)
{
}
var file_info_lines = ""
if (groupmessage.trifaMsgType == TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_FILE.value)
{
if (groupmessage.filename_fullpath.isNullOrEmpty())
{
file_info_lines = "File fullpath: " + "???" + "\n"
}
else
{
file_info_lines = "File fullpath: " + groupmessage.filename_fullpath + "\n"
}
try
{
file_info_lines = file_info_lines + "File size in bytes: " + File(groupmessage.filename_fullpath!!).length() + "\n"
}
catch(_: Exception)
{
file_info_lines = file_info_lines + "File size: " + "???" + "\n"
}
}
val is_prv_msg = if (groupmessage.is_private_msg == 1) "yes" else "no"
Tooltip("Message sent at: " + timeToString(groupmessage.timeMs) + "\n" +
"Message ID: " + groupmessage.message_id_tox + "\n" +
"is private Message: " + is_prv_msg + "\n" +
"Sender Peer Pubkey: " + groupmessage.toxpk + "\n" +
"Message size in bytes: " + (if (message_size_in_bytes == 0) "unknown" else message_size_in_bytes) + "\n" +
file_info_lines +
"was synced: " + groupmessage.was_synced.toString()) {
Text(
modifier = Modifier.padding(all = 0.dp),
Expand Down

0 comments on commit 9696ece

Please sign in to comment.