diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-15 01:09:32 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-15 01:09:32 +0100 |
commit | bf0bb934cc4c62c4aefedaab205ba0035747bdd4 (patch) | |
tree | b06c5e94691aa6009ea53dc131b62da7dcc834e0 /src/gnunet_chat_handle_intern.c | |
parent | 4d5a8e4212aa2b6929fc6021fc17ac560a8cfab3 (diff) | |
download | libgnunetchat-bf0bb934cc4c62c4aefedaab205ba0035747bdd4.tar.gz libgnunetchat-bf0bb934cc4c62c4aefedaab205ba0035747bdd4.zip |
Handled unknown chats to update type and be treated as valid chats
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/gnunet_chat_handle_intern.c')
-rw-r--r-- | src/gnunet_chat_handle_intern.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c index 7538814..9f69611 100644 --- a/src/gnunet_chat_handle_intern.c +++ b/src/gnunet_chat_handle_intern.c | |||
@@ -284,7 +284,11 @@ request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, | |||
284 | handle->contexts, key | 284 | handle->contexts, key |
285 | ); | 285 | ); |
286 | 286 | ||
287 | if (context) | 287 | struct GNUNET_CHAT_CheckHandleRoomMembers check; |
288 | |||
289 | if ((context) && (GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN == context->type)) | ||
290 | goto check_context_type; | ||
291 | else if (context) | ||
288 | return GNUNET_OK; | 292 | return GNUNET_OK; |
289 | 293 | ||
290 | context = context_create_from_room(handle, room); | 294 | context = context_create_from_room(handle, room); |
@@ -298,7 +302,7 @@ request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, | |||
298 | return GNUNET_SYSERR; | 302 | return GNUNET_SYSERR; |
299 | } | 303 | } |
300 | 304 | ||
301 | struct GNUNET_CHAT_CheckHandleRoomMembers check; | 305 | check_context_type: |
302 | check.ignore_key = GNUNET_MESSENGER_get_key(handle->messenger); | 306 | check.ignore_key = GNUNET_MESSENGER_get_key(handle->messenger); |
303 | check.contact = NULL; | 307 | check.contact = NULL; |
304 | 308 | ||
@@ -310,10 +314,7 @@ request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, | |||
310 | (GNUNET_OK == intern_provide_contact_for_member(handle, | 314 | (GNUNET_OK == intern_provide_contact_for_member(handle, |
311 | check.contact, | 315 | check.contact, |
312 | context))) | 316 | context))) |
313 | { | ||
314 | context->type = GNUNET_CHAT_CONTEXT_TYPE_CONTACT; | 317 | context->type = GNUNET_CHAT_CONTEXT_TYPE_CONTACT; |
315 | return GNUNET_OK; | ||
316 | } | ||
317 | else if (checks >= 2) | 318 | else if (checks >= 2) |
318 | { | 319 | { |
319 | context->type = GNUNET_CHAT_CONTEXT_TYPE_GROUP; | 320 | context->type = GNUNET_CHAT_CONTEXT_TYPE_GROUP; |
@@ -333,17 +334,13 @@ request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, | |||
333 | return GNUNET_OK; | 334 | return GNUNET_OK; |
334 | 335 | ||
335 | group_destroy(group); | 336 | group_destroy(group); |
336 | } | ||
337 | else | ||
338 | { | ||
339 | context->type = GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN; | ||
340 | 337 | ||
341 | // TODO: handle chats which only contain yourself currently! | 338 | GNUNET_CONTAINER_multihashmap_remove(handle->contexts, key, context); |
339 | context_destroy(context); | ||
340 | return GNUNET_SYSERR; | ||
342 | } | 341 | } |
343 | 342 | ||
344 | GNUNET_CONTAINER_multihashmap_remove(handle->contexts, key, context); | 343 | return GNUNET_OK; |
345 | context_destroy(context); | ||
346 | return GNUNET_SYSERR; | ||
347 | } | 344 | } |
348 | 345 | ||
349 | int | 346 | int |