aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet_chat_lib_intern.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet_chat_lib_intern.c')
-rw-r--r--src/gnunet_chat_lib_intern.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gnunet_chat_lib_intern.c b/src/gnunet_chat_lib_intern.c
index d19b0eb..3ad5d4f 100644
--- a/src/gnunet_chat_lib_intern.c
+++ b/src/gnunet_chat_lib_intern.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2021 GNUnet e.V. 3 Copyright (C) 2021--2022 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -156,17 +156,29 @@ struct GNUNET_CHAT_ContextIterateFiles
156 156
157int 157int
158it_context_iterate_files (void *cls, 158it_context_iterate_files (void *cls,
159 GNUNET_UNUSED const struct GNUNET_HashCode *key, 159 const struct GNUNET_HashCode *key,
160 void *value) 160 GNUNET_UNUSED void *value)
161{ 161{
162 GNUNET_assert((cls) && (value)); 162 GNUNET_assert((cls) && (key));
163 163
164 struct GNUNET_CHAT_ContextIterateFiles *it = cls; 164 struct GNUNET_CHAT_ContextIterateFiles *it = cls;
165 165
166 if (!(it->cb)) 166 if (!(it->cb))
167 return GNUNET_YES; 167 return GNUNET_YES;
168 168
169 struct GNUNET_CHAT_File *file = value; 169 struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get(
170 it->context->messages, key
171 );
172
173 if (!message)
174 return GNUNET_YES;
175
176 struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get(
177 it->context->handle->files, &(message->hash)
178 );
179
180 if (!file)
181 return GNUNET_YES;
170 182
171 return it->cb(it->cls, it->context, file); 183 return it->cb(it->cls, it->context, file);
172} 184}