diff options
author | Jacki <jacki@thejackimonster.de> | 2024-01-03 01:06:56 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-01-03 01:06:56 +0100 |
commit | 828af2a9a5c39996b791bfb9af48cdd1bedf509f (patch) | |
tree | c3fe55757e8f0a034dc53a984cb752c4a06baf55 /include | |
parent | ad9931275357614ed810d6851c81d4782797e59b (diff) | |
download | libgnunetchat-828af2a9a5c39996b791bfb9af48cdd1bedf509f.tar.gz libgnunetchat-828af2a9a5c39996b791bfb9af48cdd1bedf509f.zip |
Implement client-side blocking of contacts
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/gnunet/gnunet_chat_lib.h | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h index b8c44bf..9275988 100644 --- a/include/gnunet/gnunet_chat_lib.h +++ b/include/gnunet/gnunet_chat_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021--2023 GNUnet e.V. | 3 | Copyright (C) 2021--2024 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -34,6 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | /**@{*/ | 35 | /**@{*/ |
36 | 36 | ||
37 | #include <gnunet/gnunet_common.h> | ||
37 | #include <gnunet/gnunet_util_lib.h> | 38 | #include <gnunet/gnunet_util_lib.h> |
38 | 39 | ||
39 | /** | 40 | /** |
@@ -354,7 +355,7 @@ GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle); | |||
354 | * @param[in] name Account name | 355 | * @param[in] name Account name |
355 | * @return #GNUNET_OK on success, #GNUNET_NO on failure and otherwise #GNUNET_SYSERR | 356 | * @return #GNUNET_OK on success, #GNUNET_NO on failure and otherwise #GNUNET_SYSERR |
356 | */ | 357 | */ |
357 | int | 358 | enum GNUNET_GenericReturnValue |
358 | GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, | 359 | GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, |
359 | const char* name); | 360 | const char* name); |
360 | 361 | ||
@@ -366,7 +367,7 @@ GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle, | |||
366 | * @param[in] name Account name | 367 | * @param[in] name Account name |
367 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | 368 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR |
368 | */ | 369 | */ |
369 | int | 370 | enum GNUNET_GenericReturnValue |
370 | GNUNET_CHAT_account_delete(struct GNUNET_CHAT_Handle *handle, | 371 | GNUNET_CHAT_account_delete(struct GNUNET_CHAT_Handle *handle, |
371 | const char* name); | 372 | const char* name); |
372 | 373 | ||
@@ -421,7 +422,7 @@ GNUNET_CHAT_get_connected (const struct GNUNET_CHAT_Handle *handle); | |||
421 | * @param[in,out] handle Chat handle | 422 | * @param[in,out] handle Chat handle |
422 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 423 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
423 | */ | 424 | */ |
424 | int | 425 | enum GNUNET_GenericReturnValue |
425 | GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle); | 426 | GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle); |
426 | 427 | ||
427 | /** | 428 | /** |
@@ -431,7 +432,7 @@ GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle); | |||
431 | * @param[in] name New name or NULL | 432 | * @param[in] name New name or NULL |
432 | * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL | 433 | * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL |
433 | */ | 434 | */ |
434 | int | 435 | enum GNUNET_GenericReturnValue |
435 | GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, | 436 | GNUNET_CHAT_set_name (struct GNUNET_CHAT_Handle *handle, |
436 | const char *name); | 437 | const char *name); |
437 | 438 | ||
@@ -620,7 +621,7 @@ GNUNET_CHAT_iterate_groups (struct GNUNET_CHAT_Handle *handle, | |||
620 | * @param[in,out] contact Cntact | 621 | * @param[in,out] contact Cntact |
621 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 622 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
622 | */ | 623 | */ |
623 | int | 624 | enum GNUNET_GenericReturnValue |
624 | GNUNET_CHAT_contact_delete (struct GNUNET_CHAT_Contact *contact); | 625 | GNUNET_CHAT_contact_delete (struct GNUNET_CHAT_Contact *contact); |
625 | 626 | ||
626 | /** | 627 | /** |
@@ -689,20 +690,41 @@ GNUNET_CHAT_contact_get_user_pointer (const struct GNUNET_CHAT_Contact *contact) | |||
689 | * it has sent messages with. | 690 | * it has sent messages with. |
690 | * | 691 | * |
691 | * @param[in] contact Contact | 692 | * @param[in] contact Contact |
692 | * @return GNUNET_YES if the contact is owned, otherwise GNUNET_NO | 693 | * @return #GNUNET_YES if the contact is owned, otherwise# GNUNET_NO |
693 | * and GNUNET_SYSERR on failure | 694 | * and #GNUNET_SYSERR on failure |
694 | */ | 695 | */ |
695 | int | 696 | enum GNUNET_GenericReturnValue |
696 | GNUNET_CHAT_contact_is_owned (const struct GNUNET_CHAT_Contact *contact); | 697 | GNUNET_CHAT_contact_is_owned (const struct GNUNET_CHAT_Contact *contact); |
697 | 698 | ||
698 | /** | 699 | /** |
700 | * Blocks or unblocks a given <i>contact</i> by the current account. | ||
701 | * | ||
702 | * @param[in,out] contact Contact | ||
703 | * @param[in] blocked #GNUNET_YES to block, #GNUNET_NO to unblock | ||
704 | */ | ||
705 | void | ||
706 | GNUNET_CHAT_contact_set_blocked (struct GNUNET_CHAT_Contact *contact, | ||
707 | enum GNUNET_GenericReturnValue blocked); | ||
708 | |||
709 | /** | ||
710 | * Returns if a given <i>contact</i> is blocked by the current account and | ||
711 | * whether messages of it should be filtered. | ||
712 | * | ||
713 | * @param[in] contact Contact | ||
714 | * @return #GNUNET_YES if the contact is blocked, #GNUNET_SYSERR on failure and | ||
715 | * #GNUNET_NO otherwise | ||
716 | */ | ||
717 | enum GNUNET_GenericReturnValue | ||
718 | GNUNET_CHAT_contact_is_blocked (const struct GNUNET_CHAT_Contact *contact); | ||
719 | |||
720 | /** | ||
699 | * Leaves a specific <i>group</i> chat and frees its memory if it is not shared | 721 | * Leaves a specific <i>group</i> chat and frees its memory if it is not shared |
700 | * with other groups or contacts. | 722 | * with other groups or contacts. |
701 | * | 723 | * |
702 | * @param[in,out] group Group | 724 | * @param[in,out] group Group |
703 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 725 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
704 | */ | 726 | */ |
705 | int | 727 | enum GNUNET_GenericReturnValue |
706 | GNUNET_CHAT_group_leave (struct GNUNET_CHAT_Group *group); | 728 | GNUNET_CHAT_group_leave (struct GNUNET_CHAT_Group *group); |
707 | 729 | ||
708 | /** | 730 | /** |
@@ -813,7 +835,7 @@ GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group); | |||
813 | * @return #GNUNET_OK if usable, #GNUNET_NO if the context has been requested, | 835 | * @return #GNUNET_OK if usable, #GNUNET_NO if the context has been requested, |
814 | * #GNUNET_SYSERR otherwise. | 836 | * #GNUNET_SYSERR otherwise. |
815 | */ | 837 | */ |
816 | int | 838 | enum GNUNET_GenericReturnValue |
817 | GNUNET_CHAT_context_get_status (const struct GNUNET_CHAT_Context *context); | 839 | GNUNET_CHAT_context_get_status (const struct GNUNET_CHAT_Context *context); |
818 | 840 | ||
819 | /** | 841 | /** |
@@ -873,7 +895,7 @@ GNUNET_CHAT_context_get_user_pointer (const struct GNUNET_CHAT_Context *context) | |||
873 | * @param[in] text Text | 895 | * @param[in] text Text |
874 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 896 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
875 | */ | 897 | */ |
876 | int | 898 | enum GNUNET_GenericReturnValue |
877 | GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, | 899 | GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, |
878 | const char *text); | 900 | const char *text); |
879 | 901 | ||
@@ -885,7 +907,7 @@ GNUNET_CHAT_context_send_text (struct GNUNET_CHAT_Context *context, | |||
885 | * @param[in] message Message (optional) | 907 | * @param[in] message Message (optional) |
886 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 908 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
887 | */ | 909 | */ |
888 | int | 910 | enum GNUNET_GenericReturnValue |
889 | GNUNET_CHAT_context_send_read_receipt (struct GNUNET_CHAT_Context *context, | 911 | GNUNET_CHAT_context_send_read_receipt (struct GNUNET_CHAT_Context *context, |
890 | const struct GNUNET_CHAT_Message *message); | 912 | const struct GNUNET_CHAT_Message *message); |
891 | 913 | ||
@@ -914,7 +936,7 @@ GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | |||
914 | * @param[in] file File handle | 936 | * @param[in] file File handle |
915 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 937 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
916 | */ | 938 | */ |
917 | int | 939 | enum GNUNET_GenericReturnValue |
918 | GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, | 940 | GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, |
919 | const struct GNUNET_CHAT_File *file); | 941 | const struct GNUNET_CHAT_File *file); |
920 | 942 | ||
@@ -981,7 +1003,7 @@ GNUNET_CHAT_message_get_sender (const struct GNUNET_CHAT_Message *message); | |||
981 | * @param[in] message Message | 1003 | * @param[in] message Message |
982 | * @return #GNUNET_YES if the message was sent, otherwise #GNUNET_NO | 1004 | * @return #GNUNET_YES if the message was sent, otherwise #GNUNET_NO |
983 | */ | 1005 | */ |
984 | int | 1006 | enum GNUNET_GenericReturnValue |
985 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message); | 1007 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message); |
986 | 1008 | ||
987 | /** | 1009 | /** |
@@ -992,7 +1014,7 @@ GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message); | |||
992 | * @return #GNUNET_YES if the message was privately received, | 1014 | * @return #GNUNET_YES if the message was privately received, |
993 | * otherwise #GNUNET_NO | 1015 | * otherwise #GNUNET_NO |
994 | */ | 1016 | */ |
995 | int | 1017 | enum GNUNET_GenericReturnValue |
996 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message); | 1018 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message); |
997 | 1019 | ||
998 | /** | 1020 | /** |
@@ -1059,7 +1081,7 @@ GNUNET_CHAT_message_get_target (const struct GNUNET_CHAT_Message *message); | |||
1059 | * @param[in] delay Relative delay | 1081 | * @param[in] delay Relative delay |
1060 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1082 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1061 | */ | 1083 | */ |
1062 | int | 1084 | enum GNUNET_GenericReturnValue |
1063 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, | 1085 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, |
1064 | struct GNUNET_TIME_Relative delay); | 1086 | struct GNUNET_TIME_Relative delay); |
1065 | 1087 | ||
@@ -1108,7 +1130,7 @@ GNUNET_CHAT_file_get_local_size (const struct GNUNET_CHAT_File *file); | |||
1108 | * @param[in] file File handle | 1130 | * @param[in] file File handle |
1109 | * @return #GNUNET_YES during active upload, #GNUNET_NO otherwise | 1131 | * @return #GNUNET_YES during active upload, #GNUNET_NO otherwise |
1110 | */ | 1132 | */ |
1111 | int | 1133 | enum GNUNET_GenericReturnValue |
1112 | GNUNET_CHAT_file_is_uploading (const struct GNUNET_CHAT_File *file); | 1134 | GNUNET_CHAT_file_is_uploading (const struct GNUNET_CHAT_File *file); |
1113 | 1135 | ||
1114 | /** | 1136 | /** |
@@ -1163,7 +1185,7 @@ GNUNET_CHAT_file_get_user_pointer (const struct GNUNET_CHAT_File *file); | |||
1163 | * @param[in] file File handle | 1185 | * @param[in] file File handle |
1164 | * @return #GNUNET_YES during active download, #GNUNET_NO otherwise | 1186 | * @return #GNUNET_YES during active download, #GNUNET_NO otherwise |
1165 | */ | 1187 | */ |
1166 | int | 1188 | enum GNUNET_GenericReturnValue |
1167 | GNUNET_CHAT_file_is_downloading (const struct GNUNET_CHAT_File *file); | 1189 | GNUNET_CHAT_file_is_downloading (const struct GNUNET_CHAT_File *file); |
1168 | 1190 | ||
1169 | /** | 1191 | /** |
@@ -1175,7 +1197,7 @@ GNUNET_CHAT_file_is_downloading (const struct GNUNET_CHAT_File *file); | |||
1175 | * @param[in,out] cls Closure for file downloading (optional) | 1197 | * @param[in,out] cls Closure for file downloading (optional) |
1176 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1198 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1177 | */ | 1199 | */ |
1178 | int | 1200 | enum GNUNET_GenericReturnValue |
1179 | GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | 1201 | GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, |
1180 | GNUNET_CHAT_FileDownloadCallback callback, | 1202 | GNUNET_CHAT_FileDownloadCallback callback, |
1181 | void *cls); | 1203 | void *cls); |
@@ -1186,7 +1208,7 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
1186 | * @param[in,out] file File handle | 1208 | * @param[in,out] file File handle |
1187 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1209 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1188 | */ | 1210 | */ |
1189 | int | 1211 | enum GNUNET_GenericReturnValue |
1190 | GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file); | 1212 | GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file); |
1191 | 1213 | ||
1192 | /** | 1214 | /** |
@@ -1195,7 +1217,7 @@ GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file); | |||
1195 | * @param[in,out] file File handle | 1217 | * @param[in,out] file File handle |
1196 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1218 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1197 | */ | 1219 | */ |
1198 | int | 1220 | enum GNUNET_GenericReturnValue |
1199 | GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file); | 1221 | GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file); |
1200 | 1222 | ||
1201 | /** | 1223 | /** |
@@ -1204,7 +1226,7 @@ GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file); | |||
1204 | * @param[in,out] file File handle | 1226 | * @param[in,out] file File handle |
1205 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1227 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1206 | */ | 1228 | */ |
1207 | int | 1229 | enum GNUNET_GenericReturnValue |
1208 | GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file); | 1230 | GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file); |
1209 | 1231 | ||
1210 | /** | 1232 | /** |
@@ -1213,7 +1235,7 @@ GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file); | |||
1213 | * @param[in] file File handle | 1235 | * @param[in] file File handle |
1214 | * @return #GNUNET_YES during active unindexing, #GNUNET_NO otherwise | 1236 | * @return #GNUNET_YES during active unindexing, #GNUNET_NO otherwise |
1215 | */ | 1237 | */ |
1216 | int | 1238 | enum GNUNET_GenericReturnValue |
1217 | GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file); | 1239 | GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file); |
1218 | 1240 | ||
1219 | /** | 1241 | /** |
@@ -1225,7 +1247,7 @@ GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file); | |||
1225 | * @param[in,out] cls Closure for file unindexing (optional) | 1247 | * @param[in,out] cls Closure for file unindexing (optional) |
1226 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1248 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1227 | */ | 1249 | */ |
1228 | int | 1250 | enum GNUNET_GenericReturnValue |
1229 | GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | 1251 | GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, |
1230 | GNUNET_CHAT_FileUnindexCallback callback, | 1252 | GNUNET_CHAT_FileUnindexCallback callback, |
1231 | void *cls); | 1253 | void *cls); |