diff options
author | Jacki <jacki@thejackimonster.de> | 2024-02-20 00:41:38 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-02-20 00:41:38 +0100 |
commit | 4bf5c1d2b40272db5c232bd499af4bb26ddab88e (patch) | |
tree | 7d5e790db1aeff58fc92d6f91b60d0cd7a6190bb /src/gnunet_chat_context.c | |
parent | 864110d3d23724a50ddc974ffb4b5de4addea958 (diff) | |
download | libgnunetchat-4bf5c1d2b40272db5c232bd499af4bb26ddab88e.tar.gz libgnunetchat-4bf5c1d2b40272db5c232bd499af4bb26ddab88e.zip |
Adjust blocking implementation to handle custom tag values too
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'src/gnunet_chat_context.c')
-rw-r--r-- | src/gnunet_chat_context.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gnunet_chat_context.c b/src/gnunet_chat_context.c index 5c867e1..3505d42 100644 --- a/src/gnunet_chat_context.c +++ b/src/gnunet_chat_context.c | |||
@@ -51,7 +51,7 @@ init_new_context (struct GNUNET_CHAT_Context *context, | |||
51 | initial_map_size, GNUNET_NO); | 51 | initial_map_size, GNUNET_NO); |
52 | context->messages = GNUNET_CONTAINER_multihashmap_create( | 52 | context->messages = GNUNET_CONTAINER_multihashmap_create( |
53 | initial_map_size, GNUNET_NO); | 53 | initial_map_size, GNUNET_NO); |
54 | context->rejections = GNUNET_CONTAINER_multihashmap_create( | 54 | context->taggings = GNUNET_CONTAINER_multihashmap_create( |
55 | initial_map_size, GNUNET_NO); | 55 | initial_map_size, GNUNET_NO); |
56 | context->invites = GNUNET_CONTAINER_multihashmap_create( | 56 | context->invites = GNUNET_CONTAINER_multihashmap_create( |
57 | initial_map_size, GNUNET_NO); | 57 | initial_map_size, GNUNET_NO); |
@@ -112,7 +112,7 @@ context_destroy (struct GNUNET_CHAT_Context *context) | |||
112 | (context->timestamps) && | 112 | (context->timestamps) && |
113 | (context->dependencies) && | 113 | (context->dependencies) && |
114 | (context->messages) && | 114 | (context->messages) && |
115 | (context->rejections) && | 115 | (context->taggings) && |
116 | (context->invites) && | 116 | (context->invites) && |
117 | (context->files) | 117 | (context->files) |
118 | ); | 118 | ); |
@@ -129,7 +129,10 @@ context_destroy (struct GNUNET_CHAT_Context *context) | |||
129 | context->messages, it_destroy_context_messages, NULL | 129 | context->messages, it_destroy_context_messages, NULL |
130 | ); | 130 | ); |
131 | 131 | ||
132 | GNUNET_CONTAINER_multihashmap_clear(context->rejections); | 132 | GNUNET_CONTAINER_multihashmap_iterate( |
133 | context->taggings, it_destroy_context_taggings, NULL | ||
134 | ); | ||
135 | |||
133 | GNUNET_CONTAINER_multihashmap_iterate( | 136 | GNUNET_CONTAINER_multihashmap_iterate( |
134 | context->invites, it_destroy_context_invites, NULL | 137 | context->invites, it_destroy_context_invites, NULL |
135 | ); | 138 | ); |
@@ -139,7 +142,7 @@ context_destroy (struct GNUNET_CHAT_Context *context) | |||
139 | GNUNET_CONTAINER_multishortmap_destroy(context->timestamps); | 142 | GNUNET_CONTAINER_multishortmap_destroy(context->timestamps); |
140 | GNUNET_CONTAINER_multihashmap_destroy(context->dependencies); | 143 | GNUNET_CONTAINER_multihashmap_destroy(context->dependencies); |
141 | GNUNET_CONTAINER_multihashmap_destroy(context->messages); | 144 | GNUNET_CONTAINER_multihashmap_destroy(context->messages); |
142 | GNUNET_CONTAINER_multihashmap_destroy(context->rejections); | 145 | GNUNET_CONTAINER_multihashmap_destroy(context->taggings); |
143 | GNUNET_CONTAINER_multihashmap_destroy(context->invites); | 146 | GNUNET_CONTAINER_multihashmap_destroy(context->invites); |
144 | GNUNET_CONTAINER_multihashmap_destroy(context->files); | 147 | GNUNET_CONTAINER_multihashmap_destroy(context->files); |
145 | 148 | ||
@@ -319,14 +322,15 @@ context_delete_message (struct GNUNET_CHAT_Context *context, | |||
319 | } | 322 | } |
320 | case GNUNET_MESSENGER_KIND_TAG: | 323 | case GNUNET_MESSENGER_KIND_TAG: |
321 | { | 324 | { |
322 | if (message->msg->body.tag.tag) | 325 | struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get( |
323 | break; | 326 | context->taggings, |
327 | &(message->msg->body.tag.hash) | ||
328 | ); | ||
324 | 329 | ||
325 | GNUNET_CONTAINER_multihashmap_remove( | 330 | if (!tagging) |
326 | context->rejections, | 331 | break; |
327 | &(message->msg->body.tag.hash), | ||
328 | message); | ||
329 | 332 | ||
333 | tagging_remove(tagging, message); | ||
330 | break; | 334 | break; |
331 | } | 335 | } |
332 | default: | 336 | default: |