diff options
author | Jacki <jacki@thejackimonster.de> | 2024-01-04 18:14:46 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-01-04 18:14:46 +0100 |
commit | 2ee30f372acad534246beaf579b7bbfefab0b246 (patch) | |
tree | f17d4ac1675ab0465fd772d59157fc7d10127c94 | |
parent | fa50b6878fa0c8aef70bc2d879e2e0dffdc65f88 (diff) | |
download | libgnunetchat-2ee30f372acad534246beaf579b7bbfefab0b246.tar.gz libgnunetchat-2ee30f372acad534246beaf579b7bbfefab0b246.zip |
Format more code
Signed-off-by: Jacki <jacki@thejackimonster.de>
28 files changed, 654 insertions, 622 deletions
diff --git a/src/gnunet_chat_account.c b/src/gnunet_chat_account.c index 7076aec..161cc7e 100644 --- a/src/gnunet_chat_account.c +++ b/src/gnunet_chat_account.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022--2023 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | struct GNUNET_CHAT_Account* | 28 | struct GNUNET_CHAT_Account* |
29 | account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego, | 29 | account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego, |
30 | const char *name) | 30 | const char *name) |
31 | { | 31 | { |
32 | GNUNET_assert((ego) && (name)); | 32 | GNUNET_assert((ego) && (name)); |
33 | 33 | ||
@@ -46,7 +46,7 @@ account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego, | |||
46 | 46 | ||
47 | void | 47 | void |
48 | account_update_directory (struct GNUNET_CHAT_Account *account, | 48 | account_update_directory (struct GNUNET_CHAT_Account *account, |
49 | const char *base_directory) | 49 | const char *base_directory) |
50 | { | 50 | { |
51 | GNUNET_assert((account) && (base_directory)); | 51 | GNUNET_assert((account) && (base_directory)); |
52 | 52 | ||
diff --git a/src/gnunet_chat_account.h b/src/gnunet_chat_account.h index 25d7598..fb595b8 100644 --- a/src/gnunet_chat_account.h +++ b/src/gnunet_chat_account.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -47,7 +47,7 @@ struct GNUNET_CHAT_Account | |||
47 | */ | 47 | */ |
48 | struct GNUNET_CHAT_Account* | 48 | struct GNUNET_CHAT_Account* |
49 | account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego, | 49 | account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego, |
50 | const char *name); | 50 | const char *name); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Updates the stored directory path by a chat <i>account</i> | 53 | * Updates the stored directory path by a chat <i>account</i> |
@@ -58,7 +58,7 @@ account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego, | |||
58 | */ | 58 | */ |
59 | void | 59 | void |
60 | account_update_directory (struct GNUNET_CHAT_Account *account, | 60 | account_update_directory (struct GNUNET_CHAT_Account *account, |
61 | const char *base_directory); | 61 | const char *base_directory); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Destroys a chat <i>account</i> and frees its memory. | 64 | * Destroys a chat <i>account</i> and frees its memory. |
diff --git a/src/gnunet_chat_contact.c b/src/gnunet_chat_contact.c index f639fcf..c4c813f 100644 --- a/src/gnunet_chat_contact.c +++ b/src/gnunet_chat_contact.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | struct GNUNET_CHAT_Contact* | 31 | struct GNUNET_CHAT_Contact* |
32 | contact_create_from_member (struct GNUNET_CHAT_Handle *handle, | 32 | contact_create_from_member (struct GNUNET_CHAT_Handle *handle, |
33 | const struct GNUNET_MESSENGER_Contact *member) | 33 | const struct GNUNET_MESSENGER_Contact *member) |
34 | { | 34 | { |
35 | GNUNET_assert((handle) && (member)); | 35 | GNUNET_assert((handle) && (member)); |
36 | 36 | ||
@@ -84,18 +84,18 @@ contact_find_context (const struct GNUNET_CHAT_Contact *contact) | |||
84 | find.room = NULL; | 84 | find.room = NULL; |
85 | 85 | ||
86 | GNUNET_MESSENGER_find_rooms( | 86 | GNUNET_MESSENGER_find_rooms( |
87 | contact->handle->messenger, | 87 | contact->handle->messenger, |
88 | contact->member, | 88 | contact->member, |
89 | it_contact_find_room, | 89 | it_contact_find_room, |
90 | &find | 90 | &find |
91 | ); | 91 | ); |
92 | 92 | ||
93 | if (!(find.room)) | 93 | if (!(find.room)) |
94 | return NULL; | 94 | return NULL; |
95 | 95 | ||
96 | return GNUNET_CONTAINER_multihashmap_get( | 96 | return GNUNET_CONTAINER_multihashmap_get( |
97 | contact->handle->contexts, | 97 | contact->handle->contexts, |
98 | GNUNET_MESSENGER_room_get_key(find.room) | 98 | GNUNET_MESSENGER_room_get_key(find.room) |
99 | ); | 99 | ); |
100 | } | 100 | } |
101 | 101 | ||
diff --git a/src/gnunet_chat_contact.h b/src/gnunet_chat_contact.h index ed5dc4d..efd7997 100644 --- a/src/gnunet_chat_contact.h +++ b/src/gnunet_chat_contact.h | |||
@@ -56,7 +56,7 @@ struct GNUNET_CHAT_Contact | |||
56 | */ | 56 | */ |
57 | struct GNUNET_CHAT_Contact* | 57 | struct GNUNET_CHAT_Contact* |
58 | contact_create_from_member (struct GNUNET_CHAT_Handle *handle, | 58 | contact_create_from_member (struct GNUNET_CHAT_Handle *handle, |
59 | const struct GNUNET_MESSENGER_Contact *member); | 59 | const struct GNUNET_MESSENGER_Contact *member); |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Updates the string representation of the public key from | 62 | * Updates the string representation of the public key from |
diff --git a/src/gnunet_chat_contact_intern.c b/src/gnunet_chat_contact_intern.c index 4ecdf51..87e1530 100644 --- a/src/gnunet_chat_contact_intern.c +++ b/src/gnunet_chat_contact_intern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021 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,8 +34,8 @@ struct GNUNET_CHAT_ContactFindRoom | |||
34 | 34 | ||
35 | int | 35 | int |
36 | it_contact_find_room (void *cls, | 36 | it_contact_find_room (void *cls, |
37 | struct GNUNET_MESSENGER_Room *room, | 37 | struct GNUNET_MESSENGER_Room *room, |
38 | GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member) | 38 | GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member) |
39 | { | 39 | { |
40 | GNUNET_assert((cls) && (room)); | 40 | GNUNET_assert((cls) && (room)); |
41 | 41 | ||
diff --git a/src/gnunet_chat_context.c b/src/gnunet_chat_context.c index c016fa3..ea188e7 100644 --- a/src/gnunet_chat_context.c +++ b/src/gnunet_chat_context.c | |||
@@ -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 |
@@ -23,7 +23,6 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "gnunet_chat_context.h" | 25 | #include "gnunet_chat_context.h" |
26 | #include "gnunet_chat_group.h" | ||
27 | #include "gnunet_chat_handle.h" | 26 | #include "gnunet_chat_handle.h" |
28 | #include "gnunet_chat_util.h" | 27 | #include "gnunet_chat_util.h" |
29 | 28 | ||
@@ -35,7 +34,7 @@ static const unsigned int initial_map_size_of_contact = 4; | |||
35 | 34 | ||
36 | struct GNUNET_CHAT_Context* | 35 | struct GNUNET_CHAT_Context* |
37 | context_create_from_room (struct GNUNET_CHAT_Handle *handle, | 36 | context_create_from_room (struct GNUNET_CHAT_Handle *handle, |
38 | struct GNUNET_MESSENGER_Room *room) | 37 | struct GNUNET_MESSENGER_Room *room) |
39 | { | 38 | { |
40 | GNUNET_assert((handle) && (room)); | 39 | GNUNET_assert((handle) && (room)); |
41 | 40 | ||
@@ -49,13 +48,13 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle, | |||
49 | context->deleted = GNUNET_NO; | 48 | context->deleted = GNUNET_NO; |
50 | 49 | ||
51 | context->timestamps = GNUNET_CONTAINER_multishortmap_create( | 50 | context->timestamps = GNUNET_CONTAINER_multishortmap_create( |
52 | initial_map_size_of_room, GNUNET_NO); | 51 | initial_map_size_of_room, GNUNET_NO); |
53 | context->messages = GNUNET_CONTAINER_multihashmap_create( | 52 | context->messages = GNUNET_CONTAINER_multihashmap_create( |
54 | initial_map_size_of_room, GNUNET_NO); | 53 | initial_map_size_of_room, GNUNET_NO); |
55 | context->invites = GNUNET_CONTAINER_multihashmap_create( | 54 | context->invites = GNUNET_CONTAINER_multihashmap_create( |
56 | initial_map_size_of_room, GNUNET_NO); | 55 | initial_map_size_of_room, GNUNET_NO); |
57 | context->files = GNUNET_CONTAINER_multihashmap_create( | 56 | context->files = GNUNET_CONTAINER_multihashmap_create( |
58 | initial_map_size_of_room, GNUNET_NO); | 57 | initial_map_size_of_room, GNUNET_NO); |
59 | 58 | ||
60 | context->room = room; | 59 | context->room = room; |
61 | context->contact = NULL; | 60 | context->contact = NULL; |
@@ -63,7 +62,7 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle, | |||
63 | context->user_pointer = NULL; | 62 | context->user_pointer = NULL; |
64 | 63 | ||
65 | context->member_pointers = GNUNET_CONTAINER_multishortmap_create( | 64 | context->member_pointers = GNUNET_CONTAINER_multishortmap_create( |
66 | initial_map_size_of_room, GNUNET_NO); | 65 | initial_map_size_of_room, GNUNET_NO); |
67 | 66 | ||
68 | context->query = NULL; | 67 | context->query = NULL; |
69 | 68 | ||
@@ -72,7 +71,7 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle, | |||
72 | 71 | ||
73 | struct GNUNET_CHAT_Context* | 72 | struct GNUNET_CHAT_Context* |
74 | context_create_from_contact (struct GNUNET_CHAT_Handle *handle, | 73 | context_create_from_contact (struct GNUNET_CHAT_Handle *handle, |
75 | const struct GNUNET_MESSENGER_Contact *contact) | 74 | const struct GNUNET_MESSENGER_Contact *contact) |
76 | { | 75 | { |
77 | GNUNET_assert((handle) && (contact)); | 76 | GNUNET_assert((handle) && (contact)); |
78 | 77 | ||
@@ -86,13 +85,13 @@ context_create_from_contact (struct GNUNET_CHAT_Handle *handle, | |||
86 | context->deleted = GNUNET_NO; | 85 | context->deleted = GNUNET_NO; |
87 | 86 | ||
88 | context->timestamps = GNUNET_CONTAINER_multishortmap_create( | 87 | context->timestamps = GNUNET_CONTAINER_multishortmap_create( |
89 | initial_map_size_of_contact, GNUNET_NO); | 88 | initial_map_size_of_contact, GNUNET_NO); |
90 | context->messages = GNUNET_CONTAINER_multihashmap_create( | 89 | context->messages = GNUNET_CONTAINER_multihashmap_create( |
91 | initial_map_size_of_contact, GNUNET_NO); | 90 | initial_map_size_of_contact, GNUNET_NO); |
92 | context->invites = GNUNET_CONTAINER_multihashmap_create( | 91 | context->invites = GNUNET_CONTAINER_multihashmap_create( |
93 | initial_map_size_of_contact, GNUNET_NO); | 92 | initial_map_size_of_contact, GNUNET_NO); |
94 | context->files = GNUNET_CONTAINER_multihashmap_create( | 93 | context->files = GNUNET_CONTAINER_multihashmap_create( |
95 | initial_map_size_of_contact, GNUNET_NO); | 94 | initial_map_size_of_contact, GNUNET_NO); |
96 | 95 | ||
97 | context->room = NULL; | 96 | context->room = NULL; |
98 | context->contact = contact; | 97 | context->contact = contact; |
@@ -100,7 +99,7 @@ context_create_from_contact (struct GNUNET_CHAT_Handle *handle, | |||
100 | context->user_pointer = NULL; | 99 | context->user_pointer = NULL; |
101 | 100 | ||
102 | context->member_pointers = GNUNET_CONTAINER_multishortmap_create( | 101 | context->member_pointers = GNUNET_CONTAINER_multishortmap_create( |
103 | initial_map_size_of_contact, GNUNET_NO); | 102 | initial_map_size_of_contact, GNUNET_NO); |
104 | 103 | ||
105 | context->query = NULL; | 104 | context->query = NULL; |
106 | 105 | ||
@@ -110,25 +109,27 @@ context_create_from_contact (struct GNUNET_CHAT_Handle *handle, | |||
110 | void | 109 | void |
111 | context_destroy (struct GNUNET_CHAT_Context *context) | 110 | context_destroy (struct GNUNET_CHAT_Context *context) |
112 | { | 111 | { |
113 | GNUNET_assert((context) && | 112 | GNUNET_assert( |
113 | (context) && | ||
114 | (context->timestamps) && | 114 | (context->timestamps) && |
115 | (context->messages) && | 115 | (context->messages) && |
116 | (context->invites) && | 116 | (context->invites) && |
117 | (context->files)); | 117 | (context->files) |
118 | ); | ||
118 | 119 | ||
119 | if (context->query) | 120 | if (context->query) |
120 | GNUNET_NAMESTORE_cancel(context->query); | 121 | GNUNET_NAMESTORE_cancel(context->query); |
121 | 122 | ||
122 | GNUNET_CONTAINER_multishortmap_iterate( | 123 | GNUNET_CONTAINER_multishortmap_iterate( |
123 | context->timestamps, it_destroy_context_timestamps, NULL | 124 | context->timestamps, it_destroy_context_timestamps, NULL |
124 | ); | 125 | ); |
125 | 126 | ||
126 | GNUNET_CONTAINER_multihashmap_iterate( | 127 | GNUNET_CONTAINER_multihashmap_iterate( |
127 | context->messages, it_destroy_context_messages, NULL | 128 | context->messages, it_destroy_context_messages, NULL |
128 | ); | 129 | ); |
129 | 130 | ||
130 | GNUNET_CONTAINER_multihashmap_iterate( | 131 | GNUNET_CONTAINER_multihashmap_iterate( |
131 | context->invites, it_destroy_context_invites, NULL | 132 | context->invites, it_destroy_context_invites, NULL |
132 | ); | 133 | ); |
133 | 134 | ||
134 | GNUNET_CONTAINER_multishortmap_destroy(context->member_pointers); | 135 | GNUNET_CONTAINER_multishortmap_destroy(context->member_pointers); |
@@ -146,7 +147,7 @@ context_destroy (struct GNUNET_CHAT_Context *context) | |||
146 | 147 | ||
147 | void | 148 | void |
148 | context_update_room (struct GNUNET_CHAT_Context *context, | 149 | context_update_room (struct GNUNET_CHAT_Context *context, |
149 | struct GNUNET_MESSENGER_Room *room) | 150 | struct GNUNET_MESSENGER_Room *room) |
150 | { | 151 | { |
151 | GNUNET_assert(context); | 152 | GNUNET_assert(context); |
152 | 153 | ||
@@ -154,20 +155,20 @@ context_update_room (struct GNUNET_CHAT_Context *context, | |||
154 | return; | 155 | return; |
155 | 156 | ||
156 | GNUNET_CONTAINER_multishortmap_iterate( | 157 | GNUNET_CONTAINER_multishortmap_iterate( |
157 | context->timestamps, it_destroy_context_timestamps, NULL | 158 | context->timestamps, it_destroy_context_timestamps, NULL |
158 | ); | 159 | ); |
159 | 160 | ||
160 | GNUNET_CONTAINER_multihashmap_iterate( | 161 | GNUNET_CONTAINER_multihashmap_iterate( |
161 | context->messages, it_destroy_context_messages, NULL | 162 | context->messages, it_destroy_context_messages, NULL |
162 | ); | 163 | ); |
163 | 164 | ||
164 | GNUNET_CONTAINER_multihashmap_iterate( | 165 | GNUNET_CONTAINER_multihashmap_iterate( |
165 | context->invites, it_destroy_context_invites, NULL | 166 | context->invites, it_destroy_context_invites, NULL |
166 | ); | 167 | ); |
167 | 168 | ||
168 | GNUNET_CONTAINER_multishortmap_destroy(context->timestamps); | 169 | GNUNET_CONTAINER_multishortmap_destroy(context->timestamps); |
169 | context->timestamps = GNUNET_CONTAINER_multishortmap_create( | 170 | context->timestamps = GNUNET_CONTAINER_multishortmap_create( |
170 | initial_map_size_of_room, GNUNET_NO); | 171 | initial_map_size_of_room, GNUNET_NO); |
171 | 172 | ||
172 | GNUNET_CONTAINER_multihashmap_clear(context->messages); | 173 | GNUNET_CONTAINER_multihashmap_clear(context->messages); |
173 | GNUNET_CONTAINER_multihashmap_clear(context->invites); | 174 | GNUNET_CONTAINER_multihashmap_clear(context->invites); |
@@ -183,7 +184,7 @@ context_update_room (struct GNUNET_CHAT_Context *context, | |||
183 | 184 | ||
184 | void | 185 | void |
185 | context_update_nick (struct GNUNET_CHAT_Context *context, | 186 | context_update_nick (struct GNUNET_CHAT_Context *context, |
186 | const char *nick) | 187 | const char *nick) |
187 | { | 188 | { |
188 | GNUNET_assert(context); | 189 | GNUNET_assert(context); |
189 | 190 | ||
@@ -198,21 +199,20 @@ context_update_nick (struct GNUNET_CHAT_Context *context, | |||
198 | return; | 199 | return; |
199 | 200 | ||
200 | handle_send_internal_message( | 201 | handle_send_internal_message( |
201 | context->handle, | 202 | context->handle, |
202 | context, | 203 | context, |
203 | GNUNET_CHAT_FLAG_UPDATE, | 204 | GNUNET_CHAT_FLAG_UPDATE, |
204 | NULL | 205 | NULL |
205 | ); | 206 | ); |
206 | } | 207 | } |
207 | 208 | ||
208 | void | 209 | void |
209 | context_read_records (struct GNUNET_CHAT_Context *context, | 210 | context_read_records (struct GNUNET_CHAT_Context *context, |
210 | const char *label, | 211 | const char *label, |
211 | unsigned int count, | 212 | unsigned int count, |
212 | const struct GNUNET_GNSRECORD_Data *data) | 213 | const struct GNUNET_GNSRECORD_Data *data) |
213 | { | 214 | { |
214 | GNUNET_assert((context) && | 215 | GNUNET_assert((context) && (context->room)); |
215 | (context->room)); | ||
216 | 216 | ||
217 | char *nick = NULL; | 217 | char *nick = NULL; |
218 | char *topic = NULL; | 218 | char *topic = NULL; |
@@ -226,7 +226,7 @@ context_read_records (struct GNUNET_CHAT_Context *context, | |||
226 | if (GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_DETAILS == data[i].record_type) | 226 | if (GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_DETAILS == data[i].record_type) |
227 | { | 227 | { |
228 | if (nick) | 228 | if (nick) |
229 | continue; | 229 | continue; |
230 | 230 | ||
231 | const struct GNUNET_MESSENGER_RoomDetailsRecord *record = data[i].data; | 231 | const struct GNUNET_MESSENGER_RoomDetailsRecord *record = data[i].data; |
232 | 232 | ||
@@ -237,7 +237,7 @@ context_read_records (struct GNUNET_CHAT_Context *context, | |||
237 | if (GNUNET_DNSPARSER_TYPE_TXT == data[i].record_type) | 237 | if (GNUNET_DNSPARSER_TYPE_TXT == data[i].record_type) |
238 | { | 238 | { |
239 | if (topic) | 239 | if (topic) |
240 | continue; | 240 | continue; |
241 | 241 | ||
242 | topic = GNUNET_strndup(data[i].data, data[i].data_size); | 242 | topic = GNUNET_strndup(data[i].data, data[i].data_size); |
243 | } | 243 | } |
@@ -249,7 +249,7 @@ context_read_records (struct GNUNET_CHAT_Context *context, | |||
249 | GNUNET_free(nick); | 249 | GNUNET_free(nick); |
250 | 250 | ||
251 | const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key( | 251 | const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key( |
252 | context->room | 252 | context->room |
253 | ); | 253 | ); |
254 | 254 | ||
255 | if (topic) | 255 | if (topic) |
@@ -275,19 +275,17 @@ context_read_records (struct GNUNET_CHAT_Context *context, | |||
275 | void | 275 | void |
276 | context_write_records (struct GNUNET_CHAT_Context *context) | 276 | context_write_records (struct GNUNET_CHAT_Context *context) |
277 | { | 277 | { |
278 | GNUNET_assert((context) && | 278 | GNUNET_assert((context) && (context->handle) && (context->room)); |
279 | (context->handle) && | ||
280 | (context->room)); | ||
281 | 279 | ||
282 | const struct GNUNET_CRYPTO_PrivateKey *zone = handle_get_key( | 280 | const struct GNUNET_CRYPTO_PrivateKey *zone = handle_get_key( |
283 | context->handle | 281 | context->handle |
284 | ); | 282 | ); |
285 | 283 | ||
286 | if (!zone) | 284 | if (!zone) |
287 | return; | 285 | return; |
288 | 286 | ||
289 | const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key( | 287 | const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key( |
290 | context->room | 288 | context->room |
291 | ); | 289 | ); |
292 | 290 | ||
293 | struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get_forever_(); | 291 | struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get_forever_(); |
@@ -296,9 +294,9 @@ context_write_records (struct GNUNET_CHAT_Context *context) | |||
296 | GNUNET_CRYPTO_get_peer_identity(context->handle->cfg, &(room_entry.door)); | 294 | GNUNET_CRYPTO_get_peer_identity(context->handle->cfg, &(room_entry.door)); |
297 | 295 | ||
298 | GNUNET_memcpy( | 296 | GNUNET_memcpy( |
299 | &(room_entry.key), | 297 | &(room_entry.key), |
300 | hash, | 298 | hash, |
301 | sizeof(room_entry.key) | 299 | sizeof(room_entry.key) |
302 | ); | 300 | ); |
303 | 301 | ||
304 | struct GNUNET_MESSENGER_RoomDetailsRecord room_details; | 302 | struct GNUNET_MESSENGER_RoomDetailsRecord room_details; |
@@ -339,8 +337,8 @@ context_write_records (struct GNUNET_CHAT_Context *context) | |||
339 | data[count].data_size = sizeof(room_details); | 337 | data[count].data_size = sizeof(room_details); |
340 | data[count].expiration_time = expiration.abs_value_us; | 338 | data[count].expiration_time = expiration.abs_value_us; |
341 | data[count].flags = ( | 339 | data[count].flags = ( |
342 | GNUNET_GNSRECORD_RF_PRIVATE | | 340 | GNUNET_GNSRECORD_RF_PRIVATE | |
343 | GNUNET_GNSRECORD_RF_SUPPLEMENTAL | 341 | GNUNET_GNSRECORD_RF_SUPPLEMENTAL |
344 | ); | 342 | ); |
345 | 343 | ||
346 | count++; | 344 | count++; |
@@ -353,8 +351,8 @@ context_write_records (struct GNUNET_CHAT_Context *context) | |||
353 | data[count].data_size = strlen(topic); | 351 | data[count].data_size = strlen(topic); |
354 | data[count].expiration_time = expiration.abs_value_us; | 352 | data[count].expiration_time = expiration.abs_value_us; |
355 | data[count].flags = ( | 353 | data[count].flags = ( |
356 | GNUNET_GNSRECORD_RF_PRIVATE | | 354 | GNUNET_GNSRECORD_RF_PRIVATE | |
357 | GNUNET_GNSRECORD_RF_SUPPLEMENTAL | 355 | GNUNET_GNSRECORD_RF_SUPPLEMENTAL |
358 | ); | 356 | ); |
359 | 357 | ||
360 | count++; | 358 | count++; |
@@ -365,13 +363,13 @@ skip_record_data: | |||
365 | GNUNET_NAMESTORE_cancel(context->query); | 363 | GNUNET_NAMESTORE_cancel(context->query); |
366 | 364 | ||
367 | context->query = GNUNET_NAMESTORE_record_set_store( | 365 | context->query = GNUNET_NAMESTORE_record_set_store( |
368 | context->handle->namestore, | 366 | context->handle->namestore, |
369 | zone, | 367 | zone, |
370 | label, | 368 | label, |
371 | count, | 369 | count, |
372 | data, | 370 | data, |
373 | cont_context_write_records, | 371 | cont_context_write_records, |
374 | context | 372 | context |
375 | ); | 373 | ); |
376 | 374 | ||
377 | GNUNET_free(label); | 375 | GNUNET_free(label); |
diff --git a/src/gnunet_chat_context.h b/src/gnunet_chat_context.h index 6d192dd..f0532d2 100644 --- a/src/gnunet_chat_context.h +++ b/src/gnunet_chat_context.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--2022 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 |
@@ -67,7 +67,7 @@ struct GNUNET_CHAT_Context | |||
67 | */ | 67 | */ |
68 | struct GNUNET_CHAT_Context* | 68 | struct GNUNET_CHAT_Context* |
69 | context_create_from_room (struct GNUNET_CHAT_Handle *handle, | 69 | context_create_from_room (struct GNUNET_CHAT_Handle *handle, |
70 | struct GNUNET_MESSENGER_Room *room); | 70 | struct GNUNET_MESSENGER_Room *room); |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Creates a chat context from a messenger <i>contact</i> | 73 | * Creates a chat context from a messenger <i>contact</i> |
@@ -79,7 +79,7 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle, | |||
79 | */ | 79 | */ |
80 | struct GNUNET_CHAT_Context* | 80 | struct GNUNET_CHAT_Context* |
81 | context_create_from_contact (struct GNUNET_CHAT_Handle *handle, | 81 | context_create_from_contact (struct GNUNET_CHAT_Handle *handle, |
82 | const struct GNUNET_MESSENGER_Contact *contact); | 82 | const struct GNUNET_MESSENGER_Contact *contact); |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Destroys a chat <i>context</i> and frees its memory. | 85 | * Destroys a chat <i>context</i> and frees its memory. |
@@ -98,7 +98,7 @@ context_destroy (struct GNUNET_CHAT_Context* context); | |||
98 | */ | 98 | */ |
99 | void | 99 | void |
100 | context_update_room (struct GNUNET_CHAT_Context *context, | 100 | context_update_room (struct GNUNET_CHAT_Context *context, |
101 | struct GNUNET_MESSENGER_Room *room); | 101 | struct GNUNET_MESSENGER_Room *room); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Updates the <i>nick</i> of a selected chat <i>context</i>. | 104 | * Updates the <i>nick</i> of a selected chat <i>context</i>. |
@@ -108,7 +108,7 @@ context_update_room (struct GNUNET_CHAT_Context *context, | |||
108 | */ | 108 | */ |
109 | void | 109 | void |
110 | context_update_nick (struct GNUNET_CHAT_Context *context, | 110 | context_update_nick (struct GNUNET_CHAT_Context *context, |
111 | const char *nick); | 111 | const char *nick); |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Reads the <i>data</i> of records under a given <i>label</i> | 114 | * Reads the <i>data</i> of records under a given <i>label</i> |
@@ -121,9 +121,9 @@ context_update_nick (struct GNUNET_CHAT_Context *context, | |||
121 | */ | 121 | */ |
122 | void | 122 | void |
123 | context_read_records (struct GNUNET_CHAT_Context *context, | 123 | context_read_records (struct GNUNET_CHAT_Context *context, |
124 | const char *label, | 124 | const char *label, |
125 | unsigned int count, | 125 | unsigned int count, |
126 | const struct GNUNET_GNSRECORD_Data *data); | 126 | const struct GNUNET_GNSRECORD_Data *data); |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Writes the data from a selected chat <i>context</i> into | 129 | * Writes the data from a selected chat <i>context</i> into |
diff --git a/src/gnunet_chat_context_intern.c b/src/gnunet_chat_context_intern.c index ca90e06..f50da29 100644 --- a/src/gnunet_chat_context_intern.c +++ b/src/gnunet_chat_context_intern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021 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 |
@@ -31,8 +31,8 @@ | |||
31 | 31 | ||
32 | int | 32 | int |
33 | it_destroy_context_timestamps (GNUNET_UNUSED void *cls, | 33 | it_destroy_context_timestamps (GNUNET_UNUSED void *cls, |
34 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, | 34 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, |
35 | void *value) | 35 | void *value) |
36 | { | 36 | { |
37 | GNUNET_assert(value); | 37 | GNUNET_assert(value); |
38 | 38 | ||
@@ -43,8 +43,8 @@ it_destroy_context_timestamps (GNUNET_UNUSED void *cls, | |||
43 | 43 | ||
44 | int | 44 | int |
45 | it_destroy_context_messages (GNUNET_UNUSED void *cls, | 45 | it_destroy_context_messages (GNUNET_UNUSED void *cls, |
46 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 46 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
47 | void *value) | 47 | void *value) |
48 | { | 48 | { |
49 | GNUNET_assert(value); | 49 | GNUNET_assert(value); |
50 | 50 | ||
@@ -55,8 +55,8 @@ it_destroy_context_messages (GNUNET_UNUSED void *cls, | |||
55 | 55 | ||
56 | int | 56 | int |
57 | it_destroy_context_invites (GNUNET_UNUSED void *cls, | 57 | it_destroy_context_invites (GNUNET_UNUSED void *cls, |
58 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 58 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
59 | void *value) | 59 | void *value) |
60 | { | 60 | { |
61 | GNUNET_assert(value); | 61 | GNUNET_assert(value); |
62 | 62 | ||
@@ -67,7 +67,7 @@ it_destroy_context_invites (GNUNET_UNUSED void *cls, | |||
67 | 67 | ||
68 | void | 68 | void |
69 | cont_context_write_records (void *cls, | 69 | cont_context_write_records (void *cls, |
70 | enum GNUNET_ErrorCode ec) | 70 | enum GNUNET_ErrorCode ec) |
71 | { | 71 | { |
72 | struct GNUNET_CHAT_Context *context = cls; | 72 | struct GNUNET_CHAT_Context *context = cls; |
73 | 73 | ||
@@ -77,9 +77,9 @@ cont_context_write_records (void *cls, | |||
77 | 77 | ||
78 | if (GNUNET_EC_NONE != ec) | 78 | if (GNUNET_EC_NONE != ec) |
79 | handle_send_internal_message( | 79 | handle_send_internal_message( |
80 | context->handle, | 80 | context->handle, |
81 | context, | 81 | context, |
82 | GNUNET_CHAT_FLAG_WARNING, | 82 | GNUNET_CHAT_FLAG_WARNING, |
83 | GNUNET_ErrorCode_get_hint(ec) | 83 | GNUNET_ErrorCode_get_hint(ec) |
84 | ); | 84 | ); |
85 | } | 85 | } |
diff --git a/src/gnunet_chat_file.c b/src/gnunet_chat_file.c index 279e369..ff1ab91 100644 --- a/src/gnunet_chat_file.c +++ b/src/gnunet_chat_file.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021--2022 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 |
@@ -30,11 +30,9 @@ | |||
30 | 30 | ||
31 | struct GNUNET_CHAT_File* | 31 | struct GNUNET_CHAT_File* |
32 | file_create_from_message (struct GNUNET_CHAT_Handle *handle, | 32 | file_create_from_message (struct GNUNET_CHAT_Handle *handle, |
33 | const struct GNUNET_MESSENGER_MessageFile *message) | 33 | const struct GNUNET_MESSENGER_MessageFile *message) |
34 | { | 34 | { |
35 | GNUNET_assert((handle) && | 35 | GNUNET_assert((handle) && (message) && (message->name)); |
36 | (message) && | ||
37 | (message->name)); | ||
38 | 36 | ||
39 | struct GNUNET_CHAT_File* file = GNUNET_new(struct GNUNET_CHAT_File); | 37 | struct GNUNET_CHAT_File* file = GNUNET_new(struct GNUNET_CHAT_File); |
40 | 38 | ||
@@ -71,14 +69,11 @@ file_create_from_message (struct GNUNET_CHAT_Handle *handle, | |||
71 | 69 | ||
72 | struct GNUNET_CHAT_File* | 70 | struct GNUNET_CHAT_File* |
73 | file_create_from_disk (struct GNUNET_CHAT_Handle *handle, | 71 | file_create_from_disk (struct GNUNET_CHAT_Handle *handle, |
74 | const char *name, | 72 | const char *name, |
75 | const struct GNUNET_HashCode *hash, | 73 | const struct GNUNET_HashCode *hash, |
76 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key) | 74 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key) |
77 | { | 75 | { |
78 | GNUNET_assert((handle) && | 76 | GNUNET_assert((handle) && (name) && (hash) && (key)); |
79 | (name) && | ||
80 | (hash) && | ||
81 | (key)); | ||
82 | 77 | ||
83 | struct GNUNET_CHAT_File* file = GNUNET_new(struct GNUNET_CHAT_File); | 78 | struct GNUNET_CHAT_File* file = GNUNET_new(struct GNUNET_CHAT_File); |
84 | 79 | ||
@@ -124,9 +119,9 @@ file_destroy (struct GNUNET_CHAT_File *file) | |||
124 | upload = file->upload_head; | 119 | upload = file->upload_head; |
125 | 120 | ||
126 | GNUNET_CONTAINER_DLL_remove( | 121 | GNUNET_CONTAINER_DLL_remove( |
127 | file->upload_head, | 122 | file->upload_head, |
128 | file->upload_tail, | 123 | file->upload_tail, |
129 | upload | 124 | upload |
130 | ); | 125 | ); |
131 | 126 | ||
132 | GNUNET_free(upload); | 127 | GNUNET_free(upload); |
@@ -138,9 +133,9 @@ file_destroy (struct GNUNET_CHAT_File *file) | |||
138 | download = file->download_head; | 133 | download = file->download_head; |
139 | 134 | ||
140 | GNUNET_CONTAINER_DLL_remove( | 135 | GNUNET_CONTAINER_DLL_remove( |
141 | file->download_head, | 136 | file->download_head, |
142 | file->download_tail, | 137 | file->download_tail, |
143 | download | 138 | download |
144 | ); | 139 | ); |
145 | 140 | ||
146 | GNUNET_free(download); | 141 | GNUNET_free(download); |
@@ -152,9 +147,9 @@ file_destroy (struct GNUNET_CHAT_File *file) | |||
152 | unindex = file->unindex_head; | 147 | unindex = file->unindex_head; |
153 | 148 | ||
154 | GNUNET_CONTAINER_DLL_remove( | 149 | GNUNET_CONTAINER_DLL_remove( |
155 | file->unindex_head, | 150 | file->unindex_head, |
156 | file->unindex_tail, | 151 | file->unindex_tail, |
157 | unindex | 152 | unindex |
158 | ); | 153 | ); |
159 | 154 | ||
160 | GNUNET_free(unindex); | 155 | GNUNET_free(unindex); |
@@ -174,14 +169,14 @@ file_destroy (struct GNUNET_CHAT_File *file) | |||
174 | 169 | ||
175 | void | 170 | void |
176 | file_bind_upload (struct GNUNET_CHAT_File *file, | 171 | file_bind_upload (struct GNUNET_CHAT_File *file, |
177 | struct GNUNET_CHAT_Context *context, | 172 | struct GNUNET_CHAT_Context *context, |
178 | GNUNET_CHAT_FileUploadCallback cb, | 173 | GNUNET_CHAT_FileUploadCallback cb, |
179 | void *cls) | 174 | void *cls) |
180 | { | 175 | { |
181 | GNUNET_assert(file); | 176 | GNUNET_assert(file); |
182 | 177 | ||
183 | struct GNUNET_CHAT_FileUpload *upload = GNUNET_new( | 178 | struct GNUNET_CHAT_FileUpload *upload = GNUNET_new( |
184 | struct GNUNET_CHAT_FileUpload | 179 | struct GNUNET_CHAT_FileUpload |
185 | ); | 180 | ); |
186 | 181 | ||
187 | upload->context = context; | 182 | upload->context = context; |
@@ -189,58 +184,58 @@ file_bind_upload (struct GNUNET_CHAT_File *file, | |||
189 | upload->cls = cls; | 184 | upload->cls = cls; |
190 | 185 | ||
191 | GNUNET_CONTAINER_DLL_insert( | 186 | GNUNET_CONTAINER_DLL_insert( |
192 | file->upload_head, | 187 | file->upload_head, |
193 | file->upload_tail, | 188 | file->upload_tail, |
194 | upload | 189 | upload |
195 | ); | 190 | ); |
196 | } | 191 | } |
197 | 192 | ||
198 | void | 193 | void |
199 | file_bind_downlaod (struct GNUNET_CHAT_File *file, | 194 | file_bind_downlaod (struct GNUNET_CHAT_File *file, |
200 | GNUNET_CHAT_FileDownloadCallback cb, | 195 | GNUNET_CHAT_FileDownloadCallback cb, |
201 | void *cls) | 196 | void *cls) |
202 | { | 197 | { |
203 | GNUNET_assert(file); | 198 | GNUNET_assert(file); |
204 | 199 | ||
205 | struct GNUNET_CHAT_FileDownload *download = GNUNET_new( | 200 | struct GNUNET_CHAT_FileDownload *download = GNUNET_new( |
206 | struct GNUNET_CHAT_FileDownload | 201 | struct GNUNET_CHAT_FileDownload |
207 | ); | 202 | ); |
208 | 203 | ||
209 | download->callback = cb; | 204 | download->callback = cb; |
210 | download->cls = cls; | 205 | download->cls = cls; |
211 | 206 | ||
212 | GNUNET_CONTAINER_DLL_insert( | 207 | GNUNET_CONTAINER_DLL_insert( |
213 | file->download_head, | 208 | file->download_head, |
214 | file->download_tail, | 209 | file->download_tail, |
215 | download | 210 | download |
216 | ); | 211 | ); |
217 | } | 212 | } |
218 | 213 | ||
219 | void | 214 | void |
220 | file_bind_unindex (struct GNUNET_CHAT_File *file, | 215 | file_bind_unindex (struct GNUNET_CHAT_File *file, |
221 | GNUNET_CHAT_FileUnindexCallback cb, | 216 | GNUNET_CHAT_FileUnindexCallback cb, |
222 | void *cls) | 217 | void *cls) |
223 | { | 218 | { |
224 | GNUNET_assert(file); | 219 | GNUNET_assert(file); |
225 | 220 | ||
226 | struct GNUNET_CHAT_FileUnindex *unindex = GNUNET_new( | 221 | struct GNUNET_CHAT_FileUnindex *unindex = GNUNET_new( |
227 | struct GNUNET_CHAT_FileUnindex | 222 | struct GNUNET_CHAT_FileUnindex |
228 | ); | 223 | ); |
229 | 224 | ||
230 | unindex->callback = cb; | 225 | unindex->callback = cb; |
231 | unindex->cls = cls; | 226 | unindex->cls = cls; |
232 | 227 | ||
233 | GNUNET_CONTAINER_DLL_insert( | 228 | GNUNET_CONTAINER_DLL_insert( |
234 | file->unindex_head, | 229 | file->unindex_head, |
235 | file->unindex_tail, | 230 | file->unindex_tail, |
236 | unindex | 231 | unindex |
237 | ); | 232 | ); |
238 | } | 233 | } |
239 | 234 | ||
240 | void | 235 | void |
241 | file_update_upload (struct GNUNET_CHAT_File *file, | 236 | file_update_upload (struct GNUNET_CHAT_File *file, |
242 | uint64_t completed, | 237 | uint64_t completed, |
243 | uint64_t size) | 238 | uint64_t size) |
244 | { | 239 | { |
245 | GNUNET_assert(file); | 240 | GNUNET_assert(file); |
246 | 241 | ||
@@ -284,14 +279,14 @@ file_update_upload (struct GNUNET_CHAT_File *file, | |||
284 | GNUNET_free(msg.body.file.uri); | 279 | GNUNET_free(msg.body.file.uri); |
285 | 280 | ||
286 | file->status &= ( | 281 | file->status &= ( |
287 | GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_PUBLISH | 282 | GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_PUBLISH |
288 | ); | 283 | ); |
289 | } | 284 | } |
290 | 285 | ||
291 | void | 286 | void |
292 | file_update_download (struct GNUNET_CHAT_File *file, | 287 | file_update_download (struct GNUNET_CHAT_File *file, |
293 | uint64_t completed, | 288 | uint64_t completed, |
294 | uint64_t size) | 289 | uint64_t size) |
295 | { | 290 | { |
296 | GNUNET_assert(file); | 291 | GNUNET_assert(file); |
297 | 292 | ||
@@ -324,14 +319,14 @@ file_update_download (struct GNUNET_CHAT_File *file, | |||
324 | } | 319 | } |
325 | 320 | ||
326 | file->status &= ( | 321 | file->status &= ( |
327 | GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_DOWNLOAD | 322 | GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_DOWNLOAD |
328 | ); | 323 | ); |
329 | } | 324 | } |
330 | 325 | ||
331 | void | 326 | void |
332 | file_update_unindex (struct GNUNET_CHAT_File *file, | 327 | file_update_unindex (struct GNUNET_CHAT_File *file, |
333 | uint64_t completed, | 328 | uint64_t completed, |
334 | uint64_t size) | 329 | uint64_t size) |
335 | { | 330 | { |
336 | GNUNET_assert(file); | 331 | GNUNET_assert(file); |
337 | 332 | ||
@@ -364,6 +359,6 @@ file_update_unindex (struct GNUNET_CHAT_File *file, | |||
364 | } | 359 | } |
365 | 360 | ||
366 | file->status &= ( | 361 | file->status &= ( |
367 | GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_UNINDEX | 362 | GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_UNINDEX |
368 | ); | 363 | ); |
369 | } | 364 | } |
diff --git a/src/gnunet_chat_file.h b/src/gnunet_chat_file.h index f41852c..cd2ce1a 100644 --- a/src/gnunet_chat_file.h +++ b/src/gnunet_chat_file.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--2022 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 |
@@ -110,7 +110,7 @@ struct GNUNET_CHAT_File | |||
110 | */ | 110 | */ |
111 | struct GNUNET_CHAT_File* | 111 | struct GNUNET_CHAT_File* |
112 | file_create_from_message (struct GNUNET_CHAT_Handle *handle, | 112 | file_create_from_message (struct GNUNET_CHAT_Handle *handle, |
113 | const struct GNUNET_MESSENGER_MessageFile *message); | 113 | const struct GNUNET_MESSENGER_MessageFile *message); |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Creates a chat file handle from a local file on disk | 116 | * Creates a chat file handle from a local file on disk |
@@ -126,9 +126,9 @@ file_create_from_message (struct GNUNET_CHAT_Handle *handle, | |||
126 | */ | 126 | */ |
127 | struct GNUNET_CHAT_File* | 127 | struct GNUNET_CHAT_File* |
128 | file_create_from_disk (struct GNUNET_CHAT_Handle *handle, | 128 | file_create_from_disk (struct GNUNET_CHAT_Handle *handle, |
129 | const char *name, | 129 | const char *name, |
130 | const struct GNUNET_HashCode *hash, | 130 | const struct GNUNET_HashCode *hash, |
131 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); | 131 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * Destroys a chat <i>file</i> handle and frees its memory. | 134 | * Destroys a chat <i>file</i> handle and frees its memory. |
@@ -150,9 +150,9 @@ file_destroy (struct GNUNET_CHAT_File *file); | |||
150 | */ | 150 | */ |
151 | void | 151 | void |
152 | file_bind_upload (struct GNUNET_CHAT_File *file, | 152 | file_bind_upload (struct GNUNET_CHAT_File *file, |
153 | struct GNUNET_CHAT_Context *context, | 153 | struct GNUNET_CHAT_Context *context, |
154 | GNUNET_CHAT_FileUploadCallback cb, | 154 | GNUNET_CHAT_FileUploadCallback cb, |
155 | void *cls); | 155 | void *cls); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * Binds a callback and a closure to a given chat <i>file</i> | 158 | * Binds a callback and a closure to a given chat <i>file</i> |
@@ -165,8 +165,8 @@ file_bind_upload (struct GNUNET_CHAT_File *file, | |||
165 | */ | 165 | */ |
166 | void | 166 | void |
167 | file_bind_downlaod (struct GNUNET_CHAT_File *file, | 167 | file_bind_downlaod (struct GNUNET_CHAT_File *file, |
168 | GNUNET_CHAT_FileDownloadCallback cb, | 168 | GNUNET_CHAT_FileDownloadCallback cb, |
169 | void *cls); | 169 | void *cls); |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Binds a callback and a closure to a given chat <i>file</i> | 172 | * Binds a callback and a closure to a given chat <i>file</i> |
@@ -179,8 +179,8 @@ file_bind_downlaod (struct GNUNET_CHAT_File *file, | |||
179 | */ | 179 | */ |
180 | void | 180 | void |
181 | file_bind_unindex (struct GNUNET_CHAT_File *file, | 181 | file_bind_unindex (struct GNUNET_CHAT_File *file, |
182 | GNUNET_CHAT_FileUnindexCallback cb, | 182 | GNUNET_CHAT_FileUnindexCallback cb, |
183 | void *cls); | 183 | void *cls); |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Calls the regarding events and bound callback of a given | 186 | * Calls the regarding events and bound callback of a given |
@@ -194,8 +194,8 @@ file_bind_unindex (struct GNUNET_CHAT_File *file, | |||
194 | */ | 194 | */ |
195 | void | 195 | void |
196 | file_update_upload (struct GNUNET_CHAT_File *file, | 196 | file_update_upload (struct GNUNET_CHAT_File *file, |
197 | uint64_t completed, | 197 | uint64_t completed, |
198 | uint64_t size); | 198 | uint64_t size); |
199 | 199 | ||
200 | /** | 200 | /** |
201 | * Calls the regarding events and bound callback of a given | 201 | * Calls the regarding events and bound callback of a given |
@@ -209,8 +209,8 @@ file_update_upload (struct GNUNET_CHAT_File *file, | |||
209 | */ | 209 | */ |
210 | void | 210 | void |
211 | file_update_download (struct GNUNET_CHAT_File *file, | 211 | file_update_download (struct GNUNET_CHAT_File *file, |
212 | uint64_t completed, | 212 | uint64_t completed, |
213 | uint64_t size); | 213 | uint64_t size); |
214 | 214 | ||
215 | /** | 215 | /** |
216 | * Calls the regarding events and bound callback of a given | 216 | * Calls the regarding events and bound callback of a given |
@@ -224,7 +224,7 @@ file_update_download (struct GNUNET_CHAT_File *file, | |||
224 | */ | 224 | */ |
225 | void | 225 | void |
226 | file_update_unindex (struct GNUNET_CHAT_File *file, | 226 | file_update_unindex (struct GNUNET_CHAT_File *file, |
227 | uint64_t completed, | 227 | uint64_t completed, |
228 | uint64_t size); | 228 | uint64_t size); |
229 | 229 | ||
230 | #endif /* GNUNET_CHAT_FILE_H_ */ | 230 | #endif /* GNUNET_CHAT_FILE_H_ */ |
diff --git a/src/gnunet_chat_group.c b/src/gnunet_chat_group.c index f3c6f46..2f48af5 100644 --- a/src/gnunet_chat_group.c +++ b/src/gnunet_chat_group.c | |||
@@ -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 |
@@ -32,7 +32,7 @@ static const uint16_t group_regex_compression = 6; | |||
32 | 32 | ||
33 | struct GNUNET_CHAT_Group* | 33 | struct GNUNET_CHAT_Group* |
34 | group_create_from_context (struct GNUNET_CHAT_Handle *handle, | 34 | group_create_from_context (struct GNUNET_CHAT_Handle *handle, |
35 | struct GNUNET_CHAT_Context *context) | 35 | struct GNUNET_CHAT_Context *context) |
36 | { | 36 | { |
37 | GNUNET_assert((handle) && (context)); | 37 | GNUNET_assert((handle) && (context)); |
38 | 38 | ||
@@ -45,7 +45,7 @@ group_create_from_context (struct GNUNET_CHAT_Handle *handle, | |||
45 | group->search = NULL; | 45 | group->search = NULL; |
46 | 46 | ||
47 | group->registry = GNUNET_CONTAINER_multipeermap_create( | 47 | group->registry = GNUNET_CONTAINER_multipeermap_create( |
48 | initial_map_size_of_context, GNUNET_NO); | 48 | initial_map_size_of_context, GNUNET_NO); |
49 | 49 | ||
50 | group->user_pointer = NULL; | 50 | group->user_pointer = NULL; |
51 | 51 | ||
@@ -72,28 +72,30 @@ group_destroy (struct GNUNET_CHAT_Group* group) | |||
72 | void | 72 | void |
73 | group_publish (struct GNUNET_CHAT_Group* group) | 73 | group_publish (struct GNUNET_CHAT_Group* group) |
74 | { | 74 | { |
75 | GNUNET_assert((group) && | 75 | GNUNET_assert( |
76 | (group) && | ||
76 | (group->context) && | 77 | (group->context) && |
77 | (group->context->topic) && | 78 | (group->context->topic) && |
78 | (group->handle) && | 79 | (group->handle) && |
79 | (group->handle->cfg)); | 80 | (group->handle->cfg) |
81 | ); | ||
80 | 82 | ||
81 | char* topic = NULL; | 83 | char* topic = NULL; |
82 | GNUNET_asprintf ( | 84 | GNUNET_asprintf ( |
83 | &topic, | 85 | &topic, |
84 | "GNUNET_CHAT_%s", | 86 | "GNUNET_CHAT_%s", |
85 | group->context->topic | 87 | group->context->topic |
86 | ); | 88 | ); |
87 | 89 | ||
88 | group->announcement = GNUNET_REGEX_announce( | 90 | group->announcement = GNUNET_REGEX_announce( |
89 | group->handle->cfg, topic, | 91 | group->handle->cfg, topic, |
90 | GNUNET_TIME_relative_get_minute_(), | 92 | GNUNET_TIME_relative_get_minute_(), |
91 | group_regex_compression | 93 | group_regex_compression |
92 | ); | 94 | ); |
93 | 95 | ||
94 | group->search = GNUNET_REGEX_search( | 96 | group->search = GNUNET_REGEX_search( |
95 | group->handle->cfg, topic, | 97 | group->handle->cfg, topic, |
96 | search_group_by_topic, group | 98 | search_group_by_topic, group |
97 | ); | 99 | ); |
98 | 100 | ||
99 | GNUNET_free(topic); | 101 | GNUNET_free(topic); |
diff --git a/src/gnunet_chat_group.h b/src/gnunet_chat_group.h index a48fb2f..c5eb778 100644 --- a/src/gnunet_chat_group.h +++ b/src/gnunet_chat_group.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--2022 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 |
@@ -54,7 +54,7 @@ struct GNUNET_CHAT_Group | |||
54 | */ | 54 | */ |
55 | struct GNUNET_CHAT_Group* | 55 | struct GNUNET_CHAT_Group* |
56 | group_create_from_context (struct GNUNET_CHAT_Handle *handle, | 56 | group_create_from_context (struct GNUNET_CHAT_Handle *handle, |
57 | struct GNUNET_CHAT_Context *context); | 57 | struct GNUNET_CHAT_Context *context); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Destroys a chat <i>group</i> and frees its memory. | 60 | * Destroys a chat <i>group</i> and frees its memory. |
diff --git a/src/gnunet_chat_group_intern.c b/src/gnunet_chat_group_intern.c index bbbbdaa..8773a3d 100644 --- a/src/gnunet_chat_group_intern.c +++ b/src/gnunet_chat_group_intern.c | |||
@@ -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 |
@@ -30,19 +30,21 @@ | |||
30 | void | 30 | void |
31 | search_group_by_topic(void *cls, | 31 | search_group_by_topic(void *cls, |
32 | const struct GNUNET_PeerIdentity *door, | 32 | const struct GNUNET_PeerIdentity *door, |
33 | GNUNET_UNUSED const struct GNUNET_PeerIdentity *get_path, | 33 | GNUNET_UNUSED const struct GNUNET_PeerIdentity *get_path, |
34 | GNUNET_UNUSED unsigned int get_path_length, | 34 | GNUNET_UNUSED unsigned int get_path_length, |
35 | GNUNET_UNUSED const struct GNUNET_PeerIdentity *put_path, | 35 | GNUNET_UNUSED const struct GNUNET_PeerIdentity *put_path, |
36 | GNUNET_UNUSED unsigned int put_path_length) | 36 | GNUNET_UNUSED unsigned int put_path_length) |
37 | { | 37 | { |
38 | struct GNUNET_CHAT_Group *group = cls; | 38 | struct GNUNET_CHAT_Group *group = cls; |
39 | 39 | ||
40 | GNUNET_assert((group) && | 40 | GNUNET_assert( |
41 | (group) && | ||
41 | (group->handle) && | 42 | (group->handle) && |
42 | (group->handle->cfg) && | 43 | (group->handle->cfg) && |
43 | (group->handle->messenger) && | 44 | (group->handle->messenger) && |
44 | (group->context) && | 45 | (group->context) && |
45 | (group->context->room)); | 46 | (group->context->room) |
47 | ); | ||
46 | 48 | ||
47 | struct GNUNET_PeerIdentity peer; | 49 | struct GNUNET_PeerIdentity peer; |
48 | GNUNET_CRYPTO_get_peer_identity(group->handle->cfg, &peer); | 50 | GNUNET_CRYPTO_get_peer_identity(group->handle->cfg, &peer); |
@@ -51,7 +53,7 @@ search_group_by_topic(void *cls, | |||
51 | return; | 53 | return; |
52 | 54 | ||
53 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 55 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
54 | group->context->room | 56 | group->context->room |
55 | ); | 57 | ); |
56 | 58 | ||
57 | if ((GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains( | 59 | if ((GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains( |
@@ -62,9 +64,9 @@ search_group_by_topic(void *cls, | |||
62 | return; | 64 | return; |
63 | 65 | ||
64 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room( | 66 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room( |
65 | group->handle->messenger, | 67 | group->handle->messenger, |
66 | door, | 68 | door, |
67 | key | 69 | key |
68 | ); | 70 | ); |
69 | 71 | ||
70 | handle_send_room_name(group->handle, room); | 72 | handle_send_room_name(group->handle, room); |
diff --git a/src/gnunet_chat_handle.c b/src/gnunet_chat_handle.c index 9e63756..97fff80 100644 --- a/src/gnunet_chat_handle.c +++ b/src/gnunet_chat_handle.c | |||
@@ -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 |
@@ -31,8 +31,8 @@ static const unsigned int minimum_amount_of_other_members_in_group = 2; | |||
31 | 31 | ||
32 | struct GNUNET_CHAT_Handle* | 32 | struct GNUNET_CHAT_Handle* |
33 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | 33 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, |
34 | GNUNET_CHAT_ContextMessageCallback msg_cb, | 34 | GNUNET_CHAT_ContextMessageCallback msg_cb, |
35 | void *msg_cls) | 35 | void *msg_cls) |
36 | { | 36 | { |
37 | GNUNET_assert(cfg); | 37 | GNUNET_assert(cfg); |
38 | 38 | ||
@@ -40,7 +40,7 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | |||
40 | 40 | ||
41 | handle->cfg = cfg; | 41 | handle->cfg = cfg; |
42 | handle->shutdown_hook = GNUNET_SCHEDULER_add_shutdown( | 42 | handle->shutdown_hook = GNUNET_SCHEDULER_add_shutdown( |
43 | on_handle_shutdown, handle | 43 | on_handle_shutdown, handle |
44 | ); | 44 | ); |
45 | 45 | ||
46 | handle->destruction = NULL; | 46 | handle->destruction = NULL; |
@@ -61,7 +61,7 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | |||
61 | handle->directory = NULL; | 61 | handle->directory = NULL; |
62 | } | 62 | } |
63 | else if ((GNUNET_YES != GNUNET_DISK_directory_test(handle->directory, GNUNET_YES)) && | 63 | else if ((GNUNET_YES != GNUNET_DISK_directory_test(handle->directory, GNUNET_YES)) && |
64 | (GNUNET_OK != GNUNET_DISK_directory_create(handle->directory))) | 64 | (GNUNET_OK != GNUNET_DISK_directory_create(handle->directory))) |
65 | { | 65 | { |
66 | GNUNET_free(handle->directory); | 66 | GNUNET_free(handle->directory); |
67 | 67 | ||
@@ -74,7 +74,7 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | |||
74 | util_get_dirname(handle->directory, "chat", &chat_directory); | 74 | util_get_dirname(handle->directory, "chat", &chat_directory); |
75 | 75 | ||
76 | if ((GNUNET_YES != GNUNET_DISK_directory_test(chat_directory, GNUNET_YES)) && | 76 | if ((GNUNET_YES != GNUNET_DISK_directory_test(chat_directory, GNUNET_YES)) && |
77 | (GNUNET_OK != GNUNET_DISK_directory_create(chat_directory))) | 77 | (GNUNET_OK != GNUNET_DISK_directory_create(chat_directory))) |
78 | GNUNET_free(chat_directory); | 78 | GNUNET_free(chat_directory); |
79 | else | 79 | else |
80 | { | 80 | { |
@@ -104,21 +104,22 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | |||
104 | handle->groups = NULL; | 104 | handle->groups = NULL; |
105 | 105 | ||
106 | handle->arm = GNUNET_ARM_connect( | 106 | handle->arm = GNUNET_ARM_connect( |
107 | handle->cfg, | 107 | handle->cfg, |
108 | on_handle_arm_connection, handle | 108 | on_handle_arm_connection, |
109 | handle | ||
109 | ); | 110 | ); |
110 | 111 | ||
111 | if (handle->arm) | 112 | if (handle->arm) |
112 | on_handle_arm_connection(handle, GNUNET_NO); | 113 | on_handle_arm_connection(handle, GNUNET_NO); |
113 | 114 | ||
114 | handle->identity = GNUNET_IDENTITY_connect( | 115 | handle->identity = GNUNET_IDENTITY_connect( |
115 | handle->cfg, | 116 | handle->cfg, |
116 | on_handle_gnunet_identity, | 117 | on_handle_gnunet_identity, |
117 | handle | 118 | handle |
118 | ); | 119 | ); |
119 | 120 | ||
120 | handle->namestore = GNUNET_NAMESTORE_connect( | 121 | handle->namestore = GNUNET_NAMESTORE_connect( |
121 | handle->cfg | 122 | handle->cfg |
122 | ); | 123 | ); |
123 | 124 | ||
124 | handle->fs = NULL; | 125 | handle->fs = NULL; |
@@ -212,9 +213,9 @@ handle_destroy (struct GNUNET_CHAT_Handle *handle) | |||
212 | message_destroy(internal->msg); | 213 | message_destroy(internal->msg); |
213 | 214 | ||
214 | GNUNET_CONTAINER_DLL_remove( | 215 | GNUNET_CONTAINER_DLL_remove( |
215 | handle->internal_head, | 216 | handle->internal_head, |
216 | handle->internal_tail, | 217 | handle->internal_tail, |
217 | internal | 218 | internal |
218 | ); | 219 | ); |
219 | 220 | ||
220 | GNUNET_free(internal); | 221 | GNUNET_free(internal); |
@@ -226,10 +227,12 @@ handle_destroy (struct GNUNET_CHAT_Handle *handle) | |||
226 | static void | 227 | static void |
227 | handle_update_identity(struct GNUNET_CHAT_Handle *handle) | 228 | handle_update_identity(struct GNUNET_CHAT_Handle *handle) |
228 | { | 229 | { |
229 | GNUNET_assert((handle) && | 230 | GNUNET_assert( |
231 | (handle) && | ||
230 | (handle->contexts) && | 232 | (handle->contexts) && |
231 | (handle->groups) && | 233 | (handle->groups) && |
232 | (handle->contacts)); | 234 | (handle->contacts) |
235 | ); | ||
233 | 236 | ||
234 | handle_update_key(handle); | 237 | handle_update_key(handle); |
235 | 238 | ||
@@ -241,10 +244,10 @@ handle_update_identity(struct GNUNET_CHAT_Handle *handle) | |||
241 | GNUNET_assert(handle->messenger); | 244 | GNUNET_assert(handle->messenger); |
242 | 245 | ||
243 | handle_send_internal_message( | 246 | handle_send_internal_message( |
244 | handle, | 247 | handle, |
245 | NULL, | 248 | NULL, |
246 | GNUNET_CHAT_FLAG_LOGIN, | 249 | GNUNET_CHAT_FLAG_LOGIN, |
247 | NULL | 250 | NULL |
248 | ); | 251 | ); |
249 | 252 | ||
250 | const struct GNUNET_CRYPTO_PrivateKey *zone = handle_get_key(handle); | 253 | const struct GNUNET_CRYPTO_PrivateKey *zone = handle_get_key(handle); |
@@ -253,28 +256,30 @@ handle_update_identity(struct GNUNET_CHAT_Handle *handle) | |||
253 | return; | 256 | return; |
254 | 257 | ||
255 | handle->monitor = GNUNET_NAMESTORE_zone_monitor_start( | 258 | handle->monitor = GNUNET_NAMESTORE_zone_monitor_start( |
256 | handle->cfg, | 259 | handle->cfg, |
257 | zone, | 260 | zone, |
258 | GNUNET_YES, | 261 | GNUNET_YES, |
259 | NULL, | 262 | NULL, |
260 | NULL, | 263 | NULL, |
261 | on_monitor_namestore_record, | 264 | on_monitor_namestore_record, |
262 | handle, | 265 | handle, |
263 | NULL, | 266 | NULL, |
264 | NULL | 267 | NULL |
265 | ); | 268 | ); |
266 | } | 269 | } |
267 | 270 | ||
268 | void | 271 | void |
269 | handle_connect (struct GNUNET_CHAT_Handle *handle, | 272 | handle_connect (struct GNUNET_CHAT_Handle *handle, |
270 | const struct GNUNET_CHAT_Account *account) | 273 | const struct GNUNET_CHAT_Account *account) |
271 | { | 274 | { |
272 | GNUNET_assert((handle) && (account) && | 275 | GNUNET_assert( |
276 | (handle) && (account) && | ||
273 | (!(handle->current)) && | 277 | (!(handle->current)) && |
274 | (!(handle->groups)) && | 278 | (!(handle->groups)) && |
275 | (!(handle->contacts)) && | 279 | (!(handle->contacts)) && |
276 | (!(handle->contexts)) && | 280 | (!(handle->contexts)) && |
277 | (!(handle->files))); | 281 | (!(handle->files)) |
282 | ); | ||
278 | 283 | ||
279 | if (handle->monitor) | 284 | if (handle->monitor) |
280 | { | 285 | { |
@@ -283,13 +288,13 @@ handle_connect (struct GNUNET_CHAT_Handle *handle, | |||
283 | } | 288 | } |
284 | 289 | ||
285 | handle->files = GNUNET_CONTAINER_multihashmap_create( | 290 | handle->files = GNUNET_CONTAINER_multihashmap_create( |
286 | initial_map_size_of_handle, GNUNET_NO); | 291 | initial_map_size_of_handle, GNUNET_NO); |
287 | handle->contexts = GNUNET_CONTAINER_multihashmap_create( | 292 | handle->contexts = GNUNET_CONTAINER_multihashmap_create( |
288 | initial_map_size_of_handle, GNUNET_NO); | 293 | initial_map_size_of_handle, GNUNET_NO); |
289 | handle->contacts = GNUNET_CONTAINER_multishortmap_create( | 294 | handle->contacts = GNUNET_CONTAINER_multishortmap_create( |
290 | initial_map_size_of_handle, GNUNET_NO); | 295 | initial_map_size_of_handle, GNUNET_NO); |
291 | handle->groups = GNUNET_CONTAINER_multihashmap_create( | 296 | handle->groups = GNUNET_CONTAINER_multihashmap_create( |
292 | initial_map_size_of_handle, GNUNET_NO); | 297 | initial_map_size_of_handle, GNUNET_NO); |
293 | 298 | ||
294 | const char *name = account->name; | 299 | const char *name = account->name; |
295 | 300 | ||
@@ -299,17 +304,17 @@ handle_connect (struct GNUNET_CHAT_Handle *handle, | |||
299 | 304 | ||
300 | char* fs_client_name = NULL; | 305 | char* fs_client_name = NULL; |
301 | GNUNET_asprintf ( | 306 | GNUNET_asprintf ( |
302 | &fs_client_name, | 307 | &fs_client_name, |
303 | "GNUNET_CHAT_%s%s", | 308 | "GNUNET_CHAT_%s%s", |
304 | name? "_" : "anonymous", | 309 | name? "_" : "anonymous", |
305 | name? name : "" | 310 | name? name : "" |
306 | ); | 311 | ); |
307 | 312 | ||
308 | handle->fs = GNUNET_FS_start( | 313 | handle->fs = GNUNET_FS_start( |
309 | handle->cfg, fs_client_name, | 314 | handle->cfg, fs_client_name, |
310 | notify_handle_fs_progress, handle, | 315 | notify_handle_fs_progress, handle, |
311 | GNUNET_FS_FLAGS_NONE, | 316 | GNUNET_FS_FLAGS_NONE, |
312 | GNUNET_FS_OPTIONS_END | 317 | GNUNET_FS_OPTIONS_END |
313 | ); | 318 | ); |
314 | 319 | ||
315 | GNUNET_free(fs_client_name); | 320 | GNUNET_free(fs_client_name); |
@@ -317,9 +322,9 @@ handle_connect (struct GNUNET_CHAT_Handle *handle, | |||
317 | handle->gns = GNUNET_GNS_connect(handle->cfg); | 322 | handle->gns = GNUNET_GNS_connect(handle->cfg); |
318 | 323 | ||
319 | handle->messenger = GNUNET_MESSENGER_connect( | 324 | handle->messenger = GNUNET_MESSENGER_connect( |
320 | handle->cfg, name, key, | 325 | handle->cfg, name, key, |
321 | on_handle_message, | 326 | on_handle_message, |
322 | handle | 327 | handle |
323 | ); | 328 | ); |
324 | 329 | ||
325 | handle->current = account; | 330 | handle->current = account; |
@@ -329,23 +334,25 @@ handle_connect (struct GNUNET_CHAT_Handle *handle, | |||
329 | void | 334 | void |
330 | handle_disconnect (struct GNUNET_CHAT_Handle *handle) | 335 | handle_disconnect (struct GNUNET_CHAT_Handle *handle) |
331 | { | 336 | { |
332 | GNUNET_assert((handle) && | 337 | GNUNET_assert( |
338 | (handle) && | ||
333 | (handle->current) && | 339 | (handle->current) && |
334 | (handle->groups) && | 340 | (handle->groups) && |
335 | (handle->contacts) && | 341 | (handle->contacts) && |
336 | (handle->contexts) && | 342 | (handle->contexts) && |
337 | (handle->files)); | 343 | (handle->files) |
344 | ); | ||
338 | 345 | ||
339 | GNUNET_CONTAINER_multihashmap_iterate( | 346 | GNUNET_CONTAINER_multihashmap_iterate( |
340 | handle->groups, it_destroy_handle_groups, NULL | 347 | handle->groups, it_destroy_handle_groups, NULL |
341 | ); | 348 | ); |
342 | 349 | ||
343 | GNUNET_CONTAINER_multishortmap_iterate( | 350 | GNUNET_CONTAINER_multishortmap_iterate( |
344 | handle->contacts, it_destroy_handle_contacts, NULL | 351 | handle->contacts, it_destroy_handle_contacts, NULL |
345 | ); | 352 | ); |
346 | 353 | ||
347 | GNUNET_CONTAINER_multihashmap_iterate( | 354 | GNUNET_CONTAINER_multihashmap_iterate( |
348 | handle->contexts, it_destroy_handle_contexts, NULL | 355 | handle->contexts, it_destroy_handle_contexts, NULL |
349 | ); | 356 | ); |
350 | 357 | ||
351 | struct GNUNET_CHAT_InternalMessages *internal; | 358 | struct GNUNET_CHAT_InternalMessages *internal; |
@@ -395,7 +402,7 @@ handle_disconnect (struct GNUNET_CHAT_Handle *handle) | |||
395 | GNUNET_GNS_disconnect(handle->gns); | 402 | GNUNET_GNS_disconnect(handle->gns); |
396 | 403 | ||
397 | GNUNET_CONTAINER_multihashmap_iterate( | 404 | GNUNET_CONTAINER_multihashmap_iterate( |
398 | handle->files, it_destroy_handle_files, NULL | 405 | handle->files, it_destroy_handle_files, NULL |
399 | ); | 406 | ); |
400 | 407 | ||
401 | if (handle->fs) | 408 | if (handle->fs) |
@@ -438,7 +445,7 @@ handle_disconnect (struct GNUNET_CHAT_Handle *handle) | |||
438 | 445 | ||
439 | static struct GNUNET_CHAT_InternalAccounts* | 446 | static struct GNUNET_CHAT_InternalAccounts* |
440 | find_accounts_by_name (struct GNUNET_CHAT_Handle *handle, | 447 | find_accounts_by_name (struct GNUNET_CHAT_Handle *handle, |
441 | const char *name) | 448 | const char *name) |
442 | { | 449 | { |
443 | GNUNET_assert((handle) && (name)); | 450 | GNUNET_assert((handle) && (name)); |
444 | 451 | ||
@@ -449,7 +456,7 @@ find_accounts_by_name (struct GNUNET_CHAT_Handle *handle, | |||
449 | goto skip_account; | 456 | goto skip_account; |
450 | 457 | ||
451 | if ((accounts->account->name) && | 458 | if ((accounts->account->name) && |
452 | (0 == strcmp(accounts->account->name, name))) | 459 | (0 == strcmp(accounts->account->name, name))) |
453 | break; | 460 | break; |
454 | 461 | ||
455 | skip_account: | 462 | skip_account: |
@@ -461,9 +468,9 @@ find_accounts_by_name (struct GNUNET_CHAT_Handle *handle, | |||
461 | 468 | ||
462 | static int | 469 | static int |
463 | update_accounts_operation (struct GNUNET_CHAT_InternalAccounts **out_accounts, | 470 | update_accounts_operation (struct GNUNET_CHAT_InternalAccounts **out_accounts, |
464 | struct GNUNET_CHAT_Handle *handle, | 471 | struct GNUNET_CHAT_Handle *handle, |
465 | const char *name, | 472 | const char *name, |
466 | int wait_for_completion) | 473 | int wait_for_completion) |
467 | { | 474 | { |
468 | GNUNET_assert(handle); | 475 | GNUNET_assert(handle); |
469 | 476 | ||
@@ -504,7 +511,7 @@ update_accounts_operation (struct GNUNET_CHAT_InternalAccounts **out_accounts, | |||
504 | 511 | ||
505 | int | 512 | int |
506 | handle_create_account (struct GNUNET_CHAT_Handle *handle, | 513 | handle_create_account (struct GNUNET_CHAT_Handle *handle, |
507 | const char *name) | 514 | const char *name) |
508 | { | 515 | { |
509 | GNUNET_assert((handle) && (name)); | 516 | GNUNET_assert((handle) && (name)); |
510 | 517 | ||
@@ -514,18 +521,23 @@ handle_create_account (struct GNUNET_CHAT_Handle *handle, | |||
514 | if (accounts) | 521 | if (accounts) |
515 | return GNUNET_NO; | 522 | return GNUNET_NO; |
516 | 523 | ||
517 | int result = update_accounts_operation(&accounts, handle, NULL, GNUNET_NO); | 524 | int result = update_accounts_operation( |
525 | &accounts, | ||
526 | handle, | ||
527 | NULL, | ||
528 | GNUNET_NO | ||
529 | ); | ||
518 | 530 | ||
519 | if (GNUNET_OK != result) | 531 | if (GNUNET_OK != result) |
520 | return result; | 532 | return result; |
521 | 533 | ||
522 | accounts->op = GNUNET_IDENTITY_create( | 534 | accounts->op = GNUNET_IDENTITY_create( |
523 | handle->identity, | 535 | handle->identity, |
524 | name, | 536 | name, |
525 | NULL, | 537 | NULL, |
526 | GNUNET_PUBLIC_KEY_TYPE_ECDSA, | 538 | GNUNET_PUBLIC_KEY_TYPE_ECDSA, |
527 | cb_account_creation, | 539 | cb_account_creation, |
528 | accounts | 540 | accounts |
529 | ); | 541 | ); |
530 | 542 | ||
531 | if (!accounts->op) | 543 | if (!accounts->op) |
@@ -536,23 +548,28 @@ handle_create_account (struct GNUNET_CHAT_Handle *handle, | |||
536 | 548 | ||
537 | int | 549 | int |
538 | handle_delete_account (struct GNUNET_CHAT_Handle *handle, | 550 | handle_delete_account (struct GNUNET_CHAT_Handle *handle, |
539 | const char *name) | 551 | const char *name) |
540 | { | 552 | { |
541 | GNUNET_assert((handle) && (name)); | 553 | GNUNET_assert((handle) && (name)); |
542 | 554 | ||
543 | struct GNUNET_CHAT_InternalAccounts *accounts; | 555 | struct GNUNET_CHAT_InternalAccounts *accounts; |
544 | accounts = find_accounts_by_name(handle, name); | 556 | accounts = find_accounts_by_name(handle, name); |
545 | 557 | ||
546 | int result = update_accounts_operation(&accounts, handle, NULL, GNUNET_YES); | 558 | int result = update_accounts_operation( |
559 | &accounts, | ||
560 | handle, | ||
561 | NULL, | ||
562 | GNUNET_YES | ||
563 | ); | ||
547 | 564 | ||
548 | if (GNUNET_OK != result) | 565 | if (GNUNET_OK != result) |
549 | return result; | 566 | return result; |
550 | 567 | ||
551 | accounts->op = GNUNET_IDENTITY_delete( | 568 | accounts->op = GNUNET_IDENTITY_delete( |
552 | handle->identity, | 569 | handle->identity, |
553 | name, | 570 | name, |
554 | cb_account_deletion, | 571 | cb_account_deletion, |
555 | accounts | 572 | accounts |
556 | ); | 573 | ); |
557 | 574 | ||
558 | if (!accounts->op) | 575 | if (!accounts->op) |
@@ -563,25 +580,30 @@ handle_delete_account (struct GNUNET_CHAT_Handle *handle, | |||
563 | 580 | ||
564 | int | 581 | int |
565 | handle_rename_account (struct GNUNET_CHAT_Handle *handle, | 582 | handle_rename_account (struct GNUNET_CHAT_Handle *handle, |
566 | const char *old_name, | 583 | const char *old_name, |
567 | const char *new_name) | 584 | const char *new_name) |
568 | { | 585 | { |
569 | GNUNET_assert((handle) && (old_name) && (new_name)); | 586 | GNUNET_assert((handle) && (old_name) && (new_name)); |
570 | 587 | ||
571 | struct GNUNET_CHAT_InternalAccounts *accounts; | 588 | struct GNUNET_CHAT_InternalAccounts *accounts; |
572 | accounts = find_accounts_by_name(handle, old_name); | 589 | accounts = find_accounts_by_name(handle, old_name); |
573 | 590 | ||
574 | int result = update_accounts_operation(&accounts, handle, NULL, GNUNET_YES); | 591 | int result = update_accounts_operation( |
592 | &accounts, | ||
593 | handle, | ||
594 | NULL, | ||
595 | GNUNET_YES | ||
596 | ); | ||
575 | 597 | ||
576 | if (GNUNET_OK != result) | 598 | if (GNUNET_OK != result) |
577 | return result; | 599 | return result; |
578 | 600 | ||
579 | accounts->op = GNUNET_IDENTITY_rename( | 601 | accounts->op = GNUNET_IDENTITY_rename( |
580 | handle->identity, | 602 | handle->identity, |
581 | old_name, | 603 | old_name, |
582 | new_name, | 604 | new_name, |
583 | cb_account_rename, | 605 | cb_account_rename, |
584 | accounts | 606 | accounts |
585 | ); | 607 | ); |
586 | 608 | ||
587 | if (!accounts->op) | 609 | if (!accounts->op) |
@@ -617,16 +639,21 @@ handle_update (struct GNUNET_CHAT_Handle *handle) | |||
617 | struct GNUNET_CHAT_InternalAccounts *accounts; | 639 | struct GNUNET_CHAT_InternalAccounts *accounts; |
618 | accounts = find_accounts_by_name(handle, name); | 640 | accounts = find_accounts_by_name(handle, name); |
619 | 641 | ||
620 | int result = update_accounts_operation(&accounts, handle, name, GNUNET_YES); | 642 | int result = update_accounts_operation( |
643 | &accounts, | ||
644 | handle, | ||
645 | name, | ||
646 | GNUNET_YES | ||
647 | ); | ||
621 | 648 | ||
622 | if (GNUNET_OK != result) | 649 | if (GNUNET_OK != result) |
623 | return result; | 650 | return result; |
624 | 651 | ||
625 | accounts->op = GNUNET_IDENTITY_delete( | 652 | accounts->op = GNUNET_IDENTITY_delete( |
626 | handle->identity, | 653 | handle->identity, |
627 | name, | 654 | name, |
628 | cb_account_update, | 655 | cb_account_update, |
629 | accounts | 656 | accounts |
630 | ); | 657 | ); |
631 | 658 | ||
632 | if (!accounts->op) | 659 | if (!accounts->op) |
@@ -644,15 +671,15 @@ handle_get_key (const struct GNUNET_CHAT_Handle *handle) | |||
644 | return NULL; | 671 | return NULL; |
645 | 672 | ||
646 | return GNUNET_IDENTITY_ego_get_private_key( | 673 | return GNUNET_IDENTITY_ego_get_private_key( |
647 | handle->current->ego | 674 | handle->current->ego |
648 | ); | 675 | ); |
649 | } | 676 | } |
650 | 677 | ||
651 | void | 678 | void |
652 | handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, | 679 | handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, |
653 | struct GNUNET_CHAT_Context *context, | 680 | struct GNUNET_CHAT_Context *context, |
654 | enum GNUNET_CHAT_MessageFlag flag, | 681 | enum GNUNET_CHAT_MessageFlag flag, |
655 | const char *warning) | 682 | const char *warning) |
656 | { | 683 | { |
657 | GNUNET_assert((handle) && (GNUNET_CHAT_FLAG_NONE != flag)); | 684 | GNUNET_assert((handle) && (GNUNET_CHAT_FLAG_NONE != flag)); |
658 | 685 | ||
@@ -660,11 +687,11 @@ handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, | |||
660 | return; | 687 | return; |
661 | 688 | ||
662 | struct GNUNET_CHAT_InternalMessages *internal = GNUNET_new( | 689 | struct GNUNET_CHAT_InternalMessages *internal = GNUNET_new( |
663 | struct GNUNET_CHAT_InternalMessages | 690 | struct GNUNET_CHAT_InternalMessages |
664 | ); | 691 | ); |
665 | 692 | ||
666 | internal->msg = message_create_internally( | 693 | internal->msg = message_create_internally( |
667 | context, flag, warning | 694 | context, flag, warning |
668 | ); | 695 | ); |
669 | 696 | ||
670 | if (!(internal->msg)) | 697 | if (!(internal->msg)) |
@@ -677,9 +704,9 @@ handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, | |||
677 | 704 | ||
678 | if (context) | 705 | if (context) |
679 | GNUNET_CONTAINER_DLL_insert( | 706 | GNUNET_CONTAINER_DLL_insert( |
680 | handle->internal_head, | 707 | handle->internal_head, |
681 | handle->internal_tail, | 708 | handle->internal_tail, |
682 | internal | 709 | internal |
683 | ); | 710 | ); |
684 | else | 711 | else |
685 | GNUNET_CONTAINER_DLL_insert_tail( | 712 | GNUNET_CONTAINER_DLL_insert_tail( |
@@ -715,16 +742,18 @@ handle_send_room_name (struct GNUNET_CHAT_Handle *handle, | |||
715 | 742 | ||
716 | int | 743 | int |
717 | handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, | 744 | handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, |
718 | struct GNUNET_MESSENGER_Room *room) | 745 | struct GNUNET_MESSENGER_Room *room) |
719 | { | 746 | { |
720 | GNUNET_assert((handle) && | 747 | GNUNET_assert( |
748 | (handle) && | ||
721 | (handle->contexts) && | 749 | (handle->contexts) && |
722 | (room)); | 750 | (room) |
751 | ); | ||
723 | 752 | ||
724 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room); | 753 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room); |
725 | 754 | ||
726 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( | 755 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( |
727 | handle->contexts, key | 756 | handle->contexts, key |
728 | ); | 757 | ); |
729 | 758 | ||
730 | struct GNUNET_CHAT_CheckHandleRoomMembers check; | 759 | struct GNUNET_CHAT_CheckHandleRoomMembers check; |
@@ -752,7 +781,7 @@ check_type: | |||
752 | check.contact = NULL; | 781 | check.contact = NULL; |
753 | 782 | ||
754 | const int checks = GNUNET_MESSENGER_iterate_members( | 783 | const int checks = GNUNET_MESSENGER_iterate_members( |
755 | room, check_handle_room_members, &check | 784 | room, check_handle_room_members, &check |
756 | ); | 785 | ); |
757 | 786 | ||
758 | if ((check.contact) && | 787 | if ((check.contact) && |
@@ -779,11 +808,11 @@ check_type: | |||
779 | if (context->contact) | 808 | if (context->contact) |
780 | { | 809 | { |
781 | struct GNUNET_CHAT_Contact *contact = handle_get_contact_from_messenger( | 810 | struct GNUNET_CHAT_Contact *contact = handle_get_contact_from_messenger( |
782 | handle, check.contact | 811 | handle, check.contact |
783 | ); | 812 | ); |
784 | 813 | ||
785 | if ((contact) && (contact->context == context)) | 814 | if ((contact) && (contact->context == context)) |
786 | contact->context = NULL; | 815 | contact->context = NULL; |
787 | 816 | ||
788 | context->contact = NULL; | 817 | context->contact = NULL; |
789 | } | 818 | } |
@@ -804,14 +833,14 @@ setup_group: | |||
804 | group_publish(group); | 833 | group_publish(group); |
805 | 834 | ||
806 | if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put( | 835 | if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put( |
807 | handle->groups, key, group, | 836 | handle->groups, key, group, |
808 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 837 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
809 | { | 838 | { |
810 | handle_send_internal_message( | 839 | handle_send_internal_message( |
811 | handle, | 840 | handle, |
812 | context, | 841 | context, |
813 | GNUNET_CHAT_FLAG_UPDATE, | 842 | GNUNET_CHAT_FLAG_UPDATE, |
814 | NULL | 843 | NULL |
815 | ); | 844 | ); |
816 | 845 | ||
817 | context_write_records(context); | 846 | context_write_records(context); |
@@ -827,7 +856,7 @@ setup_group: | |||
827 | 856 | ||
828 | struct GNUNET_CHAT_Contact* | 857 | struct GNUNET_CHAT_Contact* |
829 | handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, | 858 | handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, |
830 | const struct GNUNET_MESSENGER_Contact *contact) | 859 | const struct GNUNET_MESSENGER_Contact *contact) |
831 | { | 860 | { |
832 | GNUNET_assert((handle) && (handle->contacts) && (contact)); | 861 | GNUNET_assert((handle) && (handle->contacts) && (contact)); |
833 | 862 | ||
@@ -835,13 +864,13 @@ handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, | |||
835 | util_shorthash_from_member(contact, &shorthash); | 864 | util_shorthash_from_member(contact, &shorthash); |
836 | 865 | ||
837 | return GNUNET_CONTAINER_multishortmap_get( | 866 | return GNUNET_CONTAINER_multishortmap_get( |
838 | handle->contacts, &shorthash | 867 | handle->contacts, &shorthash |
839 | ); | 868 | ); |
840 | } | 869 | } |
841 | 870 | ||
842 | struct GNUNET_CHAT_Group* | 871 | struct GNUNET_CHAT_Group* |
843 | handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, | 872 | handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, |
844 | const struct GNUNET_MESSENGER_Room *room) | 873 | const struct GNUNET_MESSENGER_Room *room) |
845 | { | 874 | { |
846 | GNUNET_assert((handle) && (handle->groups) && (room)); | 875 | GNUNET_assert((handle) && (handle->groups) && (room)); |
847 | 876 | ||
@@ -851,15 +880,15 @@ handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, | |||
851 | return NULL; | 880 | return NULL; |
852 | 881 | ||
853 | return GNUNET_CONTAINER_multihashmap_get( | 882 | return GNUNET_CONTAINER_multihashmap_get( |
854 | handle->groups, key | 883 | handle->groups, key |
855 | ); | 884 | ); |
856 | } | 885 | } |
857 | 886 | ||
858 | struct GNUNET_CHAT_Context* | 887 | struct GNUNET_CHAT_Context* |
859 | handle_process_records (struct GNUNET_CHAT_Handle *handle, | 888 | handle_process_records (struct GNUNET_CHAT_Handle *handle, |
860 | const char *label, | 889 | const char *label, |
861 | unsigned int count, | 890 | unsigned int count, |
862 | const struct GNUNET_GNSRECORD_Data *data) | 891 | const struct GNUNET_GNSRECORD_Data *data) |
863 | { | 892 | { |
864 | GNUNET_assert((handle) && (data)); | 893 | GNUNET_assert((handle) && (data)); |
865 | 894 | ||
@@ -885,8 +914,8 @@ handle_process_records (struct GNUNET_CHAT_Handle *handle, | |||
885 | return NULL; | 914 | return NULL; |
886 | 915 | ||
887 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( | 916 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( |
888 | handle->contexts, | 917 | handle->contexts, |
889 | &(record->key) | 918 | &(record->key) |
890 | ); | 919 | ); |
891 | 920 | ||
892 | if (context) | 921 | if (context) |
@@ -896,9 +925,9 @@ handle_process_records (struct GNUNET_CHAT_Handle *handle, | |||
896 | } | 925 | } |
897 | 926 | ||
898 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room( | 927 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room( |
899 | handle->messenger, | 928 | handle->messenger, |
900 | &(record->door), | 929 | &(record->door), |
901 | &(record->key) | 930 | &(record->key) |
902 | ); | 931 | ); |
903 | 932 | ||
904 | if (!room) | 933 | if (!room) |
diff --git a/src/gnunet_chat_handle.h b/src/gnunet_chat_handle.h index 4bc3f5a..0ac3bc8 100644 --- a/src/gnunet_chat_handle.h +++ b/src/gnunet_chat_handle.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 |
@@ -134,8 +134,8 @@ struct GNUNET_CHAT_Handle | |||
134 | */ | 134 | */ |
135 | struct GNUNET_CHAT_Handle* | 135 | struct GNUNET_CHAT_Handle* |
136 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | 136 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, |
137 | GNUNET_CHAT_ContextMessageCallback msg_cb, | 137 | GNUNET_CHAT_ContextMessageCallback msg_cb, |
138 | void *msg_cls); | 138 | void *msg_cls); |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Updates the string representation of the public key from | 141 | * Updates the string representation of the public key from |
@@ -163,7 +163,7 @@ handle_destroy (struct GNUNET_CHAT_Handle *handle); | |||
163 | */ | 163 | */ |
164 | void | 164 | void |
165 | handle_connect (struct GNUNET_CHAT_Handle *handle, | 165 | handle_connect (struct GNUNET_CHAT_Handle *handle, |
166 | const struct GNUNET_CHAT_Account *account); | 166 | const struct GNUNET_CHAT_Account *account); |
167 | 167 | ||
168 | /** | 168 | /** |
169 | * Disconnects a given chat <i>handle</i> from its current | 169 | * Disconnects a given chat <i>handle</i> from its current |
@@ -184,7 +184,7 @@ handle_disconnect (struct GNUNET_CHAT_Handle *handle); | |||
184 | */ | 184 | */ |
185 | int | 185 | int |
186 | handle_create_account (struct GNUNET_CHAT_Handle *handle, | 186 | handle_create_account (struct GNUNET_CHAT_Handle *handle, |
187 | const char *name); | 187 | const char *name); |
188 | 188 | ||
189 | /** | 189 | /** |
190 | * Enqueues a deletion for a chat account with a specific | 190 | * Enqueues a deletion for a chat account with a specific |
@@ -196,7 +196,7 @@ handle_create_account (struct GNUNET_CHAT_Handle *handle, | |||
196 | */ | 196 | */ |
197 | int | 197 | int |
198 | handle_delete_account (struct GNUNET_CHAT_Handle *handle, | 198 | handle_delete_account (struct GNUNET_CHAT_Handle *handle, |
199 | const char *name); | 199 | const char *name); |
200 | 200 | ||
201 | /** | 201 | /** |
202 | * Renames a chat account with a specific <i>old_name</i> | 202 | * Renames a chat account with a specific <i>old_name</i> |
@@ -210,8 +210,8 @@ handle_delete_account (struct GNUNET_CHAT_Handle *handle, | |||
210 | */ | 210 | */ |
211 | int | 211 | int |
212 | handle_rename_account (struct GNUNET_CHAT_Handle *handle, | 212 | handle_rename_account (struct GNUNET_CHAT_Handle *handle, |
213 | const char *old_name, | 213 | const char *old_name, |
214 | const char *new_name); | 214 | const char *new_name); |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * Returns the main directory path to store information | 217 | * Returns the main directory path to store information |
@@ -256,9 +256,9 @@ handle_get_key (const struct GNUNET_CHAT_Handle *handle); | |||
256 | */ | 256 | */ |
257 | void | 257 | void |
258 | handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, | 258 | handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, |
259 | struct GNUNET_CHAT_Context *context, | 259 | struct GNUNET_CHAT_Context *context, |
260 | enum GNUNET_CHAT_MessageFlag flag, | 260 | enum GNUNET_CHAT_MessageFlag flag, |
261 | const char *warning); | 261 | const char *warning); |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Sends a name message to a messenger <i>room</i> with | 264 | * Sends a name message to a messenger <i>room</i> with |
@@ -269,7 +269,7 @@ handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, | |||
269 | */ | 269 | */ |
270 | void | 270 | void |
271 | handle_send_room_name (struct GNUNET_CHAT_Handle *handle, | 271 | handle_send_room_name (struct GNUNET_CHAT_Handle *handle, |
272 | struct GNUNET_MESSENGER_Room *room); | 272 | struct GNUNET_MESSENGER_Room *room); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | * Checks a given chat <i>handle</i> for any chat context | 275 | * Checks a given chat <i>handle</i> for any chat context |
@@ -282,7 +282,7 @@ handle_send_room_name (struct GNUNET_CHAT_Handle *handle, | |||
282 | */ | 282 | */ |
283 | int | 283 | int |
284 | handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, | 284 | handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, |
285 | struct GNUNET_MESSENGER_Room *room); | 285 | struct GNUNET_MESSENGER_Room *room); |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * Returns the chat contact registered for a given messenger | 288 | * Returns the chat contact registered for a given messenger |
@@ -294,7 +294,7 @@ handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, | |||
294 | */ | 294 | */ |
295 | struct GNUNET_CHAT_Contact* | 295 | struct GNUNET_CHAT_Contact* |
296 | handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, | 296 | handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, |
297 | const struct GNUNET_MESSENGER_Contact *contact); | 297 | const struct GNUNET_MESSENGER_Contact *contact); |
298 | 298 | ||
299 | /** | 299 | /** |
300 | * Returns the chat group registered for a given messenger | 300 | * Returns the chat group registered for a given messenger |
@@ -306,7 +306,7 @@ handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, | |||
306 | */ | 306 | */ |
307 | struct GNUNET_CHAT_Group* | 307 | struct GNUNET_CHAT_Group* |
308 | handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, | 308 | handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, |
309 | const struct GNUNET_MESSENGER_Room *room); | 309 | const struct GNUNET_MESSENGER_Room *room); |
310 | 310 | ||
311 | /** | 311 | /** |
312 | * Processes the <i>data</i> of records under a given | 312 | * Processes the <i>data</i> of records under a given |
@@ -322,8 +322,8 @@ handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, | |||
322 | */ | 322 | */ |
323 | struct GNUNET_CHAT_Context* | 323 | struct GNUNET_CHAT_Context* |
324 | handle_process_records (struct GNUNET_CHAT_Handle *handle, | 324 | handle_process_records (struct GNUNET_CHAT_Handle *handle, |
325 | const char *label, | 325 | const char *label, |
326 | unsigned int count, | 326 | unsigned int count, |
327 | const struct GNUNET_GNSRECORD_Data *data); | 327 | const struct GNUNET_GNSRECORD_Data *data); |
328 | 328 | ||
329 | #endif /* GNUNET_CHAT_HANDLE_H_ */ | 329 | #endif /* GNUNET_CHAT_HANDLE_H_ */ |
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c index e0d0df8..5df5bed 100644 --- a/src/gnunet_chat_handle_intern.c +++ b/src/gnunet_chat_handle_intern.c | |||
@@ -57,7 +57,7 @@ on_handle_shutdown(void *cls) | |||
57 | 57 | ||
58 | void | 58 | void |
59 | on_handle_arm_connection(void *cls, | 59 | on_handle_arm_connection(void *cls, |
60 | int connected) | 60 | int connected) |
61 | { | 61 | { |
62 | struct GNUNET_CHAT_Handle *chat = cls; | 62 | struct GNUNET_CHAT_Handle *chat = cls; |
63 | 63 | ||
@@ -71,15 +71,15 @@ on_handle_arm_connection(void *cls, | |||
71 | ); | 71 | ); |
72 | 72 | ||
73 | GNUNET_ARM_request_service_start( | 73 | GNUNET_ARM_request_service_start( |
74 | chat->arm, gnunet_service_name_messenger, | 74 | chat->arm, gnunet_service_name_messenger, |
75 | GNUNET_OS_INHERIT_STD_NONE, | 75 | GNUNET_OS_INHERIT_STD_NONE, |
76 | NULL, NULL | 76 | NULL, NULL |
77 | ); | 77 | ); |
78 | 78 | ||
79 | GNUNET_ARM_request_service_start( | 79 | GNUNET_ARM_request_service_start( |
80 | chat->arm, gnunet_service_name_fs, | 80 | chat->arm, gnunet_service_name_fs, |
81 | GNUNET_OS_INHERIT_STD_NONE, | 81 | GNUNET_OS_INHERIT_STD_NONE, |
82 | NULL, NULL | 82 | NULL, NULL |
83 | ); | 83 | ); |
84 | 84 | ||
85 | GNUNET_ARM_request_service_start( | 85 | GNUNET_ARM_request_service_start( |
@@ -95,16 +95,16 @@ on_handle_arm_connection(void *cls, | |||
95 | ); | 95 | ); |
96 | } else { | 96 | } else { |
97 | GNUNET_ARM_request_service_start( | 97 | GNUNET_ARM_request_service_start( |
98 | chat->arm, gnunet_service_name_arm, | 98 | chat->arm, gnunet_service_name_arm, |
99 | GNUNET_OS_INHERIT_STD_NONE, | 99 | GNUNET_OS_INHERIT_STD_NONE, |
100 | NULL, NULL | 100 | NULL, NULL |
101 | ); | 101 | ); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | void* | 105 | void* |
106 | notify_handle_fs_progress(void* cls, | 106 | notify_handle_fs_progress(void* cls, |
107 | const struct GNUNET_FS_ProgressInfo* info) | 107 | const struct GNUNET_FS_ProgressInfo* info) |
108 | { | 108 | { |
109 | struct GNUNET_CHAT_Handle *chat = cls; | 109 | struct GNUNET_CHAT_Handle *chat = cls; |
110 | 110 | ||
@@ -118,9 +118,9 @@ notify_handle_fs_progress(void* cls, | |||
118 | struct GNUNET_CHAT_File *file = info->value.publish.cctx; | 118 | struct GNUNET_CHAT_File *file = info->value.publish.cctx; |
119 | 119 | ||
120 | file_update_upload( | 120 | file_update_upload( |
121 | file, | 121 | file, |
122 | 0, | 122 | 0, |
123 | info->value.publish.size | 123 | info->value.publish.size |
124 | ); | 124 | ); |
125 | 125 | ||
126 | return file; | 126 | return file; |
@@ -128,9 +128,9 @@ notify_handle_fs_progress(void* cls, | |||
128 | struct GNUNET_CHAT_File *file = info->value.publish.cctx; | 128 | struct GNUNET_CHAT_File *file = info->value.publish.cctx; |
129 | 129 | ||
130 | file_update_upload( | 130 | file_update_upload( |
131 | file, | 131 | file, |
132 | info->value.publish.completed, | 132 | info->value.publish.completed, |
133 | info->value.publish.size | 133 | info->value.publish.size |
134 | ); | 134 | ); |
135 | 135 | ||
136 | return file; | 136 | return file; |
@@ -138,13 +138,13 @@ notify_handle_fs_progress(void* cls, | |||
138 | struct GNUNET_CHAT_File *file = info->value.publish.cctx; | 138 | struct GNUNET_CHAT_File *file = info->value.publish.cctx; |
139 | 139 | ||
140 | file->uri = GNUNET_FS_uri_dup( | 140 | file->uri = GNUNET_FS_uri_dup( |
141 | info->value.publish.specifics.completed.chk_uri | 141 | info->value.publish.specifics.completed.chk_uri |
142 | ); | 142 | ); |
143 | 143 | ||
144 | file_update_upload( | 144 | file_update_upload( |
145 | file, | 145 | file, |
146 | info->value.publish.size, | 146 | info->value.publish.size, |
147 | info->value.publish.size | 147 | info->value.publish.size |
148 | ); | 148 | ); |
149 | 149 | ||
150 | file->publish = NULL; | 150 | file->publish = NULL; |
@@ -155,9 +155,9 @@ notify_handle_fs_progress(void* cls, | |||
155 | struct GNUNET_CHAT_File *file = info->value.download.cctx; | 155 | struct GNUNET_CHAT_File *file = info->value.download.cctx; |
156 | 156 | ||
157 | file_update_download( | 157 | file_update_download( |
158 | file, | 158 | file, |
159 | 0, | 159 | 0, |
160 | info->value.download.size | 160 | info->value.download.size |
161 | ); | 161 | ); |
162 | 162 | ||
163 | return file; | 163 | return file; |
@@ -169,9 +169,9 @@ notify_handle_fs_progress(void* cls, | |||
169 | struct GNUNET_CHAT_File *file = info->value.download.cctx; | 169 | struct GNUNET_CHAT_File *file = info->value.download.cctx; |
170 | 170 | ||
171 | file_update_download( | 171 | file_update_download( |
172 | file, | 172 | file, |
173 | info->value.download.completed, | 173 | info->value.download.completed, |
174 | info->value.download.size | 174 | info->value.download.size |
175 | ); | 175 | ); |
176 | 176 | ||
177 | return file; | 177 | return file; |
@@ -179,9 +179,9 @@ notify_handle_fs_progress(void* cls, | |||
179 | struct GNUNET_CHAT_File *file = info->value.download.cctx; | 179 | struct GNUNET_CHAT_File *file = info->value.download.cctx; |
180 | 180 | ||
181 | file_update_download( | 181 | file_update_download( |
182 | file, | 182 | file, |
183 | info->value.download.size, | 183 | info->value.download.size, |
184 | info->value.download.size | 184 | info->value.download.size |
185 | ); | 185 | ); |
186 | 186 | ||
187 | file->download = NULL; | 187 | file->download = NULL; |
@@ -192,9 +192,9 @@ notify_handle_fs_progress(void* cls, | |||
192 | struct GNUNET_CHAT_File *file = info->value.unindex.cctx; | 192 | struct GNUNET_CHAT_File *file = info->value.unindex.cctx; |
193 | 193 | ||
194 | file_update_unindex( | 194 | file_update_unindex( |
195 | file, | 195 | file, |
196 | 0, | 196 | 0, |
197 | info->value.unindex.size | 197 | info->value.unindex.size |
198 | ); | 198 | ); |
199 | 199 | ||
200 | return file; | 200 | return file; |
@@ -202,9 +202,9 @@ notify_handle_fs_progress(void* cls, | |||
202 | struct GNUNET_CHAT_File *file = info->value.unindex.cctx; | 202 | struct GNUNET_CHAT_File *file = info->value.unindex.cctx; |
203 | 203 | ||
204 | file_update_unindex( | 204 | file_update_unindex( |
205 | file, | 205 | file, |
206 | info->value.unindex.completed, | 206 | info->value.unindex.completed, |
207 | info->value.unindex.size | 207 | info->value.unindex.size |
208 | ); | 208 | ); |
209 | 209 | ||
210 | return file; | 210 | return file; |
@@ -212,9 +212,9 @@ notify_handle_fs_progress(void* cls, | |||
212 | struct GNUNET_CHAT_File *file = info->value.unindex.cctx; | 212 | struct GNUNET_CHAT_File *file = info->value.unindex.cctx; |
213 | 213 | ||
214 | file_update_unindex( | 214 | file_update_unindex( |
215 | file, | 215 | file, |
216 | info->value.unindex.size, | 216 | info->value.unindex.size, |
217 | info->value.unindex.size | 217 | info->value.unindex.size |
218 | ); | 218 | ); |
219 | 219 | ||
220 | file->unindex = NULL; | 220 | file->unindex = NULL; |
@@ -225,7 +225,7 @@ notify_handle_fs_progress(void* cls, | |||
225 | 225 | ||
226 | char *filename; | 226 | char *filename; |
227 | util_get_filename ( | 227 | util_get_filename ( |
228 | directory, "files", &(file->hash), &filename | 228 | directory, "files", &(file->hash), &filename |
229 | ); | 229 | ); |
230 | 230 | ||
231 | if (GNUNET_YES == GNUNET_DISK_file_test_read(filename)) | 231 | if (GNUNET_YES == GNUNET_DISK_file_test_read(filename)) |
@@ -243,8 +243,8 @@ notify_handle_fs_progress(void* cls, | |||
243 | 243 | ||
244 | void | 244 | void |
245 | on_handle_gnunet_identity(void *cls, | 245 | on_handle_gnunet_identity(void *cls, |
246 | struct GNUNET_IDENTITY_Ego *ego, | 246 | struct GNUNET_IDENTITY_Ego *ego, |
247 | void **ctx, | 247 | void **ctx, |
248 | const char *name) | 248 | const char *name) |
249 | { | 249 | { |
250 | struct GNUNET_CHAT_Handle* handle = cls; | 250 | struct GNUNET_CHAT_Handle* handle = cls; |
@@ -270,34 +270,34 @@ on_handle_gnunet_identity(void *cls, | |||
270 | util_set_name_field(name, &(accounts->account->name)); | 270 | util_set_name_field(name, &(accounts->account->name)); |
271 | 271 | ||
272 | if (handle->current == accounts->account) | 272 | if (handle->current == accounts->account) |
273 | handle_send_internal_message( | 273 | handle_send_internal_message( |
274 | handle, | 274 | handle, |
275 | NULL, | 275 | NULL, |
276 | GNUNET_CHAT_FLAG_LOGIN, | 276 | GNUNET_CHAT_FLAG_LOGIN, |
277 | NULL | 277 | NULL |
278 | ); | 278 | ); |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | if (handle->current == accounts->account) | 282 | if (handle->current == accounts->account) |
283 | handle_disconnect(handle); | 283 | handle_disconnect(handle); |
284 | 284 | ||
285 | account_destroy(accounts->account); | 285 | account_destroy(accounts->account); |
286 | 286 | ||
287 | if (accounts->op) | 287 | if (accounts->op) |
288 | { | 288 | { |
289 | accounts->account = NULL; | 289 | accounts->account = NULL; |
290 | goto send_refresh; | 290 | goto send_refresh; |
291 | } | 291 | } |
292 | 292 | ||
293 | GNUNET_CONTAINER_DLL_remove( | 293 | GNUNET_CONTAINER_DLL_remove( |
294 | handle->accounts_head, | 294 | handle->accounts_head, |
295 | handle->accounts_tail, | 295 | handle->accounts_tail, |
296 | accounts | 296 | accounts |
297 | ); | 297 | ); |
298 | 298 | ||
299 | if (accounts->identifier) | 299 | if (accounts->identifier) |
300 | GNUNET_free(accounts->identifier); | 300 | GNUNET_free(accounts->identifier); |
301 | 301 | ||
302 | GNUNET_free(accounts); | 302 | GNUNET_free(accounts); |
303 | } | 303 | } |
@@ -306,7 +306,7 @@ on_handle_gnunet_identity(void *cls, | |||
306 | 306 | ||
307 | check_matching_name: | 307 | check_matching_name: |
308 | if ((name) && (accounts->account->name) && | 308 | if ((name) && (accounts->account->name) && |
309 | (0 == strcmp(accounts->account->name, name))) | 309 | (0 == strcmp(accounts->account->name, name))) |
310 | { | 310 | { |
311 | accounts->account->ego = ego; | 311 | accounts->account->ego = ego; |
312 | goto send_refresh; | 312 | goto send_refresh; |
@@ -331,9 +331,9 @@ skip_account: | |||
331 | account_update_directory(accounts->account, handle->directory); | 331 | account_update_directory(accounts->account, handle->directory); |
332 | 332 | ||
333 | GNUNET_CONTAINER_DLL_insert_tail( | 333 | GNUNET_CONTAINER_DLL_insert_tail( |
334 | handle->accounts_head, | 334 | handle->accounts_head, |
335 | handle->accounts_tail, | 335 | handle->accounts_tail, |
336 | accounts | 336 | accounts |
337 | ); | 337 | ); |
338 | 338 | ||
339 | send_refresh: | 339 | send_refresh: |
@@ -342,21 +342,21 @@ send_refresh: | |||
342 | 342 | ||
343 | void | 343 | void |
344 | cb_account_creation (void *cls, | 344 | cb_account_creation (void *cls, |
345 | const struct GNUNET_CRYPTO_PrivateKey *key, | 345 | const struct GNUNET_CRYPTO_PrivateKey *key, |
346 | enum GNUNET_ErrorCode ec) | 346 | enum GNUNET_ErrorCode ec) |
347 | { | 347 | { |
348 | GNUNET_assert(cls); | 348 | GNUNET_assert(cls); |
349 | 349 | ||
350 | struct GNUNET_CHAT_InternalAccounts *accounts = ( | 350 | struct GNUNET_CHAT_InternalAccounts *accounts = ( |
351 | (struct GNUNET_CHAT_InternalAccounts*) cls | 351 | (struct GNUNET_CHAT_InternalAccounts*) cls |
352 | ); | 352 | ); |
353 | 353 | ||
354 | struct GNUNET_CHAT_Handle *handle = accounts->handle; | 354 | struct GNUNET_CHAT_Handle *handle = accounts->handle; |
355 | 355 | ||
356 | GNUNET_CONTAINER_DLL_remove( | 356 | GNUNET_CONTAINER_DLL_remove( |
357 | handle->accounts_head, | 357 | handle->accounts_head, |
358 | handle->accounts_tail, | 358 | handle->accounts_tail, |
359 | accounts | 359 | accounts |
360 | ); | 360 | ); |
361 | 361 | ||
362 | if (accounts->identifier) | 362 | if (accounts->identifier) |
@@ -381,20 +381,20 @@ cb_account_creation (void *cls, | |||
381 | 381 | ||
382 | void | 382 | void |
383 | cb_account_deletion (void *cls, | 383 | cb_account_deletion (void *cls, |
384 | enum GNUNET_ErrorCode ec) | 384 | enum GNUNET_ErrorCode ec) |
385 | { | 385 | { |
386 | GNUNET_assert(cls); | 386 | GNUNET_assert(cls); |
387 | 387 | ||
388 | struct GNUNET_CHAT_InternalAccounts *accounts = ( | 388 | struct GNUNET_CHAT_InternalAccounts *accounts = ( |
389 | (struct GNUNET_CHAT_InternalAccounts*) cls | 389 | (struct GNUNET_CHAT_InternalAccounts*) cls |
390 | ); | 390 | ); |
391 | 391 | ||
392 | struct GNUNET_CHAT_Handle *handle = accounts->handle; | 392 | struct GNUNET_CHAT_Handle *handle = accounts->handle; |
393 | 393 | ||
394 | GNUNET_CONTAINER_DLL_remove( | 394 | GNUNET_CONTAINER_DLL_remove( |
395 | handle->accounts_head, | 395 | handle->accounts_head, |
396 | handle->accounts_tail, | 396 | handle->accounts_tail, |
397 | accounts | 397 | accounts |
398 | ); | 398 | ); |
399 | 399 | ||
400 | if (accounts->identifier) | 400 | if (accounts->identifier) |
@@ -405,10 +405,10 @@ cb_account_deletion (void *cls, | |||
405 | if (GNUNET_EC_NONE != ec) | 405 | if (GNUNET_EC_NONE != ec) |
406 | { | 406 | { |
407 | handle_send_internal_message( | 407 | handle_send_internal_message( |
408 | handle, | 408 | handle, |
409 | NULL, | 409 | NULL, |
410 | GNUNET_CHAT_FLAG_WARNING, | 410 | GNUNET_CHAT_FLAG_WARNING, |
411 | GNUNET_ErrorCode_get_hint(ec) | 411 | GNUNET_ErrorCode_get_hint(ec) |
412 | ); | 412 | ); |
413 | 413 | ||
414 | return; | 414 | return; |
@@ -417,20 +417,20 @@ cb_account_deletion (void *cls, | |||
417 | 417 | ||
418 | void | 418 | void |
419 | cb_account_rename (void *cls, | 419 | cb_account_rename (void *cls, |
420 | enum GNUNET_ErrorCode ec) | 420 | enum GNUNET_ErrorCode ec) |
421 | { | 421 | { |
422 | GNUNET_assert(cls); | 422 | GNUNET_assert(cls); |
423 | 423 | ||
424 | struct GNUNET_CHAT_InternalAccounts *accounts = ( | 424 | struct GNUNET_CHAT_InternalAccounts *accounts = ( |
425 | (struct GNUNET_CHAT_InternalAccounts*) cls | 425 | (struct GNUNET_CHAT_InternalAccounts*) cls |
426 | ); | 426 | ); |
427 | 427 | ||
428 | struct GNUNET_CHAT_Handle *handle = accounts->handle; | 428 | struct GNUNET_CHAT_Handle *handle = accounts->handle; |
429 | 429 | ||
430 | GNUNET_CONTAINER_DLL_remove( | 430 | GNUNET_CONTAINER_DLL_remove( |
431 | handle->accounts_head, | 431 | handle->accounts_head, |
432 | handle->accounts_tail, | 432 | handle->accounts_tail, |
433 | accounts | 433 | accounts |
434 | ); | 434 | ); |
435 | 435 | ||
436 | if (accounts->identifier) | 436 | if (accounts->identifier) |
@@ -453,13 +453,13 @@ cb_account_rename (void *cls, | |||
453 | 453 | ||
454 | static void | 454 | static void |
455 | cb_account_update_completion (void *cls, | 455 | cb_account_update_completion (void *cls, |
456 | const struct GNUNET_CRYPTO_PrivateKey *key, | 456 | const struct GNUNET_CRYPTO_PrivateKey *key, |
457 | enum GNUNET_ErrorCode ec) | 457 | enum GNUNET_ErrorCode ec) |
458 | { | 458 | { |
459 | GNUNET_assert(cls); | 459 | GNUNET_assert(cls); |
460 | 460 | ||
461 | struct GNUNET_CHAT_InternalAccounts *accounts = ( | 461 | struct GNUNET_CHAT_InternalAccounts *accounts = ( |
462 | (struct GNUNET_CHAT_InternalAccounts*) cls | 462 | (struct GNUNET_CHAT_InternalAccounts*) cls |
463 | ); | 463 | ); |
464 | 464 | ||
465 | struct GNUNET_CHAT_Handle *handle = accounts->handle; | 465 | struct GNUNET_CHAT_Handle *handle = accounts->handle; |
@@ -472,12 +472,12 @@ cb_account_update_completion (void *cls, | |||
472 | 472 | ||
473 | void | 473 | void |
474 | cb_account_update (void *cls, | 474 | cb_account_update (void *cls, |
475 | enum GNUNET_ErrorCode ec) | 475 | enum GNUNET_ErrorCode ec) |
476 | { | 476 | { |
477 | GNUNET_assert(cls); | 477 | GNUNET_assert(cls); |
478 | 478 | ||
479 | struct GNUNET_CHAT_InternalAccounts *accounts = ( | 479 | struct GNUNET_CHAT_InternalAccounts *accounts = ( |
480 | (struct GNUNET_CHAT_InternalAccounts*) cls | 480 | (struct GNUNET_CHAT_InternalAccounts*) cls |
481 | ); | 481 | ); |
482 | 482 | ||
483 | struct GNUNET_CHAT_Handle *handle = accounts->handle; | 483 | struct GNUNET_CHAT_Handle *handle = accounts->handle; |
@@ -489,19 +489,19 @@ cb_account_update (void *cls, | |||
489 | } | 489 | } |
490 | 490 | ||
491 | accounts->op = GNUNET_IDENTITY_create( | 491 | accounts->op = GNUNET_IDENTITY_create( |
492 | handle->identity, | 492 | handle->identity, |
493 | accounts->identifier, | 493 | accounts->identifier, |
494 | NULL, | 494 | NULL, |
495 | GNUNET_PUBLIC_KEY_TYPE_ECDSA, | 495 | GNUNET_PUBLIC_KEY_TYPE_ECDSA, |
496 | cb_account_update_completion, | 496 | cb_account_update_completion, |
497 | accounts | 497 | accounts |
498 | ); | 498 | ); |
499 | } | 499 | } |
500 | 500 | ||
501 | int | 501 | int |
502 | intern_provide_contact_for_member(struct GNUNET_CHAT_Handle *handle, | 502 | intern_provide_contact_for_member(struct GNUNET_CHAT_Handle *handle, |
503 | const struct GNUNET_MESSENGER_Contact *member, | 503 | const struct GNUNET_MESSENGER_Contact *member, |
504 | struct GNUNET_CHAT_Context *context) | 504 | struct GNUNET_CHAT_Context *context) |
505 | { | 505 | { |
506 | GNUNET_assert((handle) && (handle->contacts)); | 506 | GNUNET_assert((handle) && (handle->contacts)); |
507 | 507 | ||
@@ -512,7 +512,7 @@ intern_provide_contact_for_member(struct GNUNET_CHAT_Handle *handle, | |||
512 | util_shorthash_from_member(member, &shorthash); | 512 | util_shorthash_from_member(member, &shorthash); |
513 | 513 | ||
514 | struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get( | 514 | struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get( |
515 | handle->contacts, &shorthash | 515 | handle->contacts, &shorthash |
516 | ); | 516 | ); |
517 | 517 | ||
518 | if (contact) | 518 | if (contact) |
@@ -556,7 +556,7 @@ struct GNUNET_CHAT_CheckHandleRoomMembers | |||
556 | 556 | ||
557 | int | 557 | int |
558 | check_handle_room_members (void* cls, | 558 | check_handle_room_members (void* cls, |
559 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, | 559 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, |
560 | const struct GNUNET_MESSENGER_Contact *member) | 560 | const struct GNUNET_MESSENGER_Contact *member) |
561 | { | 561 | { |
562 | struct GNUNET_CHAT_CheckHandleRoomMembers *check = cls; | 562 | struct GNUNET_CHAT_CheckHandleRoomMembers *check = cls; |
@@ -564,7 +564,7 @@ check_handle_room_members (void* cls, | |||
564 | GNUNET_assert((check) && (member)); | 564 | GNUNET_assert((check) && (member)); |
565 | 565 | ||
566 | const struct GNUNET_CRYPTO_PublicKey *member_key = ( | 566 | const struct GNUNET_CRYPTO_PublicKey *member_key = ( |
567 | GNUNET_MESSENGER_contact_get_key(member) | 567 | GNUNET_MESSENGER_contact_get_key(member) |
568 | ); | 568 | ); |
569 | 569 | ||
570 | if ((member_key) && (check->ignore_key) && | 570 | if ((member_key) && (check->ignore_key) && |
@@ -583,7 +583,7 @@ check_handle_room_members (void* cls, | |||
583 | 583 | ||
584 | int | 584 | int |
585 | scan_handle_room_members (void* cls, | 585 | scan_handle_room_members (void* cls, |
586 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, | 586 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, |
587 | const struct GNUNET_MESSENGER_Contact *member) | 587 | const struct GNUNET_MESSENGER_Contact *member) |
588 | { | 588 | { |
589 | struct GNUNET_CHAT_Handle *handle = cls; | 589 | struct GNUNET_CHAT_Handle *handle = cls; |
@@ -596,11 +596,11 @@ scan_handle_room_members (void* cls, | |||
596 | 596 | ||
597 | void | 597 | void |
598 | on_monitor_namestore_record(void *cls, | 598 | on_monitor_namestore_record(void *cls, |
599 | GNUNET_UNUSED const | 599 | GNUNET_UNUSED const |
600 | struct GNUNET_CRYPTO_PrivateKey *zone, | 600 | struct GNUNET_CRYPTO_PrivateKey *zone, |
601 | const char *label, | 601 | const char *label, |
602 | unsigned int count, | 602 | unsigned int count, |
603 | const struct GNUNET_GNSRECORD_Data *data) | 603 | const struct GNUNET_GNSRECORD_Data *data) |
604 | { | 604 | { |
605 | struct GNUNET_CHAT_Handle *chat = cls; | 605 | struct GNUNET_CHAT_Handle *chat = cls; |
606 | 606 | ||
@@ -622,10 +622,12 @@ on_handle_message_callback(void *cls) | |||
622 | { | 622 | { |
623 | struct GNUNET_CHAT_Message *message = (struct GNUNET_CHAT_Message*) cls; | 623 | struct GNUNET_CHAT_Message *message = (struct GNUNET_CHAT_Message*) cls; |
624 | 624 | ||
625 | GNUNET_assert((message) && | 625 | GNUNET_assert( |
626 | (message) && | ||
626 | (message->msg) && | 627 | (message->msg) && |
627 | (message->context) && | 628 | (message->context) && |
628 | (message->context->handle)); | 629 | (message->context->handle) |
630 | ); | ||
629 | 631 | ||
630 | message->task = NULL; | 632 | message->task = NULL; |
631 | 633 | ||
@@ -662,7 +664,7 @@ on_handle_message_callback(void *cls) | |||
662 | util_shorthash_from_member(sender, &shorthash); | 664 | util_shorthash_from_member(sender, &shorthash); |
663 | 665 | ||
664 | struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get( | 666 | struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get( |
665 | handle->contacts, &shorthash | 667 | handle->contacts, &shorthash |
666 | ); | 668 | ); |
667 | 669 | ||
668 | if ((!contact) || (GNUNET_YES == contact->blocked)) | 670 | if ((!contact) || (GNUNET_YES == contact->blocked)) |
@@ -673,18 +675,20 @@ on_handle_message_callback(void *cls) | |||
673 | 675 | ||
674 | void | 676 | void |
675 | on_handle_message (void *cls, | 677 | on_handle_message (void *cls, |
676 | struct GNUNET_MESSENGER_Room *room, | 678 | struct GNUNET_MESSENGER_Room *room, |
677 | const struct GNUNET_MESSENGER_Contact *sender, | 679 | const struct GNUNET_MESSENGER_Contact *sender, |
678 | const struct GNUNET_MESSENGER_Message *msg, | 680 | const struct GNUNET_MESSENGER_Message *msg, |
679 | const struct GNUNET_HashCode *hash, | 681 | const struct GNUNET_HashCode *hash, |
680 | enum GNUNET_MESSENGER_MessageFlags flags) | 682 | enum GNUNET_MESSENGER_MessageFlags flags) |
681 | { | 683 | { |
682 | struct GNUNET_CHAT_Handle *handle = cls; | 684 | struct GNUNET_CHAT_Handle *handle = cls; |
683 | 685 | ||
684 | GNUNET_assert((handle) && | 686 | GNUNET_assert( |
687 | (handle) && | ||
685 | (room) && | 688 | (room) && |
686 | (msg) && | 689 | (msg) && |
687 | (hash)); | 690 | (hash) |
691 | ); | ||
688 | 692 | ||
689 | if ((handle->destruction) || | 693 | if ((handle->destruction) || |
690 | (GNUNET_OK != handle_request_context_by_room(handle, room))) | 694 | (GNUNET_OK != handle_request_context_by_room(handle, room))) |
@@ -700,25 +704,25 @@ on_handle_message (void *cls, | |||
700 | return; | 704 | return; |
701 | 705 | ||
702 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( | 706 | struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get( |
703 | handle->contexts, GNUNET_MESSENGER_room_get_key(room) | 707 | handle->contexts, GNUNET_MESSENGER_room_get_key(room) |
704 | ); | 708 | ); |
705 | 709 | ||
706 | const struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_ntoh( | 710 | const struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_ntoh( |
707 | msg->header.timestamp | 711 | msg->header.timestamp |
708 | ); | 712 | ); |
709 | 713 | ||
710 | struct GNUNET_ShortHashCode shorthash; | 714 | struct GNUNET_ShortHashCode shorthash; |
711 | util_shorthash_from_member(sender, &shorthash); | 715 | util_shorthash_from_member(sender, &shorthash); |
712 | 716 | ||
713 | struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get( | 717 | struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get( |
714 | handle->contacts, &shorthash | 718 | handle->contacts, &shorthash |
715 | ); | 719 | ); |
716 | 720 | ||
717 | if (flags & GNUNET_MESSENGER_FLAG_SENT) | 721 | if (flags & GNUNET_MESSENGER_FLAG_SENT) |
718 | contact->owned = GNUNET_YES; | 722 | contact->owned = GNUNET_YES; |
719 | 723 | ||
720 | struct GNUNET_TIME_Absolute *time = GNUNET_CONTAINER_multishortmap_get( | 724 | struct GNUNET_TIME_Absolute *time = GNUNET_CONTAINER_multishortmap_get( |
721 | context->timestamps, &shorthash | 725 | context->timestamps, &shorthash |
722 | ); | 726 | ); |
723 | 727 | ||
724 | if (!time) | 728 | if (!time) |
@@ -727,14 +731,14 @@ on_handle_message (void *cls, | |||
727 | *time = timestamp; | 731 | *time = timestamp; |
728 | 732 | ||
729 | if (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put( | 733 | if (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put( |
730 | context->timestamps, &shorthash, time, | 734 | context->timestamps, &shorthash, time, |
731 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 735 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
732 | GNUNET_free(time); | 736 | GNUNET_free(time); |
733 | } | 737 | } |
734 | else | 738 | else |
735 | { | 739 | { |
736 | struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference( | 740 | struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference( |
737 | timestamp, *time | 741 | timestamp, *time |
738 | ); | 742 | ); |
739 | 743 | ||
740 | if (GNUNET_TIME_relative_get_zero_().rel_value_us == delta.rel_value_us) | 744 | if (GNUNET_TIME_relative_get_zero_().rel_value_us == delta.rel_value_us) |
@@ -742,7 +746,7 @@ on_handle_message (void *cls, | |||
742 | } | 746 | } |
743 | 747 | ||
744 | struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get( | 748 | struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get( |
745 | context->messages, hash | 749 | context->messages, hash |
746 | ); | 750 | ); |
747 | 751 | ||
748 | if (message) | 752 | if (message) |
@@ -762,20 +766,20 @@ on_handle_message (void *cls, | |||
762 | case GNUNET_MESSENGER_KIND_INVITE: | 766 | case GNUNET_MESSENGER_KIND_INVITE: |
763 | { | 767 | { |
764 | struct GNUNET_CHAT_Invitation *invitation = invitation_create_from_message( | 768 | struct GNUNET_CHAT_Invitation *invitation = invitation_create_from_message( |
765 | context, &(msg->body.invite) | 769 | context, &(msg->body.invite) |
766 | ); | 770 | ); |
767 | 771 | ||
768 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( | 772 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( |
769 | context->invites, hash, invitation, | 773 | context->invites, hash, invitation, |
770 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 774 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
771 | invitation_destroy(invitation); | 775 | invitation_destroy(invitation); |
772 | break; | 776 | break; |
773 | } | 777 | } |
774 | case GNUNET_MESSENGER_KIND_FILE: | 778 | case GNUNET_MESSENGER_KIND_FILE: |
775 | { | 779 | { |
776 | GNUNET_CONTAINER_multihashmap_put( | 780 | GNUNET_CONTAINER_multihashmap_put( |
777 | context->files, hash, NULL, | 781 | context->files, hash, NULL, |
778 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST | 782 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST |
779 | ); | 783 | ); |
780 | 784 | ||
781 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( | 785 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( |
@@ -786,28 +790,28 @@ on_handle_message (void *cls, | |||
786 | break; | 790 | break; |
787 | 791 | ||
788 | file = file_create_from_message( | 792 | file = file_create_from_message( |
789 | context->handle, &(msg->body.file) | 793 | context->handle, &(msg->body.file) |
790 | ); | 794 | ); |
791 | 795 | ||
792 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( | 796 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( |
793 | context->handle->files, &(file->hash), file, | 797 | context->handle->files, &(file->hash), file, |
794 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 798 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
795 | file_destroy(file); | 799 | file_destroy(file); |
796 | break; | 800 | break; |
797 | } | 801 | } |
798 | case GNUNET_MESSENGER_KIND_DELETE: | 802 | case GNUNET_MESSENGER_KIND_DELETE: |
799 | { | 803 | { |
800 | struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh( | 804 | struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh( |
801 | msg->body.deletion.delay | 805 | msg->body.deletion.delay |
802 | ); | 806 | ); |
803 | 807 | ||
804 | task = GNUNET_SCHEDULER_add_delayed( | 808 | task = GNUNET_SCHEDULER_add_delayed( |
805 | GNUNET_TIME_absolute_get_difference( | 809 | GNUNET_TIME_absolute_get_difference( |
806 | GNUNET_TIME_absolute_get(), | 810 | GNUNET_TIME_absolute_get(), |
807 | GNUNET_TIME_absolute_add(timestamp, delay) | 811 | GNUNET_TIME_absolute_add(timestamp, delay) |
808 | ), | 812 | ), |
809 | on_handle_message_callback, | 813 | on_handle_message_callback, |
810 | message | 814 | message |
811 | ); | 815 | ); |
812 | break; | 816 | break; |
813 | } | 817 | } |
@@ -834,8 +838,8 @@ on_handle_message (void *cls, | |||
834 | 838 | ||
835 | int | 839 | int |
836 | it_destroy_handle_groups (GNUNET_UNUSED void *cls, | 840 | it_destroy_handle_groups (GNUNET_UNUSED void *cls, |
837 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 841 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
838 | void *value) | 842 | void *value) |
839 | { | 843 | { |
840 | GNUNET_assert(value); | 844 | GNUNET_assert(value); |
841 | 845 | ||
@@ -846,8 +850,8 @@ it_destroy_handle_groups (GNUNET_UNUSED void *cls, | |||
846 | 850 | ||
847 | int | 851 | int |
848 | it_destroy_handle_contacts (GNUNET_UNUSED void *cls, | 852 | it_destroy_handle_contacts (GNUNET_UNUSED void *cls, |
849 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, | 853 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, |
850 | void *value) | 854 | void *value) |
851 | { | 855 | { |
852 | GNUNET_assert(value); | 856 | GNUNET_assert(value); |
853 | 857 | ||
@@ -858,8 +862,8 @@ it_destroy_handle_contacts (GNUNET_UNUSED void *cls, | |||
858 | 862 | ||
859 | int | 863 | int |
860 | it_destroy_handle_contexts (GNUNET_UNUSED void *cls, | 864 | it_destroy_handle_contexts (GNUNET_UNUSED void *cls, |
861 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 865 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
862 | void *value) | 866 | void *value) |
863 | { | 867 | { |
864 | GNUNET_assert(value); | 868 | GNUNET_assert(value); |
865 | 869 | ||
@@ -870,8 +874,8 @@ it_destroy_handle_contexts (GNUNET_UNUSED void *cls, | |||
870 | 874 | ||
871 | int | 875 | int |
872 | it_destroy_handle_files (GNUNET_UNUSED void *cls, | 876 | it_destroy_handle_files (GNUNET_UNUSED void *cls, |
873 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 877 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
874 | void *value) | 878 | void *value) |
875 | { | 879 | { |
876 | GNUNET_assert(value); | 880 | GNUNET_assert(value); |
877 | 881 | ||
diff --git a/src/gnunet_chat_invitation.c b/src/gnunet_chat_invitation.c index 40c5769..4c39462 100644 --- a/src/gnunet_chat_invitation.c +++ b/src/gnunet_chat_invitation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021 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 |
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | struct GNUNET_CHAT_Invitation* | 27 | struct GNUNET_CHAT_Invitation* |
28 | invitation_create_from_message (struct GNUNET_CHAT_Context *context, | 28 | invitation_create_from_message (struct GNUNET_CHAT_Context *context, |
29 | const struct GNUNET_MESSENGER_MessageInvite *message) | 29 | const struct GNUNET_MESSENGER_MessageInvite *message) |
30 | { | 30 | { |
31 | GNUNET_assert((context) && (message)); | 31 | GNUNET_assert((context) && (message)); |
32 | 32 | ||
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index 62af024..f2dd839 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -1742,7 +1742,7 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
1742 | if ((!file) || (!(file->uri))) | 1742 | if ((!file) || (!(file->uri))) |
1743 | return GNUNET_SYSERR; | 1743 | return GNUNET_SYSERR; |
1744 | 1744 | ||
1745 | if (file->download)a | 1745 | if (file->download) |
1746 | { | 1746 | { |
1747 | file_bind_downlaod(file, callback, cls); | 1747 | file_bind_downlaod(file, callback, cls); |
1748 | 1748 | ||
diff --git a/src/gnunet_chat_lib_intern.c b/src/gnunet_chat_lib_intern.c index 5b35327..b977509 100644 --- a/src/gnunet_chat_lib_intern.c +++ b/src/gnunet_chat_lib_intern.c | |||
@@ -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 |
@@ -45,13 +45,13 @@ task_handle_destruction (void *cls) | |||
45 | if (accounts) | 45 | if (accounts) |
46 | { | 46 | { |
47 | handle->destruction = GNUNET_SCHEDULER_add_at_with_priority( | 47 | handle->destruction = GNUNET_SCHEDULER_add_at_with_priority( |
48 | GNUNET_TIME_absolute_add( | 48 | GNUNET_TIME_absolute_add( |
49 | GNUNET_TIME_absolute_get(), | 49 | GNUNET_TIME_absolute_get(), |
50 | GNUNET_TIME_relative_get_millisecond_() | 50 | GNUNET_TIME_relative_get_millisecond_() |
51 | ), | 51 | ), |
52 | GNUNET_SCHEDULER_PRIORITY_IDLE, | 52 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
53 | task_handle_destruction, | 53 | task_handle_destruction, |
54 | handle | 54 | handle |
55 | ); | 55 | ); |
56 | 56 | ||
57 | return; | 57 | return; |
@@ -63,8 +63,8 @@ task_handle_destruction (void *cls) | |||
63 | 63 | ||
64 | void | 64 | void |
65 | cb_lobby_lookup (void *cls, | 65 | cb_lobby_lookup (void *cls, |
66 | uint32_t count, | 66 | uint32_t count, |
67 | const struct GNUNET_GNSRECORD_Data *data) | 67 | const struct GNUNET_GNSRECORD_Data *data) |
68 | { | 68 | { |
69 | GNUNET_assert(cls); | 69 | GNUNET_assert(cls); |
70 | 70 | ||
@@ -74,10 +74,10 @@ cb_lobby_lookup (void *cls, | |||
74 | goto drop_lookup; | 74 | goto drop_lookup; |
75 | 75 | ||
76 | struct GNUNET_CHAT_Context *context = handle_process_records( | 76 | struct GNUNET_CHAT_Context *context = handle_process_records( |
77 | lookups->handle, | 77 | lookups->handle, |
78 | lookups->uri->label, | 78 | lookups->uri->label, |
79 | count, | 79 | count, |
80 | data | 80 | data |
81 | ); | 81 | ); |
82 | 82 | ||
83 | if (context) | 83 | if (context) |
@@ -106,8 +106,8 @@ struct GNUNET_CHAT_HandleIterateContacts | |||
106 | 106 | ||
107 | int | 107 | int |
108 | it_handle_iterate_contacts (void *cls, | 108 | it_handle_iterate_contacts (void *cls, |
109 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, | 109 | GNUNET_UNUSED const struct GNUNET_ShortHashCode *key, |
110 | void *value) | 110 | void *value) |
111 | { | 111 | { |
112 | GNUNET_assert((cls) && (value)); | 112 | GNUNET_assert((cls) && (value)); |
113 | 113 | ||
@@ -130,8 +130,8 @@ struct GNUNET_CHAT_HandleIterateGroups | |||
130 | 130 | ||
131 | int | 131 | int |
132 | it_handle_iterate_groups (void *cls, | 132 | it_handle_iterate_groups (void *cls, |
133 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 133 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
134 | void *value) | 134 | void *value) |
135 | { | 135 | { |
136 | GNUNET_assert((cls) && (value)); | 136 | GNUNET_assert((cls) && (value)); |
137 | 137 | ||
@@ -153,8 +153,8 @@ struct GNUNET_CHAT_RoomFindContact | |||
153 | 153 | ||
154 | int | 154 | int |
155 | it_room_find_contact (void *cls, | 155 | it_room_find_contact (void *cls, |
156 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, | 156 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, |
157 | const struct GNUNET_MESSENGER_Contact *member) | 157 | const struct GNUNET_MESSENGER_Contact *member) |
158 | { | 158 | { |
159 | GNUNET_assert((cls) && (member)); | 159 | GNUNET_assert((cls) && (member)); |
160 | 160 | ||
@@ -181,7 +181,7 @@ struct GNUNET_CHAT_GroupIterateContacts | |||
181 | 181 | ||
182 | int | 182 | int |
183 | it_group_iterate_contacts (void* cls, | 183 | it_group_iterate_contacts (void* cls, |
184 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, | 184 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, |
185 | const struct GNUNET_MESSENGER_Contact *member) | 185 | const struct GNUNET_MESSENGER_Contact *member) |
186 | { | 186 | { |
187 | GNUNET_assert((cls) && (member)); | 187 | GNUNET_assert((cls) && (member)); |
@@ -192,7 +192,7 @@ it_group_iterate_contacts (void* cls, | |||
192 | return GNUNET_YES; | 192 | return GNUNET_YES; |
193 | 193 | ||
194 | return it->cb(it->cls, it->group, handle_get_contact_from_messenger( | 194 | return it->cb(it->cls, it->group, handle_get_contact_from_messenger( |
195 | it->group->handle, member | 195 | it->group->handle, member |
196 | )); | 196 | )); |
197 | } | 197 | } |
198 | 198 | ||
@@ -205,8 +205,8 @@ struct GNUNET_CHAT_ContextIterateMessages | |||
205 | 205 | ||
206 | int | 206 | int |
207 | it_context_iterate_messages (void *cls, | 207 | it_context_iterate_messages (void *cls, |
208 | GNUNET_UNUSED const struct GNUNET_HashCode *key, | 208 | GNUNET_UNUSED const struct GNUNET_HashCode *key, |
209 | void *value) | 209 | void *value) |
210 | { | 210 | { |
211 | GNUNET_assert((cls) && (value)); | 211 | GNUNET_assert((cls) && (value)); |
212 | 212 | ||
@@ -229,8 +229,8 @@ struct GNUNET_CHAT_ContextIterateFiles | |||
229 | 229 | ||
230 | int | 230 | int |
231 | it_context_iterate_files (void *cls, | 231 | it_context_iterate_files (void *cls, |
232 | const struct GNUNET_HashCode *key, | 232 | const struct GNUNET_HashCode *key, |
233 | GNUNET_UNUSED void *value) | 233 | GNUNET_UNUSED void *value) |
234 | { | 234 | { |
235 | GNUNET_assert((cls) && (key)); | 235 | GNUNET_assert((cls) && (key)); |
236 | 236 | ||
@@ -240,14 +240,14 @@ it_context_iterate_files (void *cls, | |||
240 | return GNUNET_YES; | 240 | return GNUNET_YES; |
241 | 241 | ||
242 | struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get( | 242 | struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get( |
243 | it->context->messages, key | 243 | it->context->messages, key |
244 | ); | 244 | ); |
245 | 245 | ||
246 | if (!message) | 246 | if (!message) |
247 | return GNUNET_YES; | 247 | return GNUNET_YES; |
248 | 248 | ||
249 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( | 249 | struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get( |
250 | it->context->handle->files, &(message->hash) | 250 | it->context->handle->files, &(message->hash) |
251 | ); | 251 | ); |
252 | 252 | ||
253 | if (!file) | 253 | if (!file) |
@@ -265,8 +265,8 @@ struct GNUNET_CHAT_MessageIterateReadReceipts | |||
265 | 265 | ||
266 | int | 266 | int |
267 | it_message_iterate_read_receipts (void *cls, | 267 | it_message_iterate_read_receipts (void *cls, |
268 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, | 268 | GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room, |
269 | const struct GNUNET_MESSENGER_Contact *member) | 269 | const struct GNUNET_MESSENGER_Contact *member) |
270 | { | 270 | { |
271 | GNUNET_assert((cls) && (member)); | 271 | GNUNET_assert((cls) && (member)); |
272 | 272 | ||
@@ -287,14 +287,14 @@ it_message_iterate_read_receipts (void *cls, | |||
287 | return GNUNET_YES; | 287 | return GNUNET_YES; |
288 | 288 | ||
289 | struct GNUNET_TIME_Absolute *timestamp = GNUNET_CONTAINER_multishortmap_get( | 289 | struct GNUNET_TIME_Absolute *timestamp = GNUNET_CONTAINER_multishortmap_get( |
290 | it->message->context->timestamps, &shorthash | 290 | it->message->context->timestamps, &shorthash |
291 | ); | 291 | ); |
292 | 292 | ||
293 | if (!timestamp) | 293 | if (!timestamp) |
294 | return GNUNET_YES; | 294 | return GNUNET_YES; |
295 | 295 | ||
296 | struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference( | 296 | struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference( |
297 | *timestamp, GNUNET_CHAT_message_get_timestamp(it->message) | 297 | *timestamp, GNUNET_CHAT_message_get_timestamp(it->message) |
298 | ); | 298 | ); |
299 | 299 | ||
300 | int read_receipt; | 300 | int read_receipt; |
diff --git a/src/gnunet_chat_lobby.c b/src/gnunet_chat_lobby.c index 65274c8..07d2dfc 100644 --- a/src/gnunet_chat_lobby.c +++ b/src/gnunet_chat_lobby.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022--2023 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -59,7 +59,7 @@ lobby_destroy (struct GNUNET_CHAT_Lobby *lobby) | |||
59 | if (lobby->context) | 59 | if (lobby->context) |
60 | { | 60 | { |
61 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 61 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
62 | lobby->context->room | 62 | lobby->context->room |
63 | ); | 63 | ); |
64 | 64 | ||
65 | if (!key) | 65 | if (!key) |
@@ -87,9 +87,9 @@ skip_deletion: | |||
87 | 87 | ||
88 | void | 88 | void |
89 | lobby_open (struct GNUNET_CHAT_Lobby *lobby, | 89 | lobby_open (struct GNUNET_CHAT_Lobby *lobby, |
90 | struct GNUNET_TIME_Relative delay, | 90 | struct GNUNET_TIME_Relative delay, |
91 | GNUNET_CHAT_LobbyCallback callback, | 91 | GNUNET_CHAT_LobbyCallback callback, |
92 | void *cls) | 92 | void *cls) |
93 | { | 93 | { |
94 | GNUNET_assert(lobby); | 94 | GNUNET_assert(lobby); |
95 | 95 | ||
@@ -109,8 +109,8 @@ lobby_open (struct GNUNET_CHAT_Lobby *lobby, | |||
109 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, &key, sizeof(key)); | 109 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, &key, sizeof(key)); |
110 | 110 | ||
111 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room( | 111 | struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room( |
112 | lobby->handle->messenger, | 112 | lobby->handle->messenger, |
113 | &key | 113 | &key |
114 | ); | 114 | ); |
115 | 115 | ||
116 | if (!room) | 116 | if (!room) |
@@ -135,12 +135,12 @@ open_zone: | |||
135 | util_lobby_name(&key, &name); | 135 | util_lobby_name(&key, &name); |
136 | 136 | ||
137 | lobby->op = GNUNET_IDENTITY_create( | 137 | lobby->op = GNUNET_IDENTITY_create( |
138 | lobby->handle->identity, | 138 | lobby->handle->identity, |
139 | name, | 139 | name, |
140 | NULL, | 140 | NULL, |
141 | GNUNET_PUBLIC_KEY_TYPE_EDDSA, | 141 | GNUNET_PUBLIC_KEY_TYPE_EDDSA, |
142 | cont_lobby_identity_create, | 142 | cont_lobby_identity_create, |
143 | lobby | 143 | lobby |
144 | ); | 144 | ); |
145 | 145 | ||
146 | GNUNET_free(name); | 146 | GNUNET_free(name); |
diff --git a/src/gnunet_chat_lobby.h b/src/gnunet_chat_lobby.h index c1194bc..9f4d514 100644 --- a/src/gnunet_chat_lobby.h +++ b/src/gnunet_chat_lobby.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -79,8 +79,8 @@ lobby_destroy (struct GNUNET_CHAT_Lobby *lobby); | |||
79 | */ | 79 | */ |
80 | void | 80 | void |
81 | lobby_open (struct GNUNET_CHAT_Lobby *lobby, | 81 | lobby_open (struct GNUNET_CHAT_Lobby *lobby, |
82 | struct GNUNET_TIME_Relative delay, | 82 | struct GNUNET_TIME_Relative delay, |
83 | GNUNET_CHAT_LobbyCallback callback, | 83 | GNUNET_CHAT_LobbyCallback callback, |
84 | void *cls); | 84 | void *cls); |
85 | 85 | ||
86 | #endif /* GNUNET_CHAT_LOBBY_H_ */ | 86 | #endif /* GNUNET_CHAT_LOBBY_H_ */ |
diff --git a/src/gnunet_chat_lobby_intern.c b/src/gnunet_chat_lobby_intern.c index 664b2aa..0de0494 100644 --- a/src/gnunet_chat_lobby_intern.c +++ b/src/gnunet_chat_lobby_intern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022--2023 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | void | 27 | void |
28 | cont_lobby_write_records (void *cls, | 28 | cont_lobby_write_records (void *cls, |
29 | enum GNUNET_ErrorCode ec) | 29 | enum GNUNET_ErrorCode ec) |
30 | { | 30 | { |
31 | struct GNUNET_CHAT_Lobby *lobby = cls; | 31 | struct GNUNET_CHAT_Lobby *lobby = cls; |
32 | 32 | ||
@@ -35,7 +35,7 @@ cont_lobby_write_records (void *cls, | |||
35 | lobby->query = NULL; | 35 | lobby->query = NULL; |
36 | 36 | ||
37 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 37 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
38 | lobby->context->room | 38 | lobby->context->room |
39 | ); | 39 | ); |
40 | 40 | ||
41 | char *name; | 41 | char *name; |
@@ -52,10 +52,10 @@ cont_lobby_write_records (void *cls, | |||
52 | } | 52 | } |
53 | 53 | ||
54 | handle_send_internal_message( | 54 | handle_send_internal_message( |
55 | lobby->handle, | 55 | lobby->handle, |
56 | lobby->context, | 56 | lobby->context, |
57 | GNUNET_CHAT_FLAG_WARNING, | 57 | GNUNET_CHAT_FLAG_WARNING, |
58 | GNUNET_ErrorCode_get_hint(ec) | 58 | GNUNET_ErrorCode_get_hint(ec) |
59 | ); | 59 | ); |
60 | 60 | ||
61 | if (lobby->uri) | 61 | if (lobby->uri) |
@@ -70,8 +70,8 @@ call_cb: | |||
70 | 70 | ||
71 | void | 71 | void |
72 | cont_lobby_identity_create (void *cls, | 72 | cont_lobby_identity_create (void *cls, |
73 | const struct GNUNET_CRYPTO_PrivateKey *zone, | 73 | const struct GNUNET_CRYPTO_PrivateKey *zone, |
74 | enum GNUNET_ErrorCode ec) | 74 | enum GNUNET_ErrorCode ec) |
75 | { | 75 | { |
76 | struct GNUNET_CHAT_Lobby *lobby = cls; | 76 | struct GNUNET_CHAT_Lobby *lobby = cls; |
77 | 77 | ||
@@ -82,17 +82,17 @@ cont_lobby_identity_create (void *cls, | |||
82 | if (GNUNET_EC_NONE != ec) | 82 | if (GNUNET_EC_NONE != ec) |
83 | { | 83 | { |
84 | handle_send_internal_message( | 84 | handle_send_internal_message( |
85 | lobby->handle, | 85 | lobby->handle, |
86 | lobby->context, | 86 | lobby->context, |
87 | GNUNET_CHAT_FLAG_WARNING, | 87 | GNUNET_CHAT_FLAG_WARNING, |
88 | GNUNET_ErrorCode_get_hint(ec) | 88 | GNUNET_ErrorCode_get_hint(ec) |
89 | ); | 89 | ); |
90 | 90 | ||
91 | return; | 91 | return; |
92 | } | 92 | } |
93 | 93 | ||
94 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( | 94 | const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key( |
95 | lobby->context->room | 95 | lobby->context->room |
96 | ); | 96 | ); |
97 | 97 | ||
98 | struct GNUNET_MESSENGER_RoomEntryRecord room; | 98 | struct GNUNET_MESSENGER_RoomEntryRecord room; |
@@ -119,12 +119,12 @@ cont_lobby_identity_create (void *cls, | |||
119 | GNUNET_free(label); | 119 | GNUNET_free(label); |
120 | 120 | ||
121 | lobby->query = GNUNET_NAMESTORE_record_set_store( | 121 | lobby->query = GNUNET_NAMESTORE_record_set_store( |
122 | lobby->handle->namestore, | 122 | lobby->handle->namestore, |
123 | zone, | 123 | zone, |
124 | lobby->uri->label, | 124 | lobby->uri->label, |
125 | 1, | 125 | 1, |
126 | data, | 126 | data, |
127 | cont_lobby_write_records, | 127 | cont_lobby_write_records, |
128 | lobby | 128 | lobby |
129 | ); | 129 | ); |
130 | } | 130 | } |
diff --git a/src/gnunet_chat_message.c b/src/gnunet_chat_message.c index d3c1385..49260f9 100644 --- a/src/gnunet_chat_message.c +++ b/src/gnunet_chat_message.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021 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 |
@@ -26,13 +26,11 @@ | |||
26 | 26 | ||
27 | struct GNUNET_CHAT_Message* | 27 | struct GNUNET_CHAT_Message* |
28 | message_create_from_msg (struct GNUNET_CHAT_Context *context, | 28 | message_create_from_msg (struct GNUNET_CHAT_Context *context, |
29 | const struct GNUNET_HashCode *hash, | 29 | const struct GNUNET_HashCode *hash, |
30 | enum GNUNET_MESSENGER_MessageFlags flags, | 30 | enum GNUNET_MESSENGER_MessageFlags flags, |
31 | const struct GNUNET_MESSENGER_Message *msg) | 31 | const struct GNUNET_MESSENGER_Message *msg) |
32 | { | 32 | { |
33 | GNUNET_assert((context) && | 33 | GNUNET_assert((context) && (hash) && (msg)); |
34 | (hash) && | ||
35 | (msg)); | ||
36 | 34 | ||
37 | struct GNUNET_CHAT_Message *message = GNUNET_new(struct GNUNET_CHAT_Message); | 35 | struct GNUNET_CHAT_Message *message = GNUNET_new(struct GNUNET_CHAT_Message); |
38 | 36 | ||
@@ -50,8 +48,8 @@ message_create_from_msg (struct GNUNET_CHAT_Context *context, | |||
50 | 48 | ||
51 | struct GNUNET_CHAT_Message* | 49 | struct GNUNET_CHAT_Message* |
52 | message_create_internally (struct GNUNET_CHAT_Context *context, | 50 | message_create_internally (struct GNUNET_CHAT_Context *context, |
53 | enum GNUNET_CHAT_MessageFlag flag, | 51 | enum GNUNET_CHAT_MessageFlag flag, |
54 | const char *warning) | 52 | const char *warning) |
55 | { | 53 | { |
56 | struct GNUNET_CHAT_Message *message = GNUNET_new(struct GNUNET_CHAT_Message); | 54 | struct GNUNET_CHAT_Message *message = GNUNET_new(struct GNUNET_CHAT_Message); |
57 | 55 | ||
diff --git a/src/gnunet_chat_message.h b/src/gnunet_chat_message.h index 68b4697..5775856 100644 --- a/src/gnunet_chat_message.h +++ b/src/gnunet_chat_message.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--2022 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 |
@@ -76,9 +76,9 @@ struct GNUNET_CHAT_Message | |||
76 | */ | 76 | */ |
77 | struct GNUNET_CHAT_Message* | 77 | struct GNUNET_CHAT_Message* |
78 | message_create_from_msg (struct GNUNET_CHAT_Context *context, | 78 | message_create_from_msg (struct GNUNET_CHAT_Context *context, |
79 | const struct GNUNET_HashCode *hash, | 79 | const struct GNUNET_HashCode *hash, |
80 | enum GNUNET_MESSENGER_MessageFlags flags, | 80 | enum GNUNET_MESSENGER_MessageFlags flags, |
81 | const struct GNUNET_MESSENGER_Message *msg); | 81 | const struct GNUNET_MESSENGER_Message *msg); |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Creates an internal chat message with an optional chat | 84 | * Creates an internal chat message with an optional chat |
@@ -92,8 +92,8 @@ message_create_from_msg (struct GNUNET_CHAT_Context *context, | |||
92 | */ | 92 | */ |
93 | struct GNUNET_CHAT_Message* | 93 | struct GNUNET_CHAT_Message* |
94 | message_create_internally (struct GNUNET_CHAT_Context *context, | 94 | message_create_internally (struct GNUNET_CHAT_Context *context, |
95 | enum GNUNET_CHAT_MessageFlag flag, | 95 | enum GNUNET_CHAT_MessageFlag flag, |
96 | const char *warning); | 96 | const char *warning); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Destroys a chat <i>message</i> and frees its memory. | 99 | * Destroys a chat <i>message</i> and frees its memory. |
diff --git a/src/gnunet_chat_uri.c b/src/gnunet_chat_uri.c index f92b698..21fed8c 100644 --- a/src/gnunet_chat_uri.c +++ b/src/gnunet_chat_uri.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022--2023 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | struct GNUNET_CHAT_Uri* | 27 | struct GNUNET_CHAT_Uri* |
28 | uri_create (const struct GNUNET_CRYPTO_PublicKey *zone, | 28 | uri_create (const struct GNUNET_CRYPTO_PublicKey *zone, |
29 | const char *label) | 29 | const char *label) |
30 | { | 30 | { |
31 | GNUNET_assert((zone) && (label)); | 31 | GNUNET_assert((zone) && (label)); |
32 | 32 | ||
diff --git a/src/gnunet_chat_uri.h b/src/gnunet_chat_uri.h index b60c13f..4889358 100644 --- a/src/gnunet_chat_uri.h +++ b/src/gnunet_chat_uri.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2022--2023 GNUnet e.V. | 3 | Copyright (C) 2022--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 |
@@ -45,7 +45,7 @@ struct GNUNET_CHAT_Uri | |||
45 | */ | 45 | */ |
46 | struct GNUNET_CHAT_Uri* | 46 | struct GNUNET_CHAT_Uri* |
47 | uri_create (const struct GNUNET_CRYPTO_PublicKey *zone, | 47 | uri_create (const struct GNUNET_CRYPTO_PublicKey *zone, |
48 | const char *label); | 48 | const char *label); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Destroys a chat <i>uri</i> and frees its memory. | 51 | * Destroys a chat <i>uri</i> and frees its memory. |
diff --git a/src/gnunet_chat_util.c b/src/gnunet_chat_util.c index b3f5983..cbd45de 100644 --- a/src/gnunet_chat_util.c +++ b/src/gnunet_chat_util.c | |||
@@ -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 |
@@ -29,7 +29,7 @@ static const char label_prefix_of_group [] = "group"; | |||
29 | 29 | ||
30 | void | 30 | void |
31 | util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, | 31 | util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, |
32 | struct GNUNET_ShortHashCode *shorthash) | 32 | struct GNUNET_ShortHashCode *shorthash) |
33 | { | 33 | { |
34 | GNUNET_assert(shorthash); | 34 | GNUNET_assert(shorthash); |
35 | 35 | ||
@@ -37,9 +37,9 @@ util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, | |||
37 | 37 | ||
38 | memset(shorthash, 0, sizeof(*shorthash)); | 38 | memset(shorthash, 0, sizeof(*shorthash)); |
39 | GNUNET_memcpy( | 39 | GNUNET_memcpy( |
40 | shorthash, | 40 | shorthash, |
41 | &id, | 41 | &id, |
42 | sizeof(id) < sizeof(*shorthash) ? sizeof(id) : sizeof(*shorthash) | 42 | sizeof(id) < sizeof(*shorthash) ? sizeof(id) : sizeof(*shorthash) |
43 | ); | 43 | ); |
44 | } | 44 | } |
45 | 45 | ||
@@ -68,7 +68,7 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash) | |||
68 | return GNUNET_SYSERR; | 68 | return GNUNET_SYSERR; |
69 | 69 | ||
70 | struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open( | 70 | struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open( |
71 | filename, GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_USER_READ | 71 | filename, GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_USER_READ |
72 | ); | 72 | ); |
73 | 73 | ||
74 | if (!file) | 74 | if (!file) |
@@ -80,7 +80,7 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash) | |||
80 | if (size > 0) | 80 | if (size > 0) |
81 | { | 81 | { |
82 | data = GNUNET_DISK_file_map( | 82 | data = GNUNET_DISK_file_map( |
83 | file, &mapping, GNUNET_DISK_MAP_TYPE_READ, size | 83 | file, &mapping, GNUNET_DISK_MAP_TYPE_READ, size |
84 | ); | 84 | ); |
85 | 85 | ||
86 | if ((!data) || (!mapping)) | 86 | if ((!data) || (!mapping)) |
@@ -106,8 +106,8 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash) | |||
106 | 106 | ||
107 | int | 107 | int |
108 | util_encrypt_file (const char *filename, | 108 | util_encrypt_file (const char *filename, |
109 | const struct GNUNET_HashCode *hash, | 109 | const struct GNUNET_HashCode *hash, |
110 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key) | 110 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key) |
111 | { | 111 | { |
112 | GNUNET_assert((filename) && (hash) && (key)); | 112 | GNUNET_assert((filename) && (hash) && (key)); |
113 | 113 | ||
@@ -117,8 +117,8 @@ util_encrypt_file (const char *filename, | |||
117 | return GNUNET_SYSERR; | 117 | return GNUNET_SYSERR; |
118 | 118 | ||
119 | struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open( | 119 | struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open( |
120 | filename, GNUNET_DISK_OPEN_READWRITE, | 120 | filename, GNUNET_DISK_OPEN_READWRITE, |
121 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE | 121 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE |
122 | ); | 122 | ); |
123 | 123 | ||
124 | if (!file) | 124 | if (!file) |
@@ -129,7 +129,7 @@ util_encrypt_file (const char *filename, | |||
129 | 129 | ||
130 | struct GNUNET_DISK_MapHandle *mapping; | 130 | struct GNUNET_DISK_MapHandle *mapping; |
131 | const void* data = GNUNET_DISK_file_map( | 131 | const void* data = GNUNET_DISK_file_map( |
132 | file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size | 132 | file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size |
133 | ); | 133 | ); |
134 | 134 | ||
135 | if ((!data) || (!mapping)) | 135 | if ((!data) || (!mapping)) |
@@ -186,8 +186,8 @@ util_encrypt_file (const char *filename, | |||
186 | 186 | ||
187 | int | 187 | int |
188 | util_decrypt_file (const char *filename, | 188 | util_decrypt_file (const char *filename, |
189 | const struct GNUNET_HashCode *hash, | 189 | const struct GNUNET_HashCode *hash, |
190 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key) | 190 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key) |
191 | { | 191 | { |
192 | GNUNET_assert((filename) && (hash) && (key)); | 192 | GNUNET_assert((filename) && (hash) && (key)); |
193 | 193 | ||
@@ -197,8 +197,8 @@ util_decrypt_file (const char *filename, | |||
197 | return GNUNET_SYSERR; | 197 | return GNUNET_SYSERR; |
198 | 198 | ||
199 | struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open( | 199 | struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open( |
200 | filename, GNUNET_DISK_OPEN_READWRITE, | 200 | filename, GNUNET_DISK_OPEN_READWRITE, |
201 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE | 201 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE |
202 | ); | 202 | ); |
203 | 203 | ||
204 | if (!file) | 204 | if (!file) |
@@ -206,7 +206,7 @@ util_decrypt_file (const char *filename, | |||
206 | 206 | ||
207 | struct GNUNET_DISK_MapHandle *mapping = NULL; | 207 | struct GNUNET_DISK_MapHandle *mapping = NULL; |
208 | void* data = GNUNET_DISK_file_map( | 208 | void* data = GNUNET_DISK_file_map( |
209 | file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size | 209 | file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size |
210 | ); | 210 | ); |
211 | 211 | ||
212 | if ((!data) || (!mapping)) | 212 | if ((!data) || (!mapping)) |
@@ -234,11 +234,11 @@ util_decrypt_file (const char *filename, | |||
234 | memcpy(&iv, hash, sizeof(iv)); | 234 | memcpy(&iv, hash, sizeof(iv)); |
235 | 235 | ||
236 | result = GNUNET_CRYPTO_symmetric_decrypt( | 236 | result = GNUNET_CRYPTO_symmetric_decrypt( |
237 | location, | 237 | location, |
238 | remaining >= block_size? block_size : remaining, | 238 | remaining >= block_size? block_size : remaining, |
239 | key, | 239 | key, |
240 | &iv, | 240 | &iv, |
241 | location | 241 | location |
242 | ); | 242 | ); |
243 | 243 | ||
244 | if (result < 0) | 244 | if (result < 0) |
@@ -268,40 +268,44 @@ util_decrypt_file (const char *filename, | |||
268 | 268 | ||
269 | int | 269 | int |
270 | util_get_dirname (const char *directory, | 270 | util_get_dirname (const char *directory, |
271 | const char *subdir, | 271 | const char *subdir, |
272 | char **filename) | 272 | char **filename) |
273 | { | 273 | { |
274 | GNUNET_assert((filename) && | 274 | GNUNET_assert( |
275 | (directory) && | 275 | (filename) && |
276 | (subdir)); | 276 | (directory) && |
277 | (subdir) | ||
278 | ); | ||
277 | 279 | ||
278 | return GNUNET_asprintf ( | 280 | return GNUNET_asprintf ( |
279 | filename, | 281 | filename, |
280 | "%s/%s", | 282 | "%s/%s", |
281 | directory, | 283 | directory, |
282 | subdir | 284 | subdir |
283 | ); | 285 | ); |
284 | } | 286 | } |
285 | 287 | ||
286 | int | 288 | int |
287 | util_get_filename (const char *directory, | 289 | util_get_filename (const char *directory, |
288 | const char *subdir, | 290 | const char *subdir, |
289 | const struct GNUNET_HashCode *hash, | 291 | const struct GNUNET_HashCode *hash, |
290 | char **filename) | 292 | char **filename) |
291 | { | 293 | { |
292 | GNUNET_assert((filename) && | 294 | GNUNET_assert( |
295 | (filename) && | ||
293 | (directory) && | 296 | (directory) && |
294 | (subdir) && | 297 | (subdir) && |
295 | (hash)); | 298 | (hash) |
299 | ); | ||
296 | 300 | ||
297 | char* dirname; | 301 | char* dirname; |
298 | util_get_dirname(directory, subdir, &dirname); | 302 | util_get_dirname(directory, subdir, &dirname); |
299 | 303 | ||
300 | int result = GNUNET_asprintf ( | 304 | int result = GNUNET_asprintf ( |
301 | filename, | 305 | filename, |
302 | "%s/%s", | 306 | "%s/%s", |
303 | dirname, | 307 | dirname, |
304 | GNUNET_h2s_full(hash) | 308 | GNUNET_h2s_full(hash) |
305 | ); | 309 | ); |
306 | 310 | ||
307 | GNUNET_free(dirname); | 311 | GNUNET_free(dirname); |
@@ -323,8 +327,8 @@ util_get_lower(const char *name) | |||
323 | 327 | ||
324 | int | 328 | int |
325 | util_get_context_label (enum GNUNET_CHAT_ContextType type, | 329 | util_get_context_label (enum GNUNET_CHAT_ContextType type, |
326 | const struct GNUNET_HashCode *hash, | 330 | const struct GNUNET_HashCode *hash, |
327 | char **label) | 331 | char **label) |
328 | { | 332 | { |
329 | const char *type_string = "chat"; | 333 | const char *type_string = "chat"; |
330 | 334 | ||
@@ -343,10 +347,10 @@ util_get_context_label (enum GNUNET_CHAT_ContextType type, | |||
343 | char *low = util_get_lower(GNUNET_h2s(hash)); | 347 | char *low = util_get_lower(GNUNET_h2s(hash)); |
344 | 348 | ||
345 | int result = GNUNET_asprintf ( | 349 | int result = GNUNET_asprintf ( |
346 | label, | 350 | label, |
347 | "%s_%s", | 351 | "%s_%s", |
348 | type_string, | 352 | type_string, |
349 | low | 353 | low |
350 | ); | 354 | ); |
351 | 355 | ||
352 | GNUNET_free(low); | 356 | GNUNET_free(low); |
@@ -355,7 +359,7 @@ util_get_context_label (enum GNUNET_CHAT_ContextType type, | |||
355 | 359 | ||
356 | enum GNUNET_CHAT_ContextType | 360 | enum GNUNET_CHAT_ContextType |
357 | util_get_context_label_type (const char *label, | 361 | util_get_context_label_type (const char *label, |
358 | const struct GNUNET_HashCode *hash) | 362 | const struct GNUNET_HashCode *hash) |
359 | { | 363 | { |
360 | enum GNUNET_CHAT_ContextType type = GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN; | 364 | enum GNUNET_CHAT_ContextType type = GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN; |
361 | 365 | ||
@@ -379,14 +383,14 @@ cleanup: | |||
379 | 383 | ||
380 | int | 384 | int |
381 | util_lobby_name (const struct GNUNET_HashCode *hash, | 385 | util_lobby_name (const struct GNUNET_HashCode *hash, |
382 | char **name) | 386 | char **name) |
383 | { | 387 | { |
384 | char *low = util_get_lower(GNUNET_h2s(hash)); | 388 | char *low = util_get_lower(GNUNET_h2s(hash)); |
385 | 389 | ||
386 | int result = GNUNET_asprintf ( | 390 | int result = GNUNET_asprintf ( |
387 | name, | 391 | name, |
388 | "chat_lobby_%s", | 392 | "chat_lobby_%s", |
389 | low | 393 | low |
390 | ); | 394 | ); |
391 | 395 | ||
392 | GNUNET_free(low); | 396 | GNUNET_free(low); |
diff --git a/src/gnunet_chat_util.h b/src/gnunet_chat_util.h index 0719a68..a81f5aa 100644 --- a/src/gnunet_chat_util.h +++ b/src/gnunet_chat_util.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 |
@@ -61,7 +61,7 @@ enum GNUNET_CHAT_ContextType | |||
61 | */ | 61 | */ |
62 | void | 62 | void |
63 | util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, | 63 | util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, |
64 | struct GNUNET_ShortHashCode *shorthash); | 64 | struct GNUNET_ShortHashCode *shorthash); |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Updates the stored content of a <i>field</i> with | 67 | * Updates the stored content of a <i>field</i> with |
@@ -96,8 +96,8 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash); | |||
96 | */ | 96 | */ |
97 | int | 97 | int |
98 | util_encrypt_file (const char *filename, | 98 | util_encrypt_file (const char *filename, |
99 | const struct GNUNET_HashCode *hash, | 99 | const struct GNUNET_HashCode *hash, |
100 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); | 100 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Decrypts a file inplace under a given <i>filename</i> | 103 | * Decrypts a file inplace under a given <i>filename</i> |
@@ -112,8 +112,8 @@ util_encrypt_file (const char *filename, | |||
112 | */ | 112 | */ |
113 | int | 113 | int |
114 | util_decrypt_file (const char *filename, | 114 | util_decrypt_file (const char *filename, |
115 | const struct GNUNET_HashCode *hash, | 115 | const struct GNUNET_HashCode *hash, |
116 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); | 116 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * Append the path of a <i>directory</i> and a custom | 119 | * Append the path of a <i>directory</i> and a custom |
@@ -126,8 +126,8 @@ util_decrypt_file (const char *filename, | |||
126 | */ | 126 | */ |
127 | int | 127 | int |
128 | util_get_dirname (const char *directory, | 128 | util_get_dirname (const char *directory, |
129 | const char *subdir, | 129 | const char *subdir, |
130 | char **filename); | 130 | char **filename); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Append the path of a <i>directory</i>, a custom | 133 | * Append the path of a <i>directory</i>, a custom |
@@ -142,9 +142,9 @@ util_get_dirname (const char *directory, | |||
142 | */ | 142 | */ |
143 | int | 143 | int |
144 | util_get_filename (const char *directory, | 144 | util_get_filename (const char *directory, |
145 | const char *subdir, | 145 | const char *subdir, |
146 | const struct GNUNET_HashCode *hash, | 146 | const struct GNUNET_HashCode *hash, |
147 | char **filename); | 147 | char **filename); |
148 | 148 | ||
149 | /** | 149 | /** |
150 | * Allocates a new string representing the lower case versionn | 150 | * Allocates a new string representing the lower case versionn |
@@ -168,8 +168,8 @@ util_get_lower(const char *name); | |||
168 | */ | 168 | */ |
169 | int | 169 | int |
170 | util_get_context_label (enum GNUNET_CHAT_ContextType type, | 170 | util_get_context_label (enum GNUNET_CHAT_ContextType type, |
171 | const struct GNUNET_HashCode *hash, | 171 | const struct GNUNET_HashCode *hash, |
172 | char **label); | 172 | char **label); |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Extract the chat context type from a used <i>label</i> by | 175 | * Extract the chat context type from a used <i>label</i> by |
@@ -181,7 +181,7 @@ util_get_context_label (enum GNUNET_CHAT_ContextType type, | |||
181 | */ | 181 | */ |
182 | enum GNUNET_CHAT_ContextType | 182 | enum GNUNET_CHAT_ContextType |
183 | util_get_context_label_type (const char *label, | 183 | util_get_context_label_type (const char *label, |
184 | const struct GNUNET_HashCode *hash); | 184 | const struct GNUNET_HashCode *hash); |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * Provide a standardized <i>name</i> for a lobby using | 187 | * Provide a standardized <i>name</i> for a lobby using |
@@ -193,7 +193,7 @@ util_get_context_label_type (const char *label, | |||
193 | */ | 193 | */ |
194 | int | 194 | int |
195 | util_lobby_name (const struct GNUNET_HashCode *hash, | 195 | util_lobby_name (const struct GNUNET_HashCode *hash, |
196 | char **name); | 196 | char **name); |
197 | 197 | ||
198 | /** | 198 | /** |
199 | * Return the chat related kind for a messages original kind | 199 | * Return the chat related kind for a messages original kind |