diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-30 13:22:05 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-30 13:22:05 +0200 |
commit | 5076508d493b0f41036039e7984cd1377eda39d2 (patch) | |
tree | 4fd7c3b11c96214a6adef2eda18a57f812140ff1 | |
parent | 4df66ae0839555369313675df5391146083827e8 (diff) | |
download | libgnunetchat-5076508d493b0f41036039e7984cd1377eda39d2.tar.gz libgnunetchat-5076508d493b0f41036039e7984cd1377eda39d2.zip |
Added version makros and assertion to ensure compatibility
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | include/gnunet_chat_lib.h | 11 | ||||
-rw-r--r-- | src/gnunet_chat_lib.c | 172 |
2 files changed, 183 insertions, 0 deletions
diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h index a434381..cc604cd 100644 --- a/include/gnunet_chat_lib.h +++ b/include/gnunet_chat_lib.h | |||
@@ -39,6 +39,17 @@ | |||
39 | #include <gnunet/gnunet_time_lib.h> | 39 | #include <gnunet/gnunet_time_lib.h> |
40 | #include <gnunet/gnunet_util_lib.h> | 40 | #include <gnunet/gnunet_util_lib.h> |
41 | 41 | ||
42 | /** | ||
43 | * @def GNUNET_CHAT_VERSION The major and minor version should be identical to | ||
44 | * the #GNUNET_MESSENGER_VERSION of the GNUnet Messenger | ||
45 | * service while the patch version is independent. | ||
46 | */ | ||
47 | #define GNUNET_CHAT_VERSION 0x000000010000L | ||
48 | |||
49 | #define GNUNET_CHAT_VERSION_MAJOR ((GNUNET_CHAT_VERSION >> 32L) & 0xFFFFL) | ||
50 | #define GNUNET_CHAT_VERSION_MINOR ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFL) | ||
51 | #define GNUNET_CHAT_VERSION_PATCH ((GNUNET_CHAT_VERSION >> 0L) & 0xFFFFL) | ||
52 | |||
42 | #define GNUNET_CHAT_URI_PREFIX "gnunet://chat/" | 53 | #define GNUNET_CHAT_URI_PREFIX "gnunet://chat/" |
43 | 54 | ||
44 | /** | 55 | /** |
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index 8ec7499..1fcc419 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -39,11 +39,19 @@ | |||
39 | 39 | ||
40 | #include "gnunet_chat_lib_intern.c" | 40 | #include "gnunet_chat_lib_intern.c" |
41 | 41 | ||
42 | #define GNUNET_CHAT_VERSION_ASSERT() {\ | ||
43 | GNUNET_assert(\ | ||
44 | (GNUNET_MESSENGER_VERSION == ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFFFFFL))\ | ||
45 | );\ | ||
46 | } | ||
47 | |||
42 | struct GNUNET_CHAT_Handle* | 48 | struct GNUNET_CHAT_Handle* |
43 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 49 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
44 | const char *directory, | 50 | const char *directory, |
45 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls) | 51 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls) |
46 | { | 52 | { |
53 | GNUNET_CHAT_VERSION_ASSERT(); | ||
54 | |||
47 | if (!cfg) | 55 | if (!cfg) |
48 | return NULL; | 56 | return NULL; |
49 | 57 | ||
@@ -57,6 +65,8 @@ GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
57 | void | 65 | void |
58 | GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle) | 66 | GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle) |
59 | { | 67 | { |
68 | GNUNET_CHAT_VERSION_ASSERT(); | ||
69 | |||
60 | if (!handle) | 70 | if (!handle) |
61 | return; | 71 | return; |
62 | 72 | ||
@@ -68,6 +78,8 @@ int | |||
68 | GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, | 78 | GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, |
69 | const char* name) | 79 | const char* name) |
70 | { | 80 | { |
81 | GNUNET_CHAT_VERSION_ASSERT(); | ||
82 | |||
71 | if ((!handle) || (!name)) | 83 | if ((!handle) || (!name)) |
72 | return GNUNET_SYSERR; | 84 | return GNUNET_SYSERR; |
73 | 85 | ||
@@ -106,6 +118,8 @@ GNUNET_CHAT_iterate_accounts (const struct GNUNET_CHAT_Handle *handle, | |||
106 | GNUNET_CHAT_AccountCallback callback, | 118 | GNUNET_CHAT_AccountCallback callback, |
107 | void *cls) | 119 | void *cls) |
108 | { | 120 | { |
121 | GNUNET_CHAT_VERSION_ASSERT(); | ||
122 | |||
109 | if (!handle) | 123 | if (!handle) |
110 | return GNUNET_SYSERR; | 124 | return GNUNET_SYSERR; |
111 | 125 | ||
@@ -133,6 +147,8 @@ void | |||
133 | GNUNET_CHAT_connect (struct GNUNET_CHAT_Handle *handle, | 147 | GNUNET_CHAT_connect (struct GNUNET_CHAT_Handle *handle, |
134 | const struct GNUNET_CHAT_Account *account) | 148 | const struct GNUNET_CHAT_Account *account) |
135 | { | 149 | { |
150 | GNUNET_CHAT_VERSION_ASSERT(); | ||
151 | |||
136 | if (!handle) | 152 | if (!handle) |
137 | return; | 153 | return; |
138 | 154 | ||
@@ -152,6 +168,8 @@ GNUNET_CHAT_connect (struct GNUNET_CHAT_Handle *handle, | |||
152 | void | 168 | void |
153 | GNUNET_CHAT_disconnect (struct GNUNET_CHAT_Handle *handle) | 169 | GNUNET_CHAT_disconnect (struct GNUNET_CHAT_Handle *handle) |
154 | { | 170 | { |
171 | GNUNET_CHAT_VERSION_ASSERT(); | ||
172 | |||
155 | if ((!handle) || (!(handle->current))) | 173 | if ((!handle) || (!(handle->current))) |
156 | return; | 174 | return; |
157 | 175 | ||
@@ -162,6 +180,8 @@ GNUNET_CHAT_disconnect (struct GNUNET_CHAT_Handle *handle) | |||
162 | const struct GNUNET_CHAT_Account* | 180 | const struct GNUNET_CHAT_Account* |
163 | GNUNET_CHAT_get_connected (const struct GNUNET_CHAT_Handle *handle) | 181 | GNUNET_CHAT_get_connected (const struct GNUNET_CHAT_Handle *handle) |
164 | { | 182 | { |
183 | GNUNET_CHAT_VERSION_ASSERT(); | ||
184 | |||
165 | if (!handle) | 185 | if (!handle) |
166 | return NULL; | 186 | return NULL; |
167 | 187 | ||
@@ -172,6 +192,8 @@ GNUNET_CHAT_get_connected (const struct GNUNET_CHAT_Handle *handle) | |||
172 | int | 192 | int |
173 | GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle) | 193 | GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle) |
174 | { | 194 | { |
195 | GNUNET_CHAT_VERSION_ASSERT(); | ||
196 | |||
175 | if (!handle) | 197 | if (!handle) |
176 | return GNUNET_SYSERR; | 198 | return GNUNET_SYSERR; |
177 | 199 | ||
@@ -183,6 +205,8 @@ int | |||
183 | GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, | 205 | GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, |
184 | const char *name) | 206 | const char *name) |
185 | { | 207 | { |
208 | GNUNET_CHAT_VERSION_ASSERT(); | ||
209 | |||
186 | if (!handle) | 210 | if (!handle) |
187 | return GNUNET_SYSERR; | 211 | return GNUNET_SYSERR; |
188 | 212 | ||
@@ -196,6 +220,8 @@ GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, | |||
196 | const char* | 220 | const char* |
197 | GNUNET_CHAT_get_name (const struct GNUNET_CHAT_Handle *handle) | 221 | GNUNET_CHAT_get_name (const struct GNUNET_CHAT_Handle *handle) |
198 | { | 222 | { |
223 | GNUNET_CHAT_VERSION_ASSERT(); | ||
224 | |||
199 | if (!handle) | 225 | if (!handle) |
200 | return NULL; | 226 | return NULL; |
201 | 227 | ||
@@ -206,6 +232,8 @@ GNUNET_CHAT_get_name (const struct GNUNET_CHAT_Handle *handle) | |||
206 | const char* | 232 | const char* |
207 | GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle) | 233 | GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle) |
208 | { | 234 | { |
235 | GNUNET_CHAT_VERSION_ASSERT(); | ||
236 | |||
209 | if (!handle) | 237 | if (!handle) |
210 | return NULL; | 238 | return NULL; |
211 | 239 | ||
@@ -217,6 +245,8 @@ struct GNUNET_CHAT_Uri* | |||
217 | GNUNET_CHAT_uri_parse (const char *uri, | 245 | GNUNET_CHAT_uri_parse (const char *uri, |
218 | char **emsg) | 246 | char **emsg) |
219 | { | 247 | { |
248 | GNUNET_CHAT_VERSION_ASSERT(); | ||
249 | |||
220 | if (!uri) | 250 | if (!uri) |
221 | return NULL; | 251 | return NULL; |
222 | 252 | ||
@@ -264,6 +294,8 @@ GNUNET_CHAT_uri_parse (const char *uri, | |||
264 | char* | 294 | char* |
265 | GNUNET_CHAT_uri_to_string (const struct GNUNET_CHAT_Uri *uri) | 295 | GNUNET_CHAT_uri_to_string (const struct GNUNET_CHAT_Uri *uri) |
266 | { | 296 | { |
297 | GNUNET_CHAT_VERSION_ASSERT(); | ||
298 | |||
267 | if (!uri) | 299 | if (!uri) |
268 | return NULL; | 300 | return NULL; |
269 | 301 | ||
@@ -285,6 +317,8 @@ GNUNET_CHAT_uri_to_string (const struct GNUNET_CHAT_Uri *uri) | |||
285 | void | 317 | void |
286 | GNUNET_CHAT_uri_destroy (struct GNUNET_CHAT_Uri *uri) | 318 | GNUNET_CHAT_uri_destroy (struct GNUNET_CHAT_Uri *uri) |
287 | { | 319 | { |
320 | GNUNET_CHAT_VERSION_ASSERT(); | ||
321 | |||
288 | if (!uri) | 322 | if (!uri) |
289 | return; | 323 | return; |
290 | 324 | ||
@@ -298,6 +332,8 @@ GNUNET_CHAT_lobby_open (struct GNUNET_CHAT_Handle *handle, | |||
298 | GNUNET_CHAT_LobbyCallback callback, | 332 | GNUNET_CHAT_LobbyCallback callback, |
299 | void *cls) | 333 | void *cls) |
300 | { | 334 | { |
335 | GNUNET_CHAT_VERSION_ASSERT(); | ||
336 | |||
301 | if (!handle) | 337 | if (!handle) |
302 | return NULL; | 338 | return NULL; |
303 | 339 | ||
@@ -322,6 +358,8 @@ GNUNET_CHAT_lobby_open (struct GNUNET_CHAT_Handle *handle, | |||
322 | void | 358 | void |
323 | GNUNET_CHAT_lobby_close (struct GNUNET_CHAT_Lobby *lobby) | 359 | GNUNET_CHAT_lobby_close (struct GNUNET_CHAT_Lobby *lobby) |
324 | { | 360 | { |
361 | GNUNET_CHAT_VERSION_ASSERT(); | ||
362 | |||
325 | if (!lobby) | 363 | if (!lobby) |
326 | return; | 364 | return; |
327 | 365 | ||
@@ -352,6 +390,8 @@ void | |||
352 | GNUNET_CHAT_lobby_join (struct GNUNET_CHAT_Handle *handle, | 390 | GNUNET_CHAT_lobby_join (struct GNUNET_CHAT_Handle *handle, |
353 | const struct GNUNET_CHAT_Uri *uri) | 391 | const struct GNUNET_CHAT_Uri *uri) |
354 | { | 392 | { |
393 | GNUNET_CHAT_VERSION_ASSERT(); | ||
394 | |||
355 | if ((!handle) || (!uri) || (!(handle->gns))) | 395 | if ((!handle) || (!uri) || (!(handle->gns))) |
356 | return; | 396 | return; |
357 | 397 | ||
@@ -384,6 +424,8 @@ void | |||
384 | GNUNET_CHAT_set_user_pointer (struct GNUNET_CHAT_Handle *handle, | 424 | GNUNET_CHAT_set_user_pointer (struct GNUNET_CHAT_Handle *handle, |
385 | void *user_pointer) | 425 | void *user_pointer) |
386 | { | 426 | { |
427 | GNUNET_CHAT_VERSION_ASSERT(); | ||
428 | |||
387 | if (!handle) | 429 | if (!handle) |
388 | return; | 430 | return; |
389 | 431 | ||
@@ -394,6 +436,8 @@ GNUNET_CHAT_set_user_pointer (struct GNUNET_CHAT_Handle *handle, | |||
394 | void* | 436 | void* |
395 | GNUNET_CHAT_get_user_pointer (const struct GNUNET_CHAT_Handle *handle) | 437 | GNUNET_CHAT_get_user_pointer (const struct GNUNET_CHAT_Handle *handle) |
396 | { | 438 | { |
439 | GNUNET_CHAT_VERSION_ASSERT(); | ||
440 | |||
397 | if (!handle) | 441 | if (!handle) |
398 | return NULL; | 442 | return NULL; |
399 | 443 | ||
@@ -406,6 +450,8 @@ GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle, | |||
406 | GNUNET_CHAT_ContactCallback callback, | 450 | GNUNET_CHAT_ContactCallback callback, |
407 | void *cls) | 451 | void *cls) |
408 | { | 452 | { |
453 | GNUNET_CHAT_VERSION_ASSERT(); | ||
454 | |||
409 | if ((!handle) || (!(handle->contacts))) | 455 | if ((!handle) || (!(handle->contacts))) |
410 | return GNUNET_SYSERR; | 456 | return GNUNET_SYSERR; |
411 | 457 | ||
@@ -423,6 +469,8 @@ GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle, | |||
423 | const char* | 469 | const char* |
424 | GNUNET_CHAT_account_get_name (const struct GNUNET_CHAT_Account *account) | 470 | GNUNET_CHAT_account_get_name (const struct GNUNET_CHAT_Account *account) |
425 | { | 471 | { |
472 | GNUNET_CHAT_VERSION_ASSERT(); | ||
473 | |||
426 | if (!account) | 474 | if (!account) |
427 | return NULL; | 475 | return NULL; |
428 | 476 | ||
@@ -434,6 +482,8 @@ void | |||
434 | GNUNET_CHAT_account_set_user_pointer (struct GNUNET_CHAT_Account *account, | 482 | GNUNET_CHAT_account_set_user_pointer (struct GNUNET_CHAT_Account *account, |
435 | void *user_pointer) | 483 | void *user_pointer) |
436 | { | 484 | { |
485 | GNUNET_CHAT_VERSION_ASSERT(); | ||
486 | |||
437 | if (!account) | 487 | if (!account) |
438 | return; | 488 | return; |
439 | 489 | ||
@@ -444,6 +494,8 @@ GNUNET_CHAT_account_set_user_pointer (struct GNUNET_CHAT_Account *account, | |||
444 | void* | 494 | void* |
445 | GNUNET_CHAT_account_get_user_pointer (const struct GNUNET_CHAT_Account *account) | 495 | GNUNET_CHAT_account_get_user_pointer (const struct GNUNET_CHAT_Account *account) |
446 | { | 496 | { |
497 | GNUNET_CHAT_VERSION_ASSERT(); | ||
498 | |||
447 | if (!account) | 499 | if (!account) |
448 | return NULL; | 500 | return NULL; |
449 | 501 | ||
@@ -455,6 +507,8 @@ struct GNUNET_CHAT_Group * | |||
455 | GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle, | 507 | GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle, |
456 | const char* topic) | 508 | const char* topic) |
457 | { | 509 | { |
510 | GNUNET_CHAT_VERSION_ASSERT(); | ||
511 | |||
458 | if ((!handle) || (!(handle->groups)) || (!(handle->contexts))) | 512 | if ((!handle) || (!(handle->groups)) || (!(handle->contexts))) |
459 | return NULL; | 513 | return NULL; |
460 | 514 | ||
@@ -517,6 +571,8 @@ GNUNET_CHAT_iterate_groups (struct GNUNET_CHAT_Handle *handle, | |||
517 | GNUNET_CHAT_GroupCallback callback, | 571 | GNUNET_CHAT_GroupCallback callback, |
518 | void *cls) | 572 | void *cls) |
519 | { | 573 | { |
574 | GNUNET_CHAT_VERSION_ASSERT(); | ||
575 | |||
520 | if ((!handle) || (!(handle->groups))) | 576 | if ((!handle) || (!(handle->groups))) |
521 | return GNUNET_SYSERR; | 577 | return GNUNET_SYSERR; |
522 | 578 | ||
@@ -534,6 +590,8 @@ GNUNET_CHAT_iterate_groups (struct GNUNET_CHAT_Handle *handle, | |||
534 | int | 590 | int |
535 | GNUNET_CHAT_contact_delete (struct GNUNET_CHAT_Contact *contact) | 591 | GNUNET_CHAT_contact_delete (struct GNUNET_CHAT_Contact *contact) |
536 | { | 592 | { |
593 | GNUNET_CHAT_VERSION_ASSERT(); | ||
594 | |||
537 | if (!contact) | 595 | if (!contact) |
538 | return GNUNET_SYSERR; | 596 | return GNUNET_SYSERR; |
539 | 597 | ||
@@ -567,6 +625,8 @@ void | |||
567 | GNUNET_CHAT_contact_set_name (struct GNUNET_CHAT_Contact *contact, | 625 | GNUNET_CHAT_contact_set_name (struct GNUNET_CHAT_Contact *contact, |
568 | const char *name) | 626 | const char *name) |
569 | { | 627 | { |
628 | GNUNET_CHAT_VERSION_ASSERT(); | ||
629 | |||
570 | if ((!contact) || (!(contact->context))) | 630 | if ((!contact) || (!(contact->context))) |
571 | return; | 631 | return; |
572 | 632 | ||
@@ -580,6 +640,8 @@ GNUNET_CHAT_contact_set_name (struct GNUNET_CHAT_Contact *contact, | |||
580 | const char* | 640 | const char* |
581 | GNUNET_CHAT_contact_get_name (const struct GNUNET_CHAT_Contact *contact) | 641 | GNUNET_CHAT_contact_get_name (const struct GNUNET_CHAT_Contact *contact) |
582 | { | 642 | { |
643 | GNUNET_CHAT_VERSION_ASSERT(); | ||
644 | |||
583 | if (!contact) | 645 | if (!contact) |
584 | return NULL; | 646 | return NULL; |
585 | 647 | ||
@@ -593,6 +655,8 @@ GNUNET_CHAT_contact_get_name (const struct GNUNET_CHAT_Contact *contact) | |||
593 | const char* | 655 | const char* |
594 | GNUNET_CHAT_contact_get_key (const struct GNUNET_CHAT_Contact *contact) | 656 | GNUNET_CHAT_contact_get_key (const struct GNUNET_CHAT_Contact *contact) |
595 | { | 657 | { |
658 | GNUNET_CHAT_VERSION_ASSERT(); | ||
659 | |||
596 | if (!contact) | 660 | if (!contact) |
597 | return NULL; | 661 | return NULL; |
598 | 662 | ||
@@ -603,6 +667,8 @@ GNUNET_CHAT_contact_get_key (const struct GNUNET_CHAT_Contact *contact) | |||
603 | struct GNUNET_CHAT_Context* | 667 | struct GNUNET_CHAT_Context* |
604 | GNUNET_CHAT_contact_get_context (struct GNUNET_CHAT_Contact *contact) | 668 | GNUNET_CHAT_contact_get_context (struct GNUNET_CHAT_Contact *contact) |
605 | { | 669 | { |
670 | GNUNET_CHAT_VERSION_ASSERT(); | ||
671 | |||
606 | if (!contact) | 672 | if (!contact) |
607 | return NULL; | 673 | return NULL; |
608 | 674 | ||
@@ -627,6 +693,8 @@ void | |||
627 | GNUNET_CHAT_contact_set_user_pointer (struct GNUNET_CHAT_Contact *contact, | 693 | GNUNET_CHAT_contact_set_user_pointer (struct GNUNET_CHAT_Contact *contact, |
628 | void *user_pointer) | 694 | void *user_pointer) |
629 | { | 695 | { |
696 | GNUNET_CHAT_VERSION_ASSERT(); | ||
697 | |||
630 | if (!contact) | 698 | if (!contact) |
631 | return; | 699 | return; |
632 | 700 | ||
@@ -637,6 +705,8 @@ GNUNET_CHAT_contact_set_user_pointer (struct GNUNET_CHAT_Contact *contact, | |||
637 | void* | 705 | void* |
638 | GNUNET_CHAT_contact_get_user_pointer (const struct GNUNET_CHAT_Contact *contact) | 706 | GNUNET_CHAT_contact_get_user_pointer (const struct GNUNET_CHAT_Contact *contact) |
639 | { | 707 | { |
708 | GNUNET_CHAT_VERSION_ASSERT(); | ||
709 | |||
640 | if (!contact) | 710 | if (!contact) |
641 | return NULL; | 711 | return NULL; |
642 | 712 | ||
@@ -647,6 +717,8 @@ GNUNET_CHAT_contact_get_user_pointer (const struct GNUNET_CHAT_Contact *contact) | |||
647 | int | 717 | int |
648 | GNUNET_CHAT_contact_is_owned (const struct GNUNET_CHAT_Contact *contact) | 718 | GNUNET_CHAT_contact_is_owned (const struct GNUNET_CHAT_Contact *contact) |
649 | { | 719 | { |
720 | GNUNET_CHAT_VERSION_ASSERT(); | ||
721 | |||
650 | if (!contact) | 722 | if (!contact) |
651 | return GNUNET_SYSERR; | 723 | return GNUNET_SYSERR; |
652 | 724 | ||
@@ -657,6 +729,8 @@ GNUNET_CHAT_contact_is_owned (const struct GNUNET_CHAT_Contact *contact) | |||
657 | int | 729 | int |
658 | GNUNET_CHAT_group_leave (struct GNUNET_CHAT_Group *group) | 730 | GNUNET_CHAT_group_leave (struct GNUNET_CHAT_Group *group) |
659 | { | 731 | { |
732 | GNUNET_CHAT_VERSION_ASSERT(); | ||
733 | |||
660 | if (!group) | 734 | if (!group) |
661 | return GNUNET_SYSERR; | 735 | return GNUNET_SYSERR; |
662 | 736 | ||
@@ -687,6 +761,8 @@ void | |||
687 | GNUNET_CHAT_group_set_name (struct GNUNET_CHAT_Group *group, | 761 | GNUNET_CHAT_group_set_name (struct GNUNET_CHAT_Group *group, |
688 | const char *name) | 762 | const char *name) |
689 | { | 763 | { |
764 | GNUNET_CHAT_VERSION_ASSERT(); | ||
765 | |||
690 | if ((!group) || (!(group->context))) | 766 | if ((!group) || (!(group->context))) |
691 | return; | 767 | return; |
692 | 768 | ||
@@ -700,6 +776,8 @@ GNUNET_CHAT_group_set_name (struct GNUNET_CHAT_Group *group, | |||
700 | const char* | 776 | const char* |
701 | GNUNET_CHAT_group_get_name (const struct GNUNET_CHAT_Group *group) | 777 | GNUNET_CHAT_group_get_name (const struct GNUNET_CHAT_Group *group) |
702 | { | 778 | { |
779 | GNUNET_CHAT_VERSION_ASSERT(); | ||
780 | |||
703 | if ((!group) || (!(group->context))) | 781 | if ((!group) || (!(group->context))) |
704 | return NULL; | 782 | return NULL; |
705 | 783 | ||
@@ -714,6 +792,8 @@ void | |||
714 | GNUNET_CHAT_group_set_user_pointer (struct GNUNET_CHAT_Group *group, | 792 | GNUNET_CHAT_group_set_user_pointer (struct GNUNET_CHAT_Group *group, |
715 | void *user_pointer) | 793 | void *user_pointer) |
716 | { | 794 | { |
795 | GNUNET_CHAT_VERSION_ASSERT(); | ||
796 | |||
717 | if (!group) | 797 | if (!group) |
718 | return; | 798 | return; |
719 | 799 | ||
@@ -724,6 +804,8 @@ GNUNET_CHAT_group_set_user_pointer (struct GNUNET_CHAT_Group *group, | |||
724 | void* | 804 | void* |
725 | GNUNET_CHAT_group_get_user_pointer (const struct GNUNET_CHAT_Group *group) | 805 | GNUNET_CHAT_group_get_user_pointer (const struct GNUNET_CHAT_Group *group) |
726 | { | 806 | { |
807 | GNUNET_CHAT_VERSION_ASSERT(); | ||
808 | |||
727 | if (!group) | 809 | if (!group) |
728 | return NULL; | 810 | return NULL; |
729 | 811 | ||
@@ -735,6 +817,8 @@ void | |||
735 | GNUNET_CHAT_group_invite_contact (const struct GNUNET_CHAT_Group *group, | 817 | GNUNET_CHAT_group_invite_contact (const struct GNUNET_CHAT_Group *group, |
736 | struct GNUNET_CHAT_Contact *contact) | 818 | struct GNUNET_CHAT_Contact *contact) |
737 | { | 819 | { |
820 | GNUNET_CHAT_VERSION_ASSERT(); | ||
821 | |||
738 | if ((!group) || (!contact)) | 822 | if ((!group) || (!contact)) |
739 | return; | 823 | return; |
740 | 824 | ||
@@ -765,6 +849,8 @@ GNUNET_CHAT_group_iterate_contacts (const struct GNUNET_CHAT_Group *group, | |||
765 | GNUNET_CHAT_GroupContactCallback callback, | 849 | GNUNET_CHAT_GroupContactCallback callback, |
766 | void *cls) | 850 | void *cls) |
767 | { | 851 | { |
852 | GNUNET_CHAT_VERSION_ASSERT(); | ||
853 | |||
768 | if (!group) | 854 | if (!group) |
769 | return GNUNET_SYSERR; | 855 | return GNUNET_SYSERR; |
770 | 856 | ||
@@ -782,6 +868,8 @@ GNUNET_CHAT_group_iterate_contacts (const struct GNUNET_CHAT_Group *group, | |||
782 | struct GNUNET_CHAT_Context* | 868 | struct GNUNET_CHAT_Context* |
783 | GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group) | 869 | GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group) |
784 | { | 870 | { |
871 | GNUNET_CHAT_VERSION_ASSERT(); | ||
872 | |||
785 | if (!group) | 873 | if (!group) |
786 | return NULL; | 874 | return NULL; |
787 | 875 | ||
@@ -792,6 +880,8 @@ GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group) | |||
792 | int | 880 | int |
793 | GNUNET_CHAT_context_get_status (const struct GNUNET_CHAT_Context *context) | 881 | GNUNET_CHAT_context_get_status (const struct GNUNET_CHAT_Context *context) |
794 | { | 882 | { |
883 | GNUNET_CHAT_VERSION_ASSERT(); | ||
884 | |||
795 | if ((!context) || (!(context->room))) | 885 | if ((!context) || (!(context->room))) |
796 | return GNUNET_SYSERR; | 886 | return GNUNET_SYSERR; |
797 | 887 | ||
@@ -806,6 +896,8 @@ GNUNET_CHAT_context_get_status (const struct GNUNET_CHAT_Context *context) | |||
806 | void | 896 | void |
807 | GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context) | 897 | GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context) |
808 | { | 898 | { |
899 | GNUNET_CHAT_VERSION_ASSERT(); | ||
900 | |||
809 | if ((!context) || (context->room)) | 901 | if ((!context) || (context->room)) |
810 | return; | 902 | return; |
811 | 903 | ||
@@ -857,6 +949,8 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context) | |||
857 | struct GNUNET_CHAT_Contact* | 949 | struct GNUNET_CHAT_Contact* |
858 | GNUNET_CHAT_context_get_contact (struct GNUNET_CHAT_Context *context) | 950 | GNUNET_CHAT_context_get_contact (struct GNUNET_CHAT_Context *context) |
859 | { | 951 | { |
952 | GNUNET_CHAT_VERSION_ASSERT(); | ||
953 | |||
860 | if ((!context) || (GNUNET_CHAT_CONTEXT_TYPE_CONTACT != context->type)) | 954 | if ((!context) || (GNUNET_CHAT_CONTEXT_TYPE_CONTACT != context->type)) |
861 | return NULL; | 955 | return NULL; |
862 | 956 | ||
@@ -885,6 +979,8 @@ GNUNET_CHAT_context_get_contact (struct GNUNET_CHAT_Context *context) | |||
885 | struct GNUNET_CHAT_Group* | 979 | struct GNUNET_CHAT_Group* |
886 | GNUNET_CHAT_context_get_group (struct GNUNET_CHAT_Context *context) | 980 | GNUNET_CHAT_context_get_group (struct GNUNET_CHAT_Context *context) |
887 | { | 981 | { |
982 | GNUNET_CHAT_VERSION_ASSERT(); | ||
983 | |||
888 | if ((!context) || (GNUNET_CHAT_CONTEXT_TYPE_GROUP != context->type)) | 984 | if ((!context) || (GNUNET_CHAT_CONTEXT_TYPE_GROUP != context->type)) |
889 | return NULL; | 985 | return NULL; |
890 | 986 | ||
@@ -899,6 +995,8 @@ void | |||
899 | GNUNET_CHAT_context_set_user_pointer (struct GNUNET_CHAT_Context *context, | 995 | GNUNET_CHAT_context_set_user_pointer (struct GNUNET_CHAT_Context *context, |
900 | void *user_pointer) | 996 | void *user_pointer) |
901 | { | 997 | { |
998 | GNUNET_CHAT_VERSION_ASSERT(); | ||
999 | |||
902 | if (!context) | 1000 | if (!context) |
903 | return; | 1001 | return; |
904 | 1002 | ||
@@ -909,6 +1007,8 @@ GNUNET_CHAT_context_set_user_pointer (struct GNUNET_CHAT_Context *context, | |||
909 | void* | 1007 | void* |
910 | GNUNET_CHAT_context_get_user_pointer (const struct GNUNET_CHAT_Context *context) | 1008 | GNUNET_CHAT_context_get_user_pointer (const struct GNUNET_CHAT_Context *context) |
911 | { | 1009 | { |
1010 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1011 | |||
912 | if (!context) | 1012 | if (!context) |
913 | return NULL; | 1013 | return NULL; |
914 | 1014 | ||
@@ -920,6 +1020,8 @@ int | |||
920 | GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, | 1020 | GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, |
921 | const char *text) | 1021 | const char *text) |
922 | { | 1022 | { |
1023 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1024 | |||
923 | if ((!context) || (!text) || (!(context->room))) | 1025 | if ((!context) || (!text) || (!(context->room))) |
924 | return GNUNET_SYSERR; | 1026 | return GNUNET_SYSERR; |
925 | 1027 | ||
@@ -938,6 +1040,8 @@ int | |||
938 | GNUNET_CHAT_context_send_read_receipt (struct GNUNET_CHAT_Context *context, | 1040 | GNUNET_CHAT_context_send_read_receipt (struct GNUNET_CHAT_Context *context, |
939 | const struct GNUNET_CHAT_Message *message) | 1041 | const struct GNUNET_CHAT_Message *message) |
940 | { | 1042 | { |
1043 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1044 | |||
941 | if ((!context) || (!(context->room))) | 1045 | if ((!context) || (!(context->room))) |
942 | return GNUNET_SYSERR; | 1046 | return GNUNET_SYSERR; |
943 | 1047 | ||
@@ -985,6 +1089,8 @@ GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | |||
985 | GNUNET_CHAT_FileUploadCallback callback, | 1089 | GNUNET_CHAT_FileUploadCallback callback, |
986 | void *cls) | 1090 | void *cls) |
987 | { | 1091 | { |
1092 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1093 | |||
988 | if ((!context) || (!path) || (!(context->room))) | 1094 | if ((!context) || (!path) || (!(context->room))) |
989 | return NULL; | 1095 | return NULL; |
990 | 1096 | ||
@@ -1091,6 +1197,8 @@ int | |||
1091 | GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, | 1197 | GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, |
1092 | const struct GNUNET_CHAT_File *file) | 1198 | const struct GNUNET_CHAT_File *file) |
1093 | { | 1199 | { |
1200 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1201 | |||
1094 | if ((!context) || (!file) || (strlen(file->name) > NAME_MAX) || | 1202 | if ((!context) || (!file) || (strlen(file->name) > NAME_MAX) || |
1095 | (!(context->room))) | 1203 | (!(context->room))) |
1096 | return GNUNET_SYSERR; | 1204 | return GNUNET_SYSERR; |
@@ -1114,6 +1222,8 @@ GNUNET_CHAT_context_iterate_messages (struct GNUNET_CHAT_Context *context, | |||
1114 | GNUNET_CHAT_ContextMessageCallback callback, | 1222 | GNUNET_CHAT_ContextMessageCallback callback, |
1115 | void *cls) | 1223 | void *cls) |
1116 | { | 1224 | { |
1225 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1226 | |||
1117 | if (!context) | 1227 | if (!context) |
1118 | return GNUNET_SYSERR; | 1228 | return GNUNET_SYSERR; |
1119 | 1229 | ||
@@ -1133,6 +1243,8 @@ GNUNET_CHAT_context_iterate_files (struct GNUNET_CHAT_Context *context, | |||
1133 | GNUNET_CHAT_ContextFileCallback callback, | 1243 | GNUNET_CHAT_ContextFileCallback callback, |
1134 | void *cls) | 1244 | void *cls) |
1135 | { | 1245 | { |
1246 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1247 | |||
1136 | if (!context) | 1248 | if (!context) |
1137 | return GNUNET_SYSERR; | 1249 | return GNUNET_SYSERR; |
1138 | 1250 | ||
@@ -1152,6 +1264,8 @@ GNUNET_CHAT_member_set_user_pointer (struct GNUNET_CHAT_Context *context, | |||
1152 | const struct GNUNET_CHAT_Contact *member, | 1264 | const struct GNUNET_CHAT_Contact *member, |
1153 | void *user_pointer) | 1265 | void *user_pointer) |
1154 | { | 1266 | { |
1267 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1268 | |||
1155 | if ((!context) || (!member)) | 1269 | if ((!context) || (!member)) |
1156 | return; | 1270 | return; |
1157 | 1271 | ||
@@ -1171,6 +1285,8 @@ void* | |||
1171 | GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Context *context, | 1285 | GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Context *context, |
1172 | const struct GNUNET_CHAT_Contact *member) | 1286 | const struct GNUNET_CHAT_Contact *member) |
1173 | { | 1287 | { |
1288 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1289 | |||
1174 | if ((!context) || (!member)) | 1290 | if ((!context) || (!member)) |
1175 | return NULL; | 1291 | return NULL; |
1176 | 1292 | ||
@@ -1187,6 +1303,8 @@ GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Context *context, | |||
1187 | enum GNUNET_CHAT_MessageKind | 1303 | enum GNUNET_CHAT_MessageKind |
1188 | GNUNET_CHAT_message_get_kind (const struct GNUNET_CHAT_Message *message) | 1304 | GNUNET_CHAT_message_get_kind (const struct GNUNET_CHAT_Message *message) |
1189 | { | 1305 | { |
1306 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1307 | |||
1190 | if (!message) | 1308 | if (!message) |
1191 | return GNUNET_CHAT_KIND_UNKNOWN; | 1309 | return GNUNET_CHAT_KIND_UNKNOWN; |
1192 | 1310 | ||
@@ -1236,6 +1354,8 @@ GNUNET_CHAT_message_get_kind (const struct GNUNET_CHAT_Message *message) | |||
1236 | struct GNUNET_TIME_Absolute | 1354 | struct GNUNET_TIME_Absolute |
1237 | GNUNET_CHAT_message_get_timestamp (const struct GNUNET_CHAT_Message *message) | 1355 | GNUNET_CHAT_message_get_timestamp (const struct GNUNET_CHAT_Message *message) |
1238 | { | 1356 | { |
1357 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1358 | |||
1239 | if ((!message) || (!(message->msg))) | 1359 | if ((!message) || (!(message->msg))) |
1240 | return GNUNET_TIME_absolute_get_zero_(); | 1360 | return GNUNET_TIME_absolute_get_zero_(); |
1241 | 1361 | ||
@@ -1246,6 +1366,8 @@ GNUNET_CHAT_message_get_timestamp (const struct GNUNET_CHAT_Message *message) | |||
1246 | struct GNUNET_CHAT_Contact* | 1366 | struct GNUNET_CHAT_Contact* |
1247 | GNUNET_CHAT_message_get_sender (const struct GNUNET_CHAT_Message *message) | 1367 | GNUNET_CHAT_message_get_sender (const struct GNUNET_CHAT_Message *message) |
1248 | { | 1368 | { |
1369 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1370 | |||
1249 | if ((!message) || (GNUNET_CHAT_FLAG_NONE != message->flag) || | 1371 | if ((!message) || (GNUNET_CHAT_FLAG_NONE != message->flag) || |
1250 | (!(message->context)) || (!(message->context->room))) | 1372 | (!(message->context)) || (!(message->context->room))) |
1251 | return NULL; | 1373 | return NULL; |
@@ -1264,6 +1386,8 @@ GNUNET_CHAT_message_get_sender (const struct GNUNET_CHAT_Message *message) | |||
1264 | int | 1386 | int |
1265 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message) | 1387 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message) |
1266 | { | 1388 | { |
1389 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1390 | |||
1267 | if (!message) | 1391 | if (!message) |
1268 | return GNUNET_SYSERR; | 1392 | return GNUNET_SYSERR; |
1269 | 1393 | ||
@@ -1277,6 +1401,8 @@ GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message) | |||
1277 | int | 1401 | int |
1278 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message) | 1402 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message) |
1279 | { | 1403 | { |
1404 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1405 | |||
1280 | if (!message) | 1406 | if (!message) |
1281 | return GNUNET_SYSERR; | 1407 | return GNUNET_SYSERR; |
1282 | 1408 | ||
@@ -1292,6 +1418,8 @@ GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | |||
1292 | GNUNET_CHAT_MessageReadReceiptCallback callback, | 1418 | GNUNET_CHAT_MessageReadReceiptCallback callback, |
1293 | void *cls) | 1419 | void *cls) |
1294 | { | 1420 | { |
1421 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1422 | |||
1295 | if ((!message) || (!(message->msg)) || (!(message->context))) | 1423 | if ((!message) || (!(message->msg)) || (!(message->context))) |
1296 | return GNUNET_SYSERR; | 1424 | return GNUNET_SYSERR; |
1297 | 1425 | ||
@@ -1309,6 +1437,8 @@ GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | |||
1309 | const char* | 1437 | const char* |
1310 | GNUNET_CHAT_message_get_text (const struct GNUNET_CHAT_Message *message) | 1438 | GNUNET_CHAT_message_get_text (const struct GNUNET_CHAT_Message *message) |
1311 | { | 1439 | { |
1440 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1441 | |||
1312 | if ((!message) || (!(message->msg))) | 1442 | if ((!message) || (!(message->msg))) |
1313 | return NULL; | 1443 | return NULL; |
1314 | 1444 | ||
@@ -1326,6 +1456,8 @@ GNUNET_CHAT_message_get_text (const struct GNUNET_CHAT_Message *message) | |||
1326 | struct GNUNET_CHAT_File* | 1456 | struct GNUNET_CHAT_File* |
1327 | GNUNET_CHAT_message_get_file (const struct GNUNET_CHAT_Message *message) | 1457 | GNUNET_CHAT_message_get_file (const struct GNUNET_CHAT_Message *message) |
1328 | { | 1458 | { |
1459 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1460 | |||
1329 | if ((!message) || (!(message->msg)) || (!(message->context))) | 1461 | if ((!message) || (!(message->msg)) || (!(message->context))) |
1330 | return NULL; | 1462 | return NULL; |
1331 | 1463 | ||
@@ -1342,6 +1474,8 @@ GNUNET_CHAT_message_get_file (const struct GNUNET_CHAT_Message *message) | |||
1342 | struct GNUNET_CHAT_Invitation* | 1474 | struct GNUNET_CHAT_Invitation* |
1343 | GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message) | 1475 | GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message) |
1344 | { | 1476 | { |
1477 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1478 | |||
1345 | if ((!message) || (!(message->msg)) || (!(message->context))) | 1479 | if ((!message) || (!(message->msg)) || (!(message->context))) |
1346 | return NULL; | 1480 | return NULL; |
1347 | 1481 | ||
@@ -1358,6 +1492,8 @@ GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message) | |||
1358 | const struct GNUNET_CHAT_Message* | 1492 | const struct GNUNET_CHAT_Message* |
1359 | GNUNET_CHAT_message_get_target (const struct GNUNET_CHAT_Message *message) | 1493 | GNUNET_CHAT_message_get_target (const struct GNUNET_CHAT_Message *message) |
1360 | { | 1494 | { |
1495 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1496 | |||
1361 | if ((!message) || (!(message->msg)) || (!(message->context))) | 1497 | if ((!message) || (!(message->msg)) || (!(message->context))) |
1362 | return NULL; | 1498 | return NULL; |
1363 | 1499 | ||
@@ -1378,6 +1514,8 @@ int | |||
1378 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, | 1514 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, |
1379 | struct GNUNET_TIME_Relative delay) | 1515 | struct GNUNET_TIME_Relative delay) |
1380 | { | 1516 | { |
1517 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1518 | |||
1381 | if ((!message) || (!(message->msg)) || (!(message->context))) | 1519 | if ((!message) || (!(message->msg)) || (!(message->context))) |
1382 | return GNUNET_SYSERR; | 1520 | return GNUNET_SYSERR; |
1383 | 1521 | ||
@@ -1394,6 +1532,8 @@ GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, | |||
1394 | const char* | 1532 | const char* |
1395 | GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file) | 1533 | GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file) |
1396 | { | 1534 | { |
1535 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1536 | |||
1397 | if (!file) | 1537 | if (!file) |
1398 | return NULL; | 1538 | return NULL; |
1399 | 1539 | ||
@@ -1404,6 +1544,8 @@ GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file) | |||
1404 | const struct GNUNET_HashCode* | 1544 | const struct GNUNET_HashCode* |
1405 | GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) | 1545 | GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) |
1406 | { | 1546 | { |
1547 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1548 | |||
1407 | if (!file) | 1549 | if (!file) |
1408 | return NULL; | 1550 | return NULL; |
1409 | 1551 | ||
@@ -1414,6 +1556,8 @@ GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) | |||
1414 | uint64_t | 1556 | uint64_t |
1415 | GNUNET_CHAT_file_get_size (const struct GNUNET_CHAT_File *file) | 1557 | GNUNET_CHAT_file_get_size (const struct GNUNET_CHAT_File *file) |
1416 | { | 1558 | { |
1559 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1560 | |||
1417 | if ((!file) || (!(file->uri))) | 1561 | if ((!file) || (!(file->uri))) |
1418 | return 0; | 1562 | return 0; |
1419 | 1563 | ||
@@ -1424,6 +1568,8 @@ GNUNET_CHAT_file_get_size (const struct GNUNET_CHAT_File *file) | |||
1424 | uint64_t | 1568 | uint64_t |
1425 | GNUNET_CHAT_file_get_local_size (const struct GNUNET_CHAT_File *file) | 1569 | GNUNET_CHAT_file_get_local_size (const struct GNUNET_CHAT_File *file) |
1426 | { | 1570 | { |
1571 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1572 | |||
1427 | if (!file) | 1573 | if (!file) |
1428 | return 0; | 1574 | return 0; |
1429 | 1575 | ||
@@ -1449,6 +1595,8 @@ GNUNET_CHAT_file_get_local_size (const struct GNUNET_CHAT_File *file) | |||
1449 | int | 1595 | int |
1450 | GNUNET_CHAT_file_is_uploading (const struct GNUNET_CHAT_File *file) | 1596 | GNUNET_CHAT_file_is_uploading (const struct GNUNET_CHAT_File *file) |
1451 | { | 1597 | { |
1598 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1599 | |||
1452 | if ((!file) || (0 == (file->status & GNUNET_CHAT_FILE_STATUS_PUBLISH))) | 1600 | if ((!file) || (0 == (file->status & GNUNET_CHAT_FILE_STATUS_PUBLISH))) |
1453 | return GNUNET_NO; | 1601 | return GNUNET_NO; |
1454 | else | 1602 | else |
@@ -1459,6 +1607,8 @@ GNUNET_CHAT_file_is_uploading (const struct GNUNET_CHAT_File *file) | |||
1459 | const char* | 1607 | const char* |
1460 | GNUNET_CHAT_file_open_preview (struct GNUNET_CHAT_File *file) | 1608 | GNUNET_CHAT_file_open_preview (struct GNUNET_CHAT_File *file) |
1461 | { | 1609 | { |
1610 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1611 | |||
1462 | if (!file) | 1612 | if (!file) |
1463 | return NULL; | 1613 | return NULL; |
1464 | 1614 | ||
@@ -1503,6 +1653,8 @@ free_filename: | |||
1503 | void | 1653 | void |
1504 | GNUNET_CHAT_file_close_preview (struct GNUNET_CHAT_File *file) | 1654 | GNUNET_CHAT_file_close_preview (struct GNUNET_CHAT_File *file) |
1505 | { | 1655 | { |
1656 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1657 | |||
1506 | if ((!file) || (!(file->preview))) | 1658 | if ((!file) || (!(file->preview))) |
1507 | return; | 1659 | return; |
1508 | 1660 | ||
@@ -1517,6 +1669,8 @@ void | |||
1517 | GNUNET_CHAT_file_set_user_pointer (struct GNUNET_CHAT_File *file, | 1669 | GNUNET_CHAT_file_set_user_pointer (struct GNUNET_CHAT_File *file, |
1518 | void *user_pointer) | 1670 | void *user_pointer) |
1519 | { | 1671 | { |
1672 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1673 | |||
1520 | if (!file) | 1674 | if (!file) |
1521 | return; | 1675 | return; |
1522 | 1676 | ||
@@ -1527,6 +1681,8 @@ GNUNET_CHAT_file_set_user_pointer (struct GNUNET_CHAT_File *file, | |||
1527 | void* | 1681 | void* |
1528 | GNUNET_CHAT_file_get_user_pointer (const struct GNUNET_CHAT_File *file) | 1682 | GNUNET_CHAT_file_get_user_pointer (const struct GNUNET_CHAT_File *file) |
1529 | { | 1683 | { |
1684 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1685 | |||
1530 | if (!file) | 1686 | if (!file) |
1531 | return NULL; | 1687 | return NULL; |
1532 | 1688 | ||
@@ -1537,6 +1693,8 @@ GNUNET_CHAT_file_get_user_pointer (const struct GNUNET_CHAT_File *file) | |||
1537 | int | 1693 | int |
1538 | GNUNET_CHAT_file_is_downloading (const struct GNUNET_CHAT_File *file) | 1694 | GNUNET_CHAT_file_is_downloading (const struct GNUNET_CHAT_File *file) |
1539 | { | 1695 | { |
1696 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1697 | |||
1540 | if ((!file) || (0 == (file->status & GNUNET_CHAT_FILE_STATUS_DOWNLOAD))) | 1698 | if ((!file) || (0 == (file->status & GNUNET_CHAT_FILE_STATUS_DOWNLOAD))) |
1541 | return GNUNET_NO; | 1699 | return GNUNET_NO; |
1542 | else | 1700 | else |
@@ -1549,6 +1707,8 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
1549 | GNUNET_CHAT_FileDownloadCallback callback, | 1707 | GNUNET_CHAT_FileDownloadCallback callback, |
1550 | void *cls) | 1708 | void *cls) |
1551 | { | 1709 | { |
1710 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1711 | |||
1552 | if ((!file) || (!(file->uri))) | 1712 | if ((!file) || (!(file->uri))) |
1553 | return GNUNET_SYSERR; | 1713 | return GNUNET_SYSERR; |
1554 | 1714 | ||
@@ -1613,6 +1773,8 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
1613 | int | 1773 | int |
1614 | GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file) | 1774 | GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file) |
1615 | { | 1775 | { |
1776 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1777 | |||
1616 | if (!file) | 1778 | if (!file) |
1617 | return GNUNET_SYSERR; | 1779 | return GNUNET_SYSERR; |
1618 | 1780 | ||
@@ -1624,6 +1786,8 @@ GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file) | |||
1624 | int | 1786 | int |
1625 | GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file) | 1787 | GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file) |
1626 | { | 1788 | { |
1789 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1790 | |||
1627 | if (!file) | 1791 | if (!file) |
1628 | return GNUNET_SYSERR; | 1792 | return GNUNET_SYSERR; |
1629 | 1793 | ||
@@ -1635,6 +1799,8 @@ GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file) | |||
1635 | int | 1799 | int |
1636 | GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file) | 1800 | GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file) |
1637 | { | 1801 | { |
1802 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1803 | |||
1638 | if (!file) | 1804 | if (!file) |
1639 | return GNUNET_SYSERR; | 1805 | return GNUNET_SYSERR; |
1640 | 1806 | ||
@@ -1647,6 +1813,8 @@ GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file) | |||
1647 | int | 1813 | int |
1648 | GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file) | 1814 | GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file) |
1649 | { | 1815 | { |
1816 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1817 | |||
1650 | if ((!file) || (0 == (file->status & GNUNET_CHAT_FILE_STATUS_UNINDEX))) | 1818 | if ((!file) || (0 == (file->status & GNUNET_CHAT_FILE_STATUS_UNINDEX))) |
1651 | return GNUNET_NO; | 1819 | return GNUNET_NO; |
1652 | else | 1820 | else |
@@ -1659,6 +1827,8 @@ GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | |||
1659 | GNUNET_CHAT_FileUnindexCallback callback, | 1827 | GNUNET_CHAT_FileUnindexCallback callback, |
1660 | void *cls) | 1828 | void *cls) |
1661 | { | 1829 | { |
1830 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1831 | |||
1662 | if (!file) | 1832 | if (!file) |
1663 | return GNUNET_SYSERR; | 1833 | return GNUNET_SYSERR; |
1664 | 1834 | ||
@@ -1699,6 +1869,8 @@ GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | |||
1699 | void | 1869 | void |
1700 | GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) | 1870 | GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) |
1701 | { | 1871 | { |
1872 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1873 | |||
1702 | if (!invitation) | 1874 | if (!invitation) |
1703 | return; | 1875 | return; |
1704 | 1876 | ||