diff options
author | Jacki <jacki@thejackimonster.de> | 2024-04-18 21:32:49 +0200 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-04-18 21:32:49 +0200 |
commit | 6e68e9f9b50685a715e6ed73253de14c5ba0995b (patch) | |
tree | d78ea38809f0f4f3ecb666fe1cf85d4f80a70294 /src/gnunet_chat_lib.c | |
parent | cdb69d11f86721dc5d003bff5b478223b80aae0c (diff) | |
download | libgnunetchat-6e68e9f9b50685a715e6ed73253de14c5ba0995b.tar.gz libgnunetchat-6e68e9f9b50685a715e6ed73253de14c5ba0995b.zip |
Match known file handles by hash to uri
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'src/gnunet_chat_lib.c')
-rw-r--r-- | src/gnunet_chat_lib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index 28efc48..182f241 100644 --- 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, | |||
777 | 777 | ||
778 | if (!GNUNET_FS_uri_test_chk(uri->fs.uri)) | 778 | if (!GNUNET_FS_uri_test_chk(uri->fs.uri)) |
779 | return NULL; | 779 | return NULL; |
780 | |||
781 | const struct GNUNET_HashCode *hash = GNUNET_FS_uri_chk_get_file_hash( | ||
782 | uri->fs.uri | ||
783 | ); | ||
784 | |||
785 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( | ||
786 | handle->files, | ||
787 | hash | ||
788 | ); | ||
789 | |||
790 | if (file) | ||
791 | return file; | ||
780 | 792 | ||
781 | return file_create_from_chk_uri(handle, uri->fs.uri); | 793 | return file_create_from_chk_uri(handle, uri->fs.uri); |
782 | } | 794 | } |