libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit 6e68e9f9b50685a715e6ed73253de14c5ba0995b
parent cdb69d11f86721dc5d003bff5b478223b80aae0c
Author: Jacki <jacki@thejackimonster.de>
Date:   Thu, 18 Apr 2024 21:32:49 +0200

Match known file handles by hash to uri

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Msrc/gnunet_chat_lib.c | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c @@ -777,6 +777,18 @@ GNUNET_CHAT_request_file (struct GNUNET_CHAT_Handle *handle, if (!GNUNET_FS_uri_test_chk(uri->fs.uri)) return NULL; + + const struct GNUNET_HashCode *hash = GNUNET_FS_uri_chk_get_file_hash( + uri->fs.uri + ); + + struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( + handle->files, + hash + ); + + if (file) + return file; return file_create_from_chk_uri(handle, uri->fs.uri); }