diff options
Diffstat (limited to 'src/gnunet_chat_handle_intern.c')
-rw-r--r-- | src/gnunet_chat_handle_intern.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c index beb65d3..a563c60 100644 --- a/src/gnunet_chat_handle_intern.c +++ b/src/gnunet_chat_handle_intern.c | |||
@@ -38,6 +38,8 @@ on_handle_arm_connection(void *cls, int connected) | |||
38 | { | 38 | { |
39 | struct GNUNET_CHAT_Handle *chat = cls; | 39 | struct GNUNET_CHAT_Handle *chat = cls; |
40 | 40 | ||
41 | GNUNET_assert((chat) && (chat->arm)); | ||
42 | |||
41 | if (GNUNET_YES == connected) { | 43 | if (GNUNET_YES == connected) { |
42 | GNUNET_ARM_request_service_start( | 44 | GNUNET_ARM_request_service_start( |
43 | chat->arm, "messenger", | 45 | chat->arm, "messenger", |
@@ -64,6 +66,8 @@ notify_handle_fs_progress(void* cls, const struct GNUNET_FS_ProgressInfo* info) | |||
64 | { | 66 | { |
65 | struct GNUNET_CHAT_Handle *chat = cls; | 67 | struct GNUNET_CHAT_Handle *chat = cls; |
66 | 68 | ||
69 | GNUNET_assert(info); | ||
70 | |||
67 | if (!chat) | 71 | if (!chat) |
68 | return NULL; | 72 | return NULL; |
69 | 73 | ||
@@ -194,6 +198,8 @@ check_handle_room_members (void* cls, | |||
194 | { | 198 | { |
195 | struct GNUNET_CHAT_CheckHandleRoomMembers *check = cls; | 199 | struct GNUNET_CHAT_CheckHandleRoomMembers *check = cls; |
196 | 200 | ||
201 | GNUNET_assert((check) && (member)); | ||
202 | |||
197 | const struct GNUNET_IDENTITY_PublicKey *member_key = ( | 203 | const struct GNUNET_IDENTITY_PublicKey *member_key = ( |
198 | GNUNET_MESSENGER_contact_get_key(member) | 204 | GNUNET_MESSENGER_contact_get_key(member) |
199 | ); | 205 | ); |
@@ -215,6 +221,10 @@ int | |||
215 | request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, | 221 | request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, |
216 | struct GNUNET_MESSENGER_Room *room) | 222 | struct GNUNET_MESSENGER_Room *room) |
217 | { | 223 | { |
224 | GNUNET_assert((handle) && | ||
225 | (handle->contexts) && | ||
226 | (room)); | ||
227 | |||
218 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room); | 228 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room); |
219 | 229 | ||
220 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( | 230 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( |
@@ -296,11 +306,14 @@ request_handle_context_by_room (struct GNUNET_CHAT_Handle *handle, | |||
296 | } | 306 | } |
297 | 307 | ||
298 | int | 308 | int |
299 | find_handle_rooms (void *cls, struct GNUNET_MESSENGER_Room *room, | 309 | find_handle_rooms (void *cls, |
310 | struct GNUNET_MESSENGER_Room *room, | ||
300 | GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member) | 311 | GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member) |
301 | { | 312 | { |
302 | struct GNUNET_CHAT_Handle *handle = cls; | 313 | struct GNUNET_CHAT_Handle *handle = cls; |
303 | 314 | ||
315 | GNUNET_assert((handle) && (room)); | ||
316 | |||
304 | if (GNUNET_OK != request_handle_context_by_room(handle, room)) | 317 | if (GNUNET_OK != request_handle_context_by_room(handle, room)) |
305 | return GNUNET_NO; | 318 | return GNUNET_NO; |
306 | 319 | ||
@@ -314,6 +327,10 @@ scan_handle_room_members (void* cls, | |||
314 | { | 327 | { |
315 | struct GNUNET_CHAT_Handle *handle = cls; | 328 | struct GNUNET_CHAT_Handle *handle = cls; |
316 | 329 | ||
330 | GNUNET_assert((handle) && | ||
331 | (handle->contacts) && | ||
332 | (member)); | ||
333 | |||
317 | struct GNUNET_ShortHashCode shorthash; | 334 | struct GNUNET_ShortHashCode shorthash; |
318 | util_shorthash_from_member(member, &shorthash); | 335 | util_shorthash_from_member(member, &shorthash); |
319 | 336 | ||
@@ -335,11 +352,16 @@ scan_handle_room_members (void* cls, | |||
335 | } | 352 | } |
336 | 353 | ||
337 | int | 354 | int |
338 | scan_handle_rooms (void *cls, struct GNUNET_MESSENGER_Room *room, | 355 | scan_handle_rooms (void *cls, |
356 | struct GNUNET_MESSENGER_Room *room, | ||
339 | GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member) | 357 | GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member) |
340 | { | 358 | { |
341 | struct GNUNET_CHAT_Handle *handle = cls; | 359 | struct GNUNET_CHAT_Handle *handle = cls; |
342 | 360 | ||
361 | GNUNET_assert((handle) && | ||
362 | (handle->groups) && | ||
363 | (room)); | ||
364 | |||
343 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room); | 365 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room); |
344 | 366 | ||
345 | struct GNUNET_CHAT_Group *group = GNUNET_CONTAINER_multihashmap_get( | 367 | struct GNUNET_CHAT_Group *group = GNUNET_CONTAINER_multihashmap_get( |
@@ -359,11 +381,18 @@ on_handle_identity(void *cls, | |||
359 | { | 381 | { |
360 | struct GNUNET_CHAT_Handle *handle = cls; | 382 | struct GNUNET_CHAT_Handle *handle = cls; |
361 | 383 | ||
384 | GNUNET_assert((handle) && | ||
385 | (handle->contexts) && | ||
386 | (handle->groups) && | ||
387 | (handle->contacts)); | ||
388 | |||
362 | if ((0 < GNUNET_CONTAINER_multihashmap_size(handle->contexts)) || | 389 | if ((0 < GNUNET_CONTAINER_multihashmap_size(handle->contexts)) || |
363 | (0 < GNUNET_CONTAINER_multihashmap_size(handle->groups)) || | 390 | (0 < GNUNET_CONTAINER_multihashmap_size(handle->groups)) || |
364 | (0 < GNUNET_CONTAINER_multishortmap_size(handle->contacts))) | 391 | (0 < GNUNET_CONTAINER_multishortmap_size(handle->contacts))) |
365 | return; | 392 | return; |
366 | 393 | ||
394 | GNUNET_assert(handle->messenger); | ||
395 | |||
367 | GNUNET_MESSENGER_find_rooms( | 396 | GNUNET_MESSENGER_find_rooms( |
368 | handle->messenger, NULL, find_handle_rooms, handle | 397 | handle->messenger, NULL, find_handle_rooms, handle |
369 | ); | 398 | ); |
@@ -393,6 +422,11 @@ on_handle_message (void *cls, | |||
393 | { | 422 | { |
394 | struct GNUNET_CHAT_Handle *handle = cls; | 423 | struct GNUNET_CHAT_Handle *handle = cls; |
395 | 424 | ||
425 | GNUNET_assert((handle) && | ||
426 | (room) && | ||
427 | (msg) && | ||
428 | (hash)); | ||
429 | |||
396 | if (GNUNET_OK != request_handle_context_by_room(handle, room)) | 430 | if (GNUNET_OK != request_handle_context_by_room(handle, room)) |
397 | return; | 431 | return; |
398 | 432 | ||
@@ -502,6 +536,8 @@ it_destroy_handle_groups (GNUNET_UNUSED void *cls, | |||
502 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 536 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
503 | void *value) | 537 | void *value) |
504 | { | 538 | { |
539 | GNUNET_assert(value); | ||
540 | |||
505 | struct GNUNET_CHAT_Group *group = value; | 541 | struct GNUNET_CHAT_Group *group = value; |
506 | group_save_config(group); | 542 | group_save_config(group); |
507 | group_destroy(group); | 543 | group_destroy(group); |
@@ -513,6 +549,8 @@ it_destroy_handle_contacts (GNUNET_UNUSED void *cls, | |||
513 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, | 549 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, |
514 | void *value) | 550 | void *value) |
515 | { | 551 | { |
552 | GNUNET_assert(value); | ||
553 | |||
516 | struct GNUNET_CHAT_Contact *contact = value; | 554 | struct GNUNET_CHAT_Contact *contact = value; |
517 | contact_destroy(contact); | 555 | contact_destroy(contact); |
518 | return GNUNET_YES; | 556 | return GNUNET_YES; |
@@ -523,6 +561,8 @@ it_destroy_handle_contexts (GNUNET_UNUSED void *cls, | |||
523 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 561 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
524 | void *value) | 562 | void *value) |
525 | { | 563 | { |
564 | GNUNET_assert(value); | ||
565 | |||
526 | struct GNUNET_CHAT_Context *context = value; | 566 | struct GNUNET_CHAT_Context *context = value; |
527 | context_save_config(context); | 567 | context_save_config(context); |
528 | context_destroy(context); | 568 | context_destroy(context); |
@@ -534,6 +574,8 @@ it_destroy_handle_files (GNUNET_UNUSED void *cls, | |||
534 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 574 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
535 | void *value) | 575 | void *value) |
536 | { | 576 | { |
577 | GNUNET_assert(value); | ||
578 | |||
537 | struct GNUNET_CHAT_File *file = value; | 579 | struct GNUNET_CHAT_File *file = value; |
538 | file_destroy(file); | 580 | file_destroy(file); |
539 | return GNUNET_YES; | 581 | return GNUNET_YES; |