diff options
author | Jacki <jacki@thejackimonster.de> | 2024-01-04 17:35:12 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-01-04 17:35:47 +0100 |
commit | fa50b6878fa0c8aef70bc2d879e2e0dffdc65f88 (patch) | |
tree | 7ce17fcf6d93eaeac8c93b94f8ca59db824c4f74 | |
parent | 9522abbeea36b629e2a2dfb729398363ed295a9c (diff) | |
download | libgnunetchat-fa50b6878fa0c8aef70bc2d879e2e0dffdc65f88.tar.gz libgnunetchat-fa50b6878fa0c8aef70bc2d879e2e0dffdc65f88.zip |
Format code
Signed-off-by: Jacki <jacki@thejackimonster.de>
-rw-r--r-- | src/gnunet_chat_lib.c | 304 |
1 files changed, 152 insertions, 152 deletions
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index c10307c..62af024 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | #define GNUNET_CHAT_VERSION_ASSERT() {\ | 48 | #define GNUNET_CHAT_VERSION_ASSERT() {\ |
49 | GNUNET_assert(\ | 49 | GNUNET_assert(\ |
50 | (GNUNET_MESSENGER_VERSION == ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFFFFFL))\ | 50 | (GNUNET_MESSENGER_VERSION == ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFFFFFL))\ |
51 | );\ | 51 | );\ |
52 | } | 52 | } |
53 | 53 | ||
@@ -57,7 +57,7 @@ static const uint32_t block_replication_level = 1; | |||
57 | 57 | ||
58 | struct GNUNET_CHAT_Handle* | 58 | struct GNUNET_CHAT_Handle* |
59 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 59 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
60 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls) | 60 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls) |
61 | { | 61 | { |
62 | GNUNET_CHAT_VERSION_ASSERT(); | 62 | GNUNET_CHAT_VERSION_ASSERT(); |
63 | 63 | ||
@@ -65,9 +65,9 @@ GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
65 | return NULL; | 65 | return NULL; |
66 | 66 | ||
67 | return handle_create_from_config( | 67 | return handle_create_from_config( |
68 | cfg, | 68 | cfg, |
69 | msg_cb, | 69 | msg_cb, |
70 | msg_cls | 70 | msg_cls |
71 | ); | 71 | ); |
72 | } | 72 | } |
73 | 73 | ||
@@ -81,17 +81,17 @@ GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle) | |||
81 | return; | 81 | return; |
82 | 82 | ||
83 | handle->destruction = GNUNET_SCHEDULER_add_at_with_priority( | 83 | handle->destruction = GNUNET_SCHEDULER_add_at_with_priority( |
84 | GNUNET_TIME_absolute_get(), | 84 | GNUNET_TIME_absolute_get(), |
85 | GNUNET_SCHEDULER_PRIORITY_URGENT, | 85 | GNUNET_SCHEDULER_PRIORITY_URGENT, |
86 | task_handle_destruction, | 86 | task_handle_destruction, |
87 | handle | 87 | handle |
88 | ); | 88 | ); |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | enum GNUNET_GenericReturnValue | 92 | enum GNUNET_GenericReturnValue |
93 | GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, | 93 | GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, |
94 | const char* name) | 94 | const char* name) |
95 | { | 95 | { |
96 | GNUNET_CHAT_VERSION_ASSERT(); | 96 | GNUNET_CHAT_VERSION_ASSERT(); |
97 | 97 | ||
@@ -109,7 +109,7 @@ GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, | |||
109 | 109 | ||
110 | enum GNUNET_GenericReturnValue | 110 | enum GNUNET_GenericReturnValue |
111 | GNUNET_CHAT_account_delete(struct GNUNET_CHAT_Handle *handle, | 111 | GNUNET_CHAT_account_delete(struct GNUNET_CHAT_Handle *handle, |
112 | const char* name) | 112 | const char* name) |
113 | { | 113 | { |
114 | GNUNET_CHAT_VERSION_ASSERT(); | 114 | GNUNET_CHAT_VERSION_ASSERT(); |
115 | 115 | ||
@@ -122,8 +122,8 @@ GNUNET_CHAT_account_delete(struct GNUNET_CHAT_Handle *handle, | |||
122 | 122 | ||
123 | int | 123 | int |
124 | GNUNET_CHAT_iterate_accounts (const struct GNUNET_CHAT_Handle *handle, | 124 | GNUNET_CHAT_iterate_accounts (const struct GNUNET_CHAT_Handle *handle, |
125 | GNUNET_CHAT_AccountCallback callback, | 125 | GNUNET_CHAT_AccountCallback callback, |
126 | void *cls) | 126 | void *cls) |
127 | { | 127 | { |
128 | GNUNET_CHAT_VERSION_ASSERT(); | 128 | GNUNET_CHAT_VERSION_ASSERT(); |
129 | 129 | ||
@@ -211,7 +211,7 @@ GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle) | |||
211 | 211 | ||
212 | enum GNUNET_GenericReturnValue | 212 | enum GNUNET_GenericReturnValue |
213 | GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, | 213 | GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, |
214 | const char *name) | 214 | const char *name) |
215 | { | 215 | { |
216 | GNUNET_CHAT_VERSION_ASSERT(); | 216 | GNUNET_CHAT_VERSION_ASSERT(); |
217 | 217 | ||
@@ -259,7 +259,7 @@ GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle) | |||
259 | 259 | ||
260 | struct GNUNET_CHAT_Uri* | 260 | struct GNUNET_CHAT_Uri* |
261 | GNUNET_CHAT_uri_parse (const char *uri, | 261 | GNUNET_CHAT_uri_parse (const char *uri, |
262 | char **emsg) | 262 | char **emsg) |
263 | { | 263 | { |
264 | GNUNET_CHAT_VERSION_ASSERT(); | 264 | GNUNET_CHAT_VERSION_ASSERT(); |
265 | 265 | ||
@@ -319,10 +319,10 @@ GNUNET_CHAT_uri_to_string (const struct GNUNET_CHAT_Uri *uri) | |||
319 | 319 | ||
320 | char *string; | 320 | char *string; |
321 | GNUNET_asprintf ( | 321 | GNUNET_asprintf ( |
322 | &string, | 322 | &string, |
323 | "gnunet://chat/%s.%s", | 323 | "gnunet://chat/%s.%s", |
324 | key_string, | 324 | key_string, |
325 | uri->label | 325 | uri->label |
326 | ); | 326 | ); |
327 | 327 | ||
328 | GNUNET_free(key_string); | 328 | GNUNET_free(key_string); |
@@ -344,9 +344,9 @@ GNUNET_CHAT_uri_destroy (struct GNUNET_CHAT_Uri *uri) | |||
344 | 344 | ||
345 | struct GNUNET_CHAT_Lobby* | 345 | struct GNUNET_CHAT_Lobby* |
346 | GNUNET_CHAT_lobby_open (struct GNUNET_CHAT_Handle *handle, | 346 | GNUNET_CHAT_lobby_open (struct GNUNET_CHAT_Handle *handle, |
347 | struct GNUNET_TIME_Relative delay, | 347 | struct GNUNET_TIME_Relative delay, |
348 | GNUNET_CHAT_LobbyCallback callback, | 348 | GNUNET_CHAT_LobbyCallback callback, |
349 | void *cls) | 349 | void *cls) |
350 | { | 350 | { |
351 | GNUNET_CHAT_VERSION_ASSERT(); | 351 | GNUNET_CHAT_VERSION_ASSERT(); |
352 | 352 | ||
@@ -354,15 +354,15 @@ GNUNET_CHAT_lobby_open (struct GNUNET_CHAT_Handle *handle, | |||
354 | return NULL; | 354 | return NULL; |
355 | 355 | ||
356 | struct GNUNET_CHAT_InternalLobbies *lobbies = GNUNET_new( | 356 | struct GNUNET_CHAT_InternalLobbies *lobbies = GNUNET_new( |
357 | struct GNUNET_CHAT_InternalLobbies | 357 | struct GNUNET_CHAT_InternalLobbies |
358 | ); | 358 | ); |
359 | 359 | ||
360 | lobbies->lobby = lobby_create(handle); | 360 | lobbies->lobby = lobby_create(handle); |
361 | 361 | ||
362 | GNUNET_CONTAINER_DLL_insert( | 362 | GNUNET_CONTAINER_DLL_insert( |
363 | handle->lobbies_head, | 363 | handle->lobbies_head, |
364 | handle->lobbies_tail, | 364 | handle->lobbies_tail, |
365 | lobbies | 365 | lobbies |
366 | ); | 366 | ); |
367 | 367 | ||
368 | lobby_open(lobbies->lobby, delay, callback, cls); | 368 | lobby_open(lobbies->lobby, delay, callback, cls); |
@@ -386,9 +386,9 @@ GNUNET_CHAT_lobby_close (struct GNUNET_CHAT_Lobby *lobby) | |||
386 | if (lobbies->lobby == lobby) | 386 | if (lobbies->lobby == lobby) |
387 | { | 387 | { |
388 | GNUNET_CONTAINER_DLL_remove( | 388 | GNUNET_CONTAINER_DLL_remove( |
389 | lobby->handle->lobbies_head, | 389 | lobby->handle->lobbies_head, |
390 | lobby->handle->lobbies_tail, | 390 | lobby->handle->lobbies_tail, |
391 | lobbies | 391 | lobbies |
392 | ); | 392 | ); |
393 | 393 | ||
394 | GNUNET_free(lobbies); | 394 | GNUNET_free(lobbies); |
@@ -404,7 +404,7 @@ GNUNET_CHAT_lobby_close (struct GNUNET_CHAT_Lobby *lobby) | |||
404 | 404 | ||
405 | void | 405 | void |
406 | GNUNET_CHAT_lobby_join (struct GNUNET_CHAT_Handle *handle, | 406 | GNUNET_CHAT_lobby_join (struct GNUNET_CHAT_Handle *handle, |
407 | const struct GNUNET_CHAT_Uri *uri) | 407 | const struct GNUNET_CHAT_Uri *uri) |
408 | { | 408 | { |
409 | GNUNET_CHAT_VERSION_ASSERT(); | 409 | GNUNET_CHAT_VERSION_ASSERT(); |
410 | 410 | ||
@@ -412,33 +412,33 @@ GNUNET_CHAT_lobby_join (struct GNUNET_CHAT_Handle *handle, | |||
412 | return; | 412 | return; |
413 | 413 | ||
414 | struct GNUNET_CHAT_UriLookups *lookups = GNUNET_new( | 414 | struct GNUNET_CHAT_UriLookups *lookups = GNUNET_new( |
415 | struct GNUNET_CHAT_UriLookups | 415 | struct GNUNET_CHAT_UriLookups |
416 | ); | 416 | ); |
417 | 417 | ||
418 | lookups->handle = handle; | 418 | lookups->handle = handle; |
419 | lookups->uri = uri_create(&(uri->zone), uri->label); | 419 | lookups->uri = uri_create(&(uri->zone), uri->label); |
420 | 420 | ||
421 | lookups->request = GNUNET_GNS_lookup( | 421 | lookups->request = GNUNET_GNS_lookup( |
422 | handle->gns, | 422 | handle->gns, |
423 | lookups->uri->label, | 423 | lookups->uri->label, |
424 | &(uri->zone), | 424 | &(uri->zone), |
425 | GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_ENTRY, | 425 | GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_ENTRY, |
426 | GNUNET_GNS_LO_DEFAULT, | 426 | GNUNET_GNS_LO_DEFAULT, |
427 | cb_lobby_lookup, | 427 | cb_lobby_lookup, |
428 | lookups | 428 | lookups |
429 | ); | 429 | ); |
430 | 430 | ||
431 | GNUNET_CONTAINER_DLL_insert( | 431 | GNUNET_CONTAINER_DLL_insert( |
432 | handle->lookups_head, | 432 | handle->lookups_head, |
433 | handle->lookups_tail, | 433 | handle->lookups_tail, |
434 | lookups | 434 | lookups |
435 | ); | 435 | ); |
436 | } | 436 | } |
437 | 437 | ||
438 | 438 | ||
439 | void | 439 | void |
440 | GNUNET_CHAT_set_user_pointer (struct GNUNET_CHAT_Handle *handle, | 440 | GNUNET_CHAT_set_user_pointer (struct GNUNET_CHAT_Handle *handle, |
441 | void *user_pointer) | 441 | void *user_pointer) |
442 | { | 442 | { |
443 | GNUNET_CHAT_VERSION_ASSERT(); | 443 | GNUNET_CHAT_VERSION_ASSERT(); |
444 | 444 | ||
@@ -463,8 +463,8 @@ GNUNET_CHAT_get_user_pointer (const struct GNUNET_CHAT_Handle *handle) | |||
463 | 463 | ||
464 | int | 464 | int |
465 | GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle, | 465 | GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle, |
466 | GNUNET_CHAT_ContactCallback callback, | 466 | GNUNET_CHAT_ContactCallback callback, |
467 | void *cls) | 467 | void *cls) |
468 | { | 468 | { |
469 | GNUNET_CHAT_VERSION_ASSERT(); | 469 | GNUNET_CHAT_VERSION_ASSERT(); |
470 | 470 | ||
@@ -477,7 +477,7 @@ GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle, | |||
477 | it.cls = cls; | 477 | it.cls = cls; |
478 | 478 | ||
479 | return GNUNET_CONTAINER_multishortmap_iterate( | 479 | return GNUNET_CONTAINER_multishortmap_iterate( |
480 | handle->contacts, it_handle_iterate_contacts, &it | 480 | handle->contacts, it_handle_iterate_contacts, &it |
481 | ); | 481 | ); |
482 | } | 482 | } |
483 | 483 | ||
@@ -496,7 +496,7 @@ GNUNET_CHAT_account_get_name (const struct GNUNET_CHAT_Account *account) | |||
496 | 496 | ||
497 | void | 497 | void |
498 | GNUNET_CHAT_account_set_user_pointer (struct GNUNET_CHAT_Account *account, | 498 | GNUNET_CHAT_account_set_user_pointer (struct GNUNET_CHAT_Account *account, |
499 | void *user_pointer) | 499 | void *user_pointer) |
500 | { | 500 | { |
501 | GNUNET_CHAT_VERSION_ASSERT(); | 501 | GNUNET_CHAT_VERSION_ASSERT(); |
502 | 502 | ||
@@ -521,7 +521,7 @@ GNUNET_CHAT_account_get_user_pointer (const struct GNUNET_CHAT_Account *account) | |||
521 | 521 | ||
522 | struct GNUNET_CHAT_Group * | 522 | struct GNUNET_CHAT_Group * |
523 | GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle, | 523 | GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle, |
524 | const char* topic) | 524 | const char* topic) |
525 | { | 525 | { |
526 | GNUNET_CHAT_VERSION_ASSERT(); | 526 | GNUNET_CHAT_VERSION_ASSERT(); |
527 | 527 | ||
@@ -536,12 +536,11 @@ GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle, | |||
536 | else | 536 | else |
537 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, &key, sizeof(key)); | 537 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, &key, sizeof(key)); |
538 | 538 | ||
539 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains( | 539 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(handle->contexts, &key)) |
540 | handle->contexts, &key)) | ||
541 | return NULL; | 540 | return NULL; |
542 | 541 | ||
543 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room( | 542 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room( |
544 | handle->messenger, &key | 543 | handle->messenger, &key |
545 | ); | 544 | ); |
546 | 545 | ||
547 | if (!room) | 546 | if (!room) |
@@ -585,8 +584,8 @@ destroy_context: | |||
585 | 584 | ||
586 | int | 585 | int |
587 | GNUNET_CHAT_iterate_groups (struct GNUNET_CHAT_Handle *handle, | 586 | GNUNET_CHAT_iterate_groups (struct GNUNET_CHAT_Handle *handle, |
588 | GNUNET_CHAT_GroupCallback callback, | 587 | GNUNET_CHAT_GroupCallback callback, |
589 | void *cls) | 588 | void *cls) |
590 | { | 589 | { |
591 | GNUNET_CHAT_VERSION_ASSERT(); | 590 | GNUNET_CHAT_VERSION_ASSERT(); |
592 | 591 | ||
@@ -599,7 +598,7 @@ GNUNET_CHAT_iterate_groups (struct GNUNET_CHAT_Handle *handle, | |||
599 | it.cls = cls; | 598 | it.cls = cls; |
600 | 599 | ||
601 | return GNUNET_CONTAINER_multihashmap_iterate( | 600 | return GNUNET_CONTAINER_multihashmap_iterate( |
602 | handle->groups, it_handle_iterate_groups, &it | 601 | handle->groups, it_handle_iterate_groups, &it |
603 | ); | 602 | ); |
604 | } | 603 | } |
605 | 604 | ||
@@ -616,15 +615,15 @@ GNUNET_CHAT_contact_delete (struct GNUNET_CHAT_Contact *contact) | |||
616 | util_shorthash_from_member(contact->member, &shorthash); | 615 | util_shorthash_from_member(contact->member, &shorthash); |
617 | 616 | ||
618 | GNUNET_CONTAINER_multishortmap_remove( | 617 | GNUNET_CONTAINER_multishortmap_remove( |
619 | contact->handle->contacts, &shorthash, contact | 618 | contact->handle->contacts, &shorthash, contact |
620 | ); | 619 | ); |
621 | 620 | ||
622 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 621 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
623 | contact->context->room | 622 | contact->context->room |
624 | ); | 623 | ); |
625 | 624 | ||
626 | GNUNET_CONTAINER_multihashmap_remove( | 625 | GNUNET_CONTAINER_multihashmap_remove( |
627 | contact->handle->contexts, key, contact->context | 626 | contact->handle->contexts, key, contact->context |
628 | ); | 627 | ); |
629 | 628 | ||
630 | GNUNET_MESSENGER_close_room(contact->context->room); | 629 | GNUNET_MESSENGER_close_room(contact->context->room); |
@@ -640,7 +639,7 @@ GNUNET_CHAT_contact_delete (struct GNUNET_CHAT_Contact *contact) | |||
640 | 639 | ||
641 | void | 640 | void |
642 | GNUNET_CHAT_contact_set_name (struct GNUNET_CHAT_Contact *contact, | 641 | GNUNET_CHAT_contact_set_name (struct GNUNET_CHAT_Contact *contact, |
643 | const char *name) | 642 | const char *name) |
644 | { | 643 | { |
645 | GNUNET_CHAT_VERSION_ASSERT(); | 644 | GNUNET_CHAT_VERSION_ASSERT(); |
646 | 645 | ||
@@ -708,7 +707,7 @@ GNUNET_CHAT_contact_get_context (struct GNUNET_CHAT_Contact *contact) | |||
708 | 707 | ||
709 | void | 708 | void |
710 | GNUNET_CHAT_contact_set_user_pointer (struct GNUNET_CHAT_Contact *contact, | 709 | GNUNET_CHAT_contact_set_user_pointer (struct GNUNET_CHAT_Contact *contact, |
711 | void *user_pointer) | 710 | void *user_pointer) |
712 | { | 711 | { |
713 | GNUNET_CHAT_VERSION_ASSERT(); | 712 | GNUNET_CHAT_VERSION_ASSERT(); |
714 | 713 | ||
@@ -777,15 +776,15 @@ GNUNET_CHAT_group_leave (struct GNUNET_CHAT_Group *group) | |||
777 | return GNUNET_SYSERR; | 776 | return GNUNET_SYSERR; |
778 | 777 | ||
779 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 778 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
780 | group->context->room | 779 | group->context->room |
781 | ); | 780 | ); |
782 | 781 | ||
783 | GNUNET_CONTAINER_multihashmap_remove( | 782 | GNUNET_CONTAINER_multihashmap_remove( |
784 | group->handle->groups, key, group | 783 | group->handle->groups, key, group |
785 | ); | 784 | ); |
786 | 785 | ||
787 | GNUNET_CONTAINER_multihashmap_remove( | 786 | GNUNET_CONTAINER_multihashmap_remove( |
788 | group->handle->contexts, key, group->context | 787 | group->handle->contexts, key, group->context |
789 | ); | 788 | ); |
790 | 789 | ||
791 | GNUNET_MESSENGER_close_room(group->context->room); | 790 | GNUNET_MESSENGER_close_room(group->context->room); |
@@ -801,7 +800,7 @@ GNUNET_CHAT_group_leave (struct GNUNET_CHAT_Group *group) | |||
801 | 800 | ||
802 | void | 801 | void |
803 | GNUNET_CHAT_group_set_name (struct GNUNET_CHAT_Group *group, | 802 | GNUNET_CHAT_group_set_name (struct GNUNET_CHAT_Group *group, |
804 | const char *name) | 803 | const char *name) |
805 | { | 804 | { |
806 | GNUNET_CHAT_VERSION_ASSERT(); | 805 | GNUNET_CHAT_VERSION_ASSERT(); |
807 | 806 | ||
@@ -832,7 +831,7 @@ GNUNET_CHAT_group_get_name (const struct GNUNET_CHAT_Group *group) | |||
832 | 831 | ||
833 | void | 832 | void |
834 | GNUNET_CHAT_group_set_user_pointer (struct GNUNET_CHAT_Group *group, | 833 | GNUNET_CHAT_group_set_user_pointer (struct GNUNET_CHAT_Group *group, |
835 | void *user_pointer) | 834 | void *user_pointer) |
836 | { | 835 | { |
837 | GNUNET_CHAT_VERSION_ASSERT(); | 836 | GNUNET_CHAT_VERSION_ASSERT(); |
838 | 837 | ||
@@ -857,7 +856,7 @@ GNUNET_CHAT_group_get_user_pointer (const struct GNUNET_CHAT_Group *group) | |||
857 | 856 | ||
858 | void | 857 | void |
859 | GNUNET_CHAT_group_invite_contact (const struct GNUNET_CHAT_Group *group, | 858 | GNUNET_CHAT_group_invite_contact (const struct GNUNET_CHAT_Group *group, |
860 | struct GNUNET_CHAT_Contact *contact) | 859 | struct GNUNET_CHAT_Contact *contact) |
861 | { | 860 | { |
862 | GNUNET_CHAT_VERSION_ASSERT(); | 861 | GNUNET_CHAT_VERSION_ASSERT(); |
863 | 862 | ||
@@ -870,11 +869,11 @@ GNUNET_CHAT_group_invite_contact (const struct GNUNET_CHAT_Group *group, | |||
870 | return; | 869 | return; |
871 | 870 | ||
872 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 871 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
873 | group->context->room | 872 | group->context->room |
874 | ); | 873 | ); |
875 | 874 | ||
876 | handle_send_room_name(group->handle, GNUNET_MESSENGER_open_room( | 875 | handle_send_room_name(group->handle, GNUNET_MESSENGER_open_room( |
877 | group->handle->messenger, key | 876 | group->handle->messenger, key |
878 | )); | 877 | )); |
879 | 878 | ||
880 | struct GNUNET_MESSENGER_Message msg; | 879 | struct GNUNET_MESSENGER_Message msg; |
@@ -888,8 +887,8 @@ GNUNET_CHAT_group_invite_contact (const struct GNUNET_CHAT_Group *group, | |||
888 | 887 | ||
889 | int | 888 | int |
890 | GNUNET_CHAT_group_iterate_contacts (const struct GNUNET_CHAT_Group *group, | 889 | GNUNET_CHAT_group_iterate_contacts (const struct GNUNET_CHAT_Group *group, |
891 | GNUNET_CHAT_GroupContactCallback callback, | 890 | GNUNET_CHAT_GroupContactCallback callback, |
892 | void *cls) | 891 | void *cls) |
893 | { | 892 | { |
894 | GNUNET_CHAT_VERSION_ASSERT(); | 893 | GNUNET_CHAT_VERSION_ASSERT(); |
895 | 894 | ||
@@ -902,15 +901,15 @@ GNUNET_CHAT_group_iterate_contacts (const struct GNUNET_CHAT_Group *group, | |||
902 | it.cls = cls; | 901 | it.cls = cls; |
903 | 902 | ||
904 | return GNUNET_MESSENGER_iterate_members( | 903 | return GNUNET_MESSENGER_iterate_members( |
905 | group->context->room, it_group_iterate_contacts, &it | 904 | group->context->room, it_group_iterate_contacts, &it |
906 | ); | 905 | ); |
907 | } | 906 | } |
908 | 907 | ||
909 | 908 | ||
910 | void | 909 | void |
911 | GNUNET_CHAT_member_set_user_pointer (struct GNUNET_CHAT_Group *group, | 910 | GNUNET_CHAT_member_set_user_pointer (struct GNUNET_CHAT_Group *group, |
912 | const struct GNUNET_CHAT_Contact *member, | 911 | const struct GNUNET_CHAT_Contact *member, |
913 | void *user_pointer) | 912 | void *user_pointer) |
914 | { | 913 | { |
915 | GNUNET_CHAT_VERSION_ASSERT(); | 914 | GNUNET_CHAT_VERSION_ASSERT(); |
916 | 915 | ||
@@ -921,17 +920,17 @@ GNUNET_CHAT_member_set_user_pointer (struct GNUNET_CHAT_Group *group, | |||
921 | util_shorthash_from_member(member->member, &hash); | 920 | util_shorthash_from_member(member->member, &hash); |
922 | 921 | ||
923 | GNUNET_CONTAINER_multishortmap_put( | 922 | GNUNET_CONTAINER_multishortmap_put( |
924 | group->context->member_pointers, | 923 | group->context->member_pointers, |
925 | &hash, | 924 | &hash, |
926 | user_pointer, | 925 | user_pointer, |
927 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE | 926 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE |
928 | ); | 927 | ); |
929 | } | 928 | } |
930 | 929 | ||
931 | 930 | ||
932 | void* | 931 | void* |
933 | GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Group *group, | 932 | GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Group *group, |
934 | const struct GNUNET_CHAT_Contact *member) | 933 | const struct GNUNET_CHAT_Contact *member) |
935 | { | 934 | { |
936 | GNUNET_CHAT_VERSION_ASSERT(); | 935 | GNUNET_CHAT_VERSION_ASSERT(); |
937 | 936 | ||
@@ -942,8 +941,8 @@ GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Group *group, | |||
942 | util_shorthash_from_member(member->member, &hash); | 941 | util_shorthash_from_member(member->member, &hash); |
943 | 942 | ||
944 | return GNUNET_CONTAINER_multishortmap_get( | 943 | return GNUNET_CONTAINER_multishortmap_get( |
945 | group->context->member_pointers, | 944 | group->context->member_pointers, |
946 | &hash | 945 | &hash |
947 | ); | 946 | ); |
948 | } | 947 | } |
949 | 948 | ||
@@ -990,7 +989,7 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context) | |||
990 | return; | 989 | return; |
991 | 990 | ||
992 | struct GNUNET_CHAT_Contact *contact = contact_create_from_member( | 991 | struct GNUNET_CHAT_Contact *contact = contact_create_from_member( |
993 | handle, context->contact | 992 | handle, context->contact |
994 | ); | 993 | ); |
995 | 994 | ||
996 | if (!contact) | 995 | if (!contact) |
@@ -1011,7 +1010,7 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context) | |||
1011 | return; | 1010 | return; |
1012 | 1011 | ||
1013 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room( | 1012 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room( |
1014 | handle->messenger, &key | 1013 | handle->messenger, &key |
1015 | ); | 1014 | ); |
1016 | 1015 | ||
1017 | if (!room) | 1016 | if (!room) |
@@ -1047,9 +1046,9 @@ GNUNET_CHAT_context_get_contact (struct GNUNET_CHAT_Context *context) | |||
1047 | find.contact = NULL; | 1046 | find.contact = NULL; |
1048 | 1047 | ||
1049 | int member_count = GNUNET_MESSENGER_iterate_members( | 1048 | int member_count = GNUNET_MESSENGER_iterate_members( |
1050 | room, | 1049 | room, |
1051 | it_room_find_contact, | 1050 | it_room_find_contact, |
1052 | &find | 1051 | &find |
1053 | ); | 1052 | ); |
1054 | 1053 | ||
1055 | if ((!find.contact) || (member_count > 2)) | 1054 | if ((!find.contact) || (member_count > 2)) |
@@ -1076,7 +1075,7 @@ GNUNET_CHAT_context_get_group (struct GNUNET_CHAT_Context *context) | |||
1076 | 1075 | ||
1077 | void | 1076 | void |
1078 | GNUNET_CHAT_context_set_user_pointer (struct GNUNET_CHAT_Context *context, | 1077 | GNUNET_CHAT_context_set_user_pointer (struct GNUNET_CHAT_Context *context, |
1079 | void *user_pointer) | 1078 | void *user_pointer) |
1080 | { | 1079 | { |
1081 | GNUNET_CHAT_VERSION_ASSERT(); | 1080 | GNUNET_CHAT_VERSION_ASSERT(); |
1082 | 1081 | ||
@@ -1101,7 +1100,7 @@ GNUNET_CHAT_context_get_user_pointer (const struct GNUNET_CHAT_Context *context) | |||
1101 | 1100 | ||
1102 | enum GNUNET_GenericReturnValue | 1101 | enum GNUNET_GenericReturnValue |
1103 | GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, | 1102 | GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, |
1104 | const char *text) | 1103 | const char *text) |
1105 | { | 1104 | { |
1106 | GNUNET_CHAT_VERSION_ASSERT(); | 1105 | GNUNET_CHAT_VERSION_ASSERT(); |
1107 | 1106 | ||
@@ -1121,7 +1120,7 @@ GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, | |||
1121 | 1120 | ||
1122 | enum GNUNET_GenericReturnValue | 1121 | enum GNUNET_GenericReturnValue |
1123 | GNUNET_CHAT_context_send_read_receipt (struct GNUNET_CHAT_Context *context, | 1122 | GNUNET_CHAT_context_send_read_receipt (struct GNUNET_CHAT_Context *context, |
1124 | const struct GNUNET_CHAT_Message *message) | 1123 | const struct GNUNET_CHAT_Message *message) |
1125 | { | 1124 | { |
1126 | GNUNET_CHAT_VERSION_ASSERT(); | 1125 | GNUNET_CHAT_VERSION_ASSERT(); |
1127 | 1126 | ||
@@ -1168,9 +1167,9 @@ skip_filter: | |||
1168 | 1167 | ||
1169 | struct GNUNET_CHAT_File* | 1168 | struct GNUNET_CHAT_File* |
1170 | GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | 1169 | GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, |
1171 | const char *path, | 1170 | const char *path, |
1172 | GNUNET_CHAT_FileUploadCallback callback, | 1171 | GNUNET_CHAT_FileUploadCallback callback, |
1173 | void *cls) | 1172 | void *cls) |
1174 | { | 1173 | { |
1175 | GNUNET_CHAT_VERSION_ASSERT(); | 1174 | GNUNET_CHAT_VERSION_ASSERT(); |
1176 | 1175 | ||
@@ -1187,13 +1186,13 @@ GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | |||
1187 | return NULL; | 1186 | return NULL; |
1188 | 1187 | ||
1189 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( | 1188 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( |
1190 | context->handle->files, | 1189 | context->handle->files, |
1191 | &hash | 1190 | &hash |
1192 | ); | 1191 | ); |
1193 | 1192 | ||
1194 | char *filename; | 1193 | char *filename; |
1195 | util_get_filename ( | 1194 | util_get_filename ( |
1196 | directory, "files", &hash, &filename | 1195 | directory, "files", &hash, &filename |
1197 | ); | 1196 | ); |
1198 | 1197 | ||
1199 | if (file) | 1198 | if (file) |
@@ -1219,10 +1218,10 @@ GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | |||
1219 | char* p = GNUNET_strdup(path); | 1218 | char* p = GNUNET_strdup(path); |
1220 | 1219 | ||
1221 | file = file_create_from_disk( | 1220 | file = file_create_from_disk( |
1222 | context->handle, | 1221 | context->handle, |
1223 | basename(p), | 1222 | basename(p), |
1224 | &hash, | 1223 | &hash, |
1225 | &key | 1224 | &key |
1226 | ); | 1225 | ); |
1227 | 1226 | ||
1228 | GNUNET_free(p); | 1227 | GNUNET_free(p); |
@@ -1243,23 +1242,23 @@ GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | |||
1243 | bo.replication_level = block_replication_level; | 1242 | bo.replication_level = block_replication_level; |
1244 | 1243 | ||
1245 | bo.expiration_time = GNUNET_TIME_absolute_add( | 1244 | bo.expiration_time = GNUNET_TIME_absolute_add( |
1246 | GNUNET_TIME_absolute_get(), GNUNET_TIME_relative_get_hour_() | 1245 | GNUNET_TIME_absolute_get(), GNUNET_TIME_relative_get_hour_() |
1247 | ); | 1246 | ); |
1248 | 1247 | ||
1249 | struct GNUNET_FS_FileInformation* fi = GNUNET_FS_file_information_create_from_file( | 1248 | struct GNUNET_FS_FileInformation* fi = GNUNET_FS_file_information_create_from_file( |
1250 | context->handle->fs, | 1249 | context->handle->fs, |
1251 | file, | 1250 | file, |
1252 | filename, | 1251 | filename, |
1253 | NULL, | 1252 | NULL, |
1254 | file->meta, | 1253 | file->meta, |
1255 | GNUNET_YES, | 1254 | GNUNET_YES, |
1256 | &bo | 1255 | &bo |
1257 | ); | 1256 | ); |
1258 | 1257 | ||
1259 | file->publish = GNUNET_FS_publish_start( | 1258 | file->publish = GNUNET_FS_publish_start( |
1260 | context->handle->fs, fi, | 1259 | context->handle->fs, fi, |
1261 | NULL, NULL, NULL, | 1260 | NULL, NULL, NULL, |
1262 | GNUNET_FS_PUBLISH_OPTION_NONE | 1261 | GNUNET_FS_PUBLISH_OPTION_NONE |
1263 | ); | 1262 | ); |
1264 | 1263 | ||
1265 | if (file->publish) | 1264 | if (file->publish) |
@@ -1275,7 +1274,7 @@ file_binding: | |||
1275 | 1274 | ||
1276 | enum GNUNET_GenericReturnValue | 1275 | enum GNUNET_GenericReturnValue |
1277 | GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, | 1276 | GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, |
1278 | const struct GNUNET_CHAT_File *file) | 1277 | const struct GNUNET_CHAT_File *file) |
1279 | { | 1278 | { |
1280 | GNUNET_CHAT_VERSION_ASSERT(); | 1279 | GNUNET_CHAT_VERSION_ASSERT(); |
1281 | 1280 | ||
@@ -1299,8 +1298,8 @@ GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, | |||
1299 | 1298 | ||
1300 | int | 1299 | int |
1301 | GNUNET_CHAT_context_iterate_messages (struct GNUNET_CHAT_Context *context, | 1300 | GNUNET_CHAT_context_iterate_messages (struct GNUNET_CHAT_Context *context, |
1302 | GNUNET_CHAT_ContextMessageCallback callback, | 1301 | GNUNET_CHAT_ContextMessageCallback callback, |
1303 | void *cls) | 1302 | void *cls) |
1304 | { | 1303 | { |
1305 | GNUNET_CHAT_VERSION_ASSERT(); | 1304 | GNUNET_CHAT_VERSION_ASSERT(); |
1306 | 1305 | ||
@@ -1313,15 +1312,15 @@ GNUNET_CHAT_context_iterate_messages (struct GNUNET_CHAT_Context *context, | |||
1313 | it.cls = cls; | 1312 | it.cls = cls; |
1314 | 1313 | ||
1315 | return GNUNET_CONTAINER_multihashmap_iterate( | 1314 | return GNUNET_CONTAINER_multihashmap_iterate( |
1316 | context->messages, it_context_iterate_messages, &it | 1315 | context->messages, it_context_iterate_messages, &it |
1317 | ); | 1316 | ); |
1318 | } | 1317 | } |
1319 | 1318 | ||
1320 | 1319 | ||
1321 | int | 1320 | int |
1322 | GNUNET_CHAT_context_iterate_files (struct GNUNET_CHAT_Context *context, | 1321 | GNUNET_CHAT_context_iterate_files (struct GNUNET_CHAT_Context *context, |
1323 | GNUNET_CHAT_ContextFileCallback callback, | 1322 | GNUNET_CHAT_ContextFileCallback callback, |
1324 | void *cls) | 1323 | void *cls) |
1325 | { | 1324 | { |
1326 | GNUNET_CHAT_VERSION_ASSERT(); | 1325 | GNUNET_CHAT_VERSION_ASSERT(); |
1327 | 1326 | ||
@@ -1334,7 +1333,7 @@ GNUNET_CHAT_context_iterate_files (struct GNUNET_CHAT_Context *context, | |||
1334 | it.cls = cls; | 1333 | it.cls = cls; |
1335 | 1334 | ||
1336 | return GNUNET_CONTAINER_multihashmap_iterate( | 1335 | return GNUNET_CONTAINER_multihashmap_iterate( |
1337 | context->files, it_context_iterate_files, &it | 1336 | context->files, it_context_iterate_files, &it |
1338 | ); | 1337 | ); |
1339 | } | 1338 | } |
1340 | 1339 | ||
@@ -1390,7 +1389,7 @@ GNUNET_CHAT_message_get_sender (const struct GNUNET_CHAT_Message *message) | |||
1390 | return NULL; | 1389 | return NULL; |
1391 | 1390 | ||
1392 | const struct GNUNET_MESSENGER_Contact *sender = GNUNET_MESSENGER_get_sender( | 1391 | const struct GNUNET_MESSENGER_Contact *sender = GNUNET_MESSENGER_get_sender( |
1393 | message->context->room, &(message->hash) | 1392 | message->context->room, &(message->hash) |
1394 | ); | 1393 | ); |
1395 | 1394 | ||
1396 | if (!sender) | 1395 | if (!sender) |
@@ -1447,8 +1446,8 @@ GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message) | |||
1447 | 1446 | ||
1448 | int | 1447 | int |
1449 | GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | 1448 | GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, |
1450 | GNUNET_CHAT_MessageReadReceiptCallback callback, | 1449 | GNUNET_CHAT_MessageReadReceiptCallback callback, |
1451 | void *cls) | 1450 | void *cls) |
1452 | { | 1451 | { |
1453 | GNUNET_CHAT_VERSION_ASSERT(); | 1452 | GNUNET_CHAT_VERSION_ASSERT(); |
1454 | 1453 | ||
@@ -1461,7 +1460,7 @@ GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | |||
1461 | it.cls = cls; | 1460 | it.cls = cls; |
1462 | 1461 | ||
1463 | return GNUNET_MESSENGER_iterate_members( | 1462 | return GNUNET_MESSENGER_iterate_members( |
1464 | message->context->room, it_message_iterate_read_receipts, &it | 1463 | message->context->room, it_message_iterate_read_receipts, &it |
1465 | ); | 1464 | ); |
1466 | } | 1465 | } |
1467 | 1466 | ||
@@ -1497,8 +1496,8 @@ GNUNET_CHAT_message_get_file (const struct GNUNET_CHAT_Message *message) | |||
1497 | return NULL; | 1496 | return NULL; |
1498 | 1497 | ||
1499 | return GNUNET_CONTAINER_multihashmap_get( | 1498 | return GNUNET_CONTAINER_multihashmap_get( |
1500 | message->context->handle->files, | 1499 | message->context->handle->files, |
1501 | &(message->msg->body.file.hash) | 1500 | &(message->msg->body.file.hash) |
1502 | ); | 1501 | ); |
1503 | } | 1502 | } |
1504 | 1503 | ||
@@ -1515,8 +1514,8 @@ GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message) | |||
1515 | return NULL; | 1514 | return NULL; |
1516 | 1515 | ||
1517 | return GNUNET_CONTAINER_multihashmap_get( | 1516 | return GNUNET_CONTAINER_multihashmap_get( |
1518 | message->context->invites, | 1517 | message->context->invites, |
1519 | &(message->hash) | 1518 | &(message->hash) |
1520 | ); | 1519 | ); |
1521 | } | 1520 | } |
1522 | 1521 | ||
@@ -1544,7 +1543,7 @@ GNUNET_CHAT_message_get_target (const struct GNUNET_CHAT_Message *message) | |||
1544 | 1543 | ||
1545 | enum GNUNET_GenericReturnValue | 1544 | enum GNUNET_GenericReturnValue |
1546 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, | 1545 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, |
1547 | struct GNUNET_TIME_Relative delay) | 1546 | struct GNUNET_TIME_Relative delay) |
1548 | { | 1547 | { |
1549 | GNUNET_CHAT_VERSION_ASSERT(); | 1548 | GNUNET_CHAT_VERSION_ASSERT(); |
1550 | 1549 | ||
@@ -1612,7 +1611,7 @@ GNUNET_CHAT_file_get_local_size (const struct GNUNET_CHAT_File *file) | |||
1612 | 1611 | ||
1613 | char *filename; | 1612 | char *filename; |
1614 | util_get_filename ( | 1613 | util_get_filename ( |
1615 | directory, "files", &(file->hash), &filename | 1614 | directory, "files", &(file->hash), &filename |
1616 | ); | 1615 | ); |
1617 | 1616 | ||
1618 | uint64_t size; | 1617 | uint64_t size; |
@@ -1654,7 +1653,7 @@ GNUNET_CHAT_file_open_preview (struct GNUNET_CHAT_File *file) | |||
1654 | 1653 | ||
1655 | char *filename; | 1654 | char *filename; |
1656 | util_get_filename ( | 1655 | util_get_filename ( |
1657 | directory, "files", &(file->hash), &filename | 1656 | directory, "files", &(file->hash), &filename |
1658 | ); | 1657 | ); |
1659 | 1658 | ||
1660 | if (GNUNET_YES != GNUNET_DISK_file_test(filename)) | 1659 | if (GNUNET_YES != GNUNET_DISK_file_test(filename)) |
@@ -1669,8 +1668,7 @@ GNUNET_CHAT_file_open_preview (struct GNUNET_CHAT_File *file) | |||
1669 | 1668 | ||
1670 | if ((GNUNET_OK != GNUNET_DISK_file_copy(filename, file->preview)) || | 1669 | if ((GNUNET_OK != GNUNET_DISK_file_copy(filename, file->preview)) || |
1671 | (GNUNET_OK != util_decrypt_file(file->preview, | 1670 | (GNUNET_OK != util_decrypt_file(file->preview, |
1672 | &(file->hash), | 1671 | &(file->hash), &(file->key)))) |
1673 | &(file->key)))) | ||
1674 | { | 1672 | { |
1675 | GNUNET_free(file->preview); | 1673 | GNUNET_free(file->preview); |
1676 | file->preview = NULL; | 1674 | file->preview = NULL; |
@@ -1699,7 +1697,7 @@ GNUNET_CHAT_file_close_preview (struct GNUNET_CHAT_File *file) | |||
1699 | 1697 | ||
1700 | void | 1698 | void |
1701 | GNUNET_CHAT_file_set_user_pointer (struct GNUNET_CHAT_File *file, | 1699 | GNUNET_CHAT_file_set_user_pointer (struct GNUNET_CHAT_File *file, |
1702 | void *user_pointer) | 1700 | void *user_pointer) |
1703 | { | 1701 | { |
1704 | GNUNET_CHAT_VERSION_ASSERT(); | 1702 | GNUNET_CHAT_VERSION_ASSERT(); |
1705 | 1703 | ||
@@ -1736,15 +1734,15 @@ GNUNET_CHAT_file_is_downloading (const struct GNUNET_CHAT_File *file) | |||
1736 | 1734 | ||
1737 | enum GNUNET_GenericReturnValue | 1735 | enum GNUNET_GenericReturnValue |
1738 | GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | 1736 | GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, |
1739 | GNUNET_CHAT_FileDownloadCallback callback, | 1737 | GNUNET_CHAT_FileDownloadCallback callback, |
1740 | void *cls) | 1738 | void *cls) |
1741 | { | 1739 | { |
1742 | GNUNET_CHAT_VERSION_ASSERT(); | 1740 | GNUNET_CHAT_VERSION_ASSERT(); |
1743 | 1741 | ||
1744 | if ((!file) || (!(file->uri))) | 1742 | if ((!file) || (!(file->uri))) |
1745 | return GNUNET_SYSERR; | 1743 | return GNUNET_SYSERR; |
1746 | 1744 | ||
1747 | if (file->download) | 1745 | if (file->download)a |
1748 | { | 1746 | { |
1749 | file_bind_downlaod(file, callback, cls); | 1747 | file_bind_downlaod(file, callback, cls); |
1750 | 1748 | ||
@@ -1761,11 +1759,12 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
1761 | 1759 | ||
1762 | char *filename; | 1760 | char *filename; |
1763 | util_get_filename ( | 1761 | util_get_filename ( |
1764 | directory, "files", &(file->hash), &filename | 1762 | directory, "files", &(file->hash), &filename |
1765 | ); | 1763 | ); |
1766 | 1764 | ||
1767 | uint64_t offset; | 1765 | uint64_t offset; |
1768 | if (GNUNET_OK != GNUNET_DISK_file_size(filename, &offset, GNUNET_NO, GNUNET_YES)) | 1766 | if (GNUNET_OK != GNUNET_DISK_file_size(filename, &offset, |
1767 | GNUNET_NO, GNUNET_YES)) | ||
1769 | offset = 0; | 1768 | offset = 0; |
1770 | 1769 | ||
1771 | if (offset >= size) | 1770 | if (offset >= size) |
@@ -1781,17 +1780,17 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
1781 | const uint64_t remaining = (size - offset); | 1780 | const uint64_t remaining = (size - offset); |
1782 | 1781 | ||
1783 | file->download = GNUNET_FS_download_start( | 1782 | file->download = GNUNET_FS_download_start( |
1784 | file->handle->fs, | 1783 | file->handle->fs, |
1785 | file->uri, | 1784 | file->uri, |
1786 | file->meta, | 1785 | file->meta, |
1787 | filename, | 1786 | filename, |
1788 | NULL, | 1787 | NULL, |
1789 | offset, | 1788 | offset, |
1790 | remaining, | 1789 | remaining, |
1791 | 1, | 1790 | 1, |
1792 | GNUNET_FS_DOWNLOAD_OPTION_NONE, | 1791 | GNUNET_FS_DOWNLOAD_OPTION_NONE, |
1793 | file, | 1792 | file, |
1794 | NULL | 1793 | NULL |
1795 | ); | 1794 | ); |
1796 | 1795 | ||
1797 | if (file->download) | 1796 | if (file->download) |
@@ -1856,8 +1855,8 @@ GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file) | |||
1856 | 1855 | ||
1857 | enum GNUNET_GenericReturnValue | 1856 | enum GNUNET_GenericReturnValue |
1858 | GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | 1857 | GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, |
1859 | GNUNET_CHAT_FileUnindexCallback callback, | 1858 | GNUNET_CHAT_FileUnindexCallback callback, |
1860 | void *cls) | 1859 | void *cls) |
1861 | { | 1860 | { |
1862 | GNUNET_CHAT_VERSION_ASSERT(); | 1861 | GNUNET_CHAT_VERSION_ASSERT(); |
1863 | 1862 | ||
@@ -1883,11 +1882,11 @@ GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | |||
1883 | 1882 | ||
1884 | char *filename; | 1883 | char *filename; |
1885 | util_get_filename ( | 1884 | util_get_filename ( |
1886 | directory, "files", &(file->hash), &filename | 1885 | directory, "files", &(file->hash), &filename |
1887 | ); | 1886 | ); |
1888 | 1887 | ||
1889 | file->unindex = GNUNET_FS_unindex_start( | 1888 | file->unindex = GNUNET_FS_unindex_start( |
1890 | file->handle->fs, filename, file | 1889 | file->handle->fs, filename, file |
1891 | ); | 1890 | ); |
1892 | 1891 | ||
1893 | if (file->unindex) | 1892 | if (file->unindex) |
@@ -1910,13 +1909,14 @@ GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) | |||
1910 | GNUNET_PEER_resolve(invitation->door, &door); | 1909 | GNUNET_PEER_resolve(invitation->door, &door); |
1911 | 1910 | ||
1912 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room( | 1911 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room( |
1913 | invitation->context->handle->messenger, | 1912 | invitation->context->handle->messenger, |
1914 | &door, &(invitation->key) | 1913 | &door, &(invitation->key) |
1915 | ); | 1914 | ); |
1916 | 1915 | ||
1917 | handle_send_room_name(invitation->context->handle, room); | 1916 | handle_send_room_name(invitation->context->handle, room); |
1918 | } | 1917 | } |
1919 | 1918 | ||
1919 | |||
1920 | enum GNUNET_GenericReturnValue | 1920 | enum GNUNET_GenericReturnValue |
1921 | GNUNET_CHAT_invitation_is_accepted (const struct GNUNET_CHAT_Invitation *invitation) | 1921 | GNUNET_CHAT_invitation_is_accepted (const struct GNUNET_CHAT_Invitation *invitation) |
1922 | { | 1922 | { |
@@ -1926,7 +1926,7 @@ GNUNET_CHAT_invitation_is_accepted (const struct GNUNET_CHAT_Invitation *invitat | |||
1926 | return GNUNET_NO; | 1926 | return GNUNET_NO; |
1927 | 1927 | ||
1928 | return GNUNET_CONTAINER_multihashmap_contains( | 1928 | return GNUNET_CONTAINER_multihashmap_contains( |
1929 | invitation->context->handle->contexts, | 1929 | invitation->context->handle->contexts, |
1930 | &(invitation->key) | 1930 | &(invitation->key) |
1931 | ); | 1931 | ); |
1932 | } | 1932 | } |