diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-02-13 17:35:32 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-02-13 17:35:32 +0100 |
commit | ccdeafaf88627aa274c2d6090e4231ed51b56c63 (patch) | |
tree | 6bd037bd2d01626e35fc2f573e9d424da5d49673 /include | |
parent | ffbadef904ae1e32eb54671647527b99e70d2266 (diff) | |
download | libgnunetchat-ccdeafaf88627aa274c2d6090e4231ed51b56c63.tar.gz libgnunetchat-ccdeafaf88627aa274c2d6090e4231ed51b56c63.zip |
Established accounts as selectable identities to use
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gnunet_chat_lib.h | 88 |
1 files changed, 75 insertions, 13 deletions
diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h index 7675ad1..0d2a848 100644 --- a/include/gnunet_chat_lib.h +++ b/include/gnunet_chat_lib.h | |||
@@ -50,49 +50,54 @@ enum GNUNET_CHAT_MessageKind | |||
50 | GNUNET_CHAT_KIND_WARNING = 1, /**< GNUNET_CHAT_KIND_WARNING */ | 50 | GNUNET_CHAT_KIND_WARNING = 1, /**< GNUNET_CHAT_KIND_WARNING */ |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * The kind to inform that the list of accounts was refreshed. | ||
54 | */ | ||
55 | GNUNET_CHAT_KIND_REFRESH = 2, /**< GNUNET_CHAT_KIND_REFRESH */ | ||
56 | |||
57 | /** | ||
53 | * The kind to inform that the application can be used. | 58 | * The kind to inform that the application can be used. |
54 | */ | 59 | */ |
55 | GNUNET_CHAT_KIND_LOGIN = 2, /**< GNUNET_CHAT_KIND_LOGIN */ | 60 | GNUNET_CHAT_KIND_LOGIN = 3, /**< GNUNET_CHAT_KIND_LOGIN */ |
56 | 61 | ||
57 | /** | 62 | /** |
58 | * The kind to inform that a context was updated. | 63 | * The kind to inform that a context was updated. |
59 | */ | 64 | */ |
60 | GNUNET_CHAT_KIND_UPDATE = 3, /**< GNUNET_CHAT_KIND_UPDATE */ | 65 | GNUNET_CHAT_KIND_UPDATE = 4, /**< GNUNET_CHAT_KIND_UPDATE */ |
61 | 66 | ||
62 | /** | 67 | /** |
63 | * The kind to inform that a contact has joined a chat. | 68 | * The kind to inform that a contact has joined a chat. |
64 | */ | 69 | */ |
65 | GNUNET_CHAT_KIND_JOIN = 4, /**< GNUNET_CHAT_KIND_JOIN */ | 70 | GNUNET_CHAT_KIND_JOIN = 5, /**< GNUNET_CHAT_KIND_JOIN */ |
66 | 71 | ||
67 | /** | 72 | /** |
68 | * The kind to inform that a contact has left a chat. | 73 | * The kind to inform that a contact has left a chat. |
69 | */ | 74 | */ |
70 | GNUNET_CHAT_KIND_LEAVE = 5, /**< GNUNET_CHAT_KIND_LEAVE */ | 75 | GNUNET_CHAT_KIND_LEAVE = 6, /**< GNUNET_CHAT_KIND_LEAVE */ |
71 | 76 | ||
72 | /** | 77 | /** |
73 | * The kind to inform that a contact has changed. | 78 | * The kind to inform that a contact has changed. |
74 | */ | 79 | */ |
75 | GNUNET_CHAT_KIND_CONTACT = 6, /**< GNUNET_CHAT_KIND_CONTACT */ | 80 | GNUNET_CHAT_KIND_CONTACT = 7, /**< GNUNET_CHAT_KIND_CONTACT */ |
76 | 81 | ||
77 | /** | 82 | /** |
78 | * The kind to describe an invitation to a different chat. | 83 | * The kind to describe an invitation to a different chat. |
79 | */ | 84 | */ |
80 | GNUNET_CHAT_KIND_INVITATION = 7, /**< GNUNET_CHAT_KIND_INVITATION */ | 85 | GNUNET_CHAT_KIND_INVITATION = 8, /**< GNUNET_CHAT_KIND_INVITATION */ |
81 | 86 | ||
82 | /** | 87 | /** |
83 | * The kind to describe a text message. | 88 | * The kind to describe a text message. |
84 | */ | 89 | */ |
85 | GNUNET_CHAT_KIND_TEXT = 8, /**< GNUNET_CHAT_KIND_TEXT */ | 90 | GNUNET_CHAT_KIND_TEXT = 9, /**< GNUNET_CHAT_KIND_TEXT */ |
86 | 91 | ||
87 | /** | 92 | /** |
88 | * The kind to describe a shared file. | 93 | * The kind to describe a shared file. |
89 | */ | 94 | */ |
90 | GNUNET_CHAT_KIND_FILE = 9, /**< GNUNET_CHAT_KIND_FILE */ | 95 | GNUNET_CHAT_KIND_FILE = 10, /**< GNUNET_CHAT_KIND_FILE */ |
91 | 96 | ||
92 | /** | 97 | /** |
93 | * The kind to inform about a deletion of a previous message. | 98 | * The kind to inform about a deletion of a previous message. |
94 | */ | 99 | */ |
95 | GNUNET_CHAT_KIND_DELETION = 10, /**< GNUNET_CHAT_KIND_DELETION */ | 100 | GNUNET_CHAT_KIND_DELETION = 11, /**< GNUNET_CHAT_KIND_DELETION */ |
96 | 101 | ||
97 | /** | 102 | /** |
98 | * An unknown kind of message. | 103 | * An unknown kind of message. |
@@ -106,6 +111,11 @@ enum GNUNET_CHAT_MessageKind | |||
106 | struct GNUNET_CHAT_Handle; | 111 | struct GNUNET_CHAT_Handle; |
107 | 112 | ||
108 | /** | 113 | /** |
114 | * Struct of a chat account. | ||
115 | */ | ||
116 | struct GNUNET_CHAT_Account; | ||
117 | |||
118 | /** | ||
109 | * Struct of a chat contact. | 119 | * Struct of a chat contact. |
110 | */ | 120 | */ |
111 | struct GNUNET_CHAT_Contact; | 121 | struct GNUNET_CHAT_Contact; |
@@ -136,6 +146,19 @@ struct GNUNET_CHAT_File; | |||
136 | struct GNUNET_CHAT_Invitation; | 146 | struct GNUNET_CHAT_Invitation; |
137 | 147 | ||
138 | /** | 148 | /** |
149 | * Iterator over chat accounts of a specific chat handle. | ||
150 | * | ||
151 | * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_accounts | ||
152 | * @param[in] handle Chat handle | ||
153 | * @param[in] account Chat account | ||
154 | * @return #GNUNET_YES if we should continue to iterate, #GNUNET_NO otherwise. | ||
155 | */ | ||
156 | typedef int | ||
157 | (*GNUNET_CHAT_AccountCallback) (void *cls, | ||
158 | const struct GNUNET_CHAT_Handle *handle, | ||
159 | const struct GNUNET_CHAT_Account *account); | ||
160 | |||
161 | /** | ||
139 | * Iterator over chat contacts of a specific chat handle. | 162 | * Iterator over chat contacts of a specific chat handle. |
140 | * | 163 | * |
141 | * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_contacts | 164 | * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_contacts |
@@ -261,15 +284,14 @@ typedef void | |||
261 | uint64_t size); | 284 | uint64_t size); |
262 | 285 | ||
263 | /** | 286 | /** |
264 | * Start a chat handle with a certain configuration, an application <i>directory</i> | 287 | * Start a chat handle with a certain configuration and a selected application |
265 | * and a selected user <i>name</i>. | 288 | * <i>directory</i>. |
266 | * | 289 | * |
267 | * A custom callback for warnings and message events can be provided optionally | 290 | * A custom callback for warnings and message events can be provided optionally |
268 | * together with their respective closures. | 291 | * together with their respective closures. |
269 | * | 292 | * |
270 | * @param[in] cfg Configuration | 293 | * @param[in] cfg Configuration |
271 | * @param[in] directory Application directory path (optional) | 294 | * @param[in] directory Application directory path (optional) |
272 | * @param[in] name User name (optional) | ||
273 | * @param[in] msg_cb Callback for message events (optional) | 295 | * @param[in] msg_cb Callback for message events (optional) |
274 | * @param[in,out] msg_cls Closure for message events (optional) | 296 | * @param[in,out] msg_cls Closure for message events (optional) |
275 | * @return Chat handle | 297 | * @return Chat handle |
@@ -277,7 +299,6 @@ typedef void | |||
277 | struct GNUNET_CHAT_Handle* | 299 | struct GNUNET_CHAT_Handle* |
278 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 300 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
279 | const char *directory, | 301 | const char *directory, |
280 | const char *name, | ||
281 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls); | 302 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls); |
282 | 303 | ||
283 | /** | 304 | /** |
@@ -290,6 +311,47 @@ void | |||
290 | GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle); | 311 | GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle); |
291 | 312 | ||
292 | /** | 313 | /** |
314 | * Iterates through the accounts of a given chat <i>handle</i> with a selected | ||
315 | * callback and custom closure. | ||
316 | * | ||
317 | * @param[in] handle Chat handle | ||
318 | * @param[in] callback Callback for account iteration (optional) | ||
319 | * @param[in,out] cls Closure for account iteration (optional) | ||
320 | * @return Amount of accounts iterated or #GNUNET_SYSERR on failure | ||
321 | */ | ||
322 | int | ||
323 | GNUNET_CHAT_iterate_accounts(const struct GNUNET_CHAT_Handle *handle, | ||
324 | GNUNET_CHAT_AccountCallback callback, | ||
325 | void *cls); | ||
326 | |||
327 | /** | ||
328 | * Connects a chat <i>handle</i> to a selected chat <i>account</i>. | ||
329 | * | ||
330 | * @param[in] account Chat account | ||
331 | */ | ||
332 | void | ||
333 | GNUNET_CHAT_connect (struct GNUNET_CHAT_Handle *handle, | ||
334 | const struct GNUNET_CHAT_Account *account); | ||
335 | |||
336 | /** | ||
337 | * Disconnects a chat <i>handle</i> from the current chat account. | ||
338 | * | ||
339 | * @param[in,out] handle Chat handle | ||
340 | */ | ||
341 | void | ||
342 | GNUNET_CHAT_disconnect (struct GNUNET_CHAT_Handle *handle); | ||
343 | |||
344 | /** | ||
345 | * Returns the connected account of a chat <i>handle</i> for related | ||
346 | * communication or NULL if no account is set yet. | ||
347 | * | ||
348 | * @param handle Chat handle | ||
349 | * @return Account used by the handle or NULL | ||
350 | */ | ||
351 | const struct GNUNET_CHAT_Account* | ||
352 | GNUNET_CHAT_get_connected(const struct GNUNET_CHAT_Handle *handle); | ||
353 | |||
354 | /** | ||
293 | * Updates a chat handle to renew the used ego to sign sent messages in active | 355 | * Updates a chat handle to renew the used ego to sign sent messages in active |
294 | * chats. | 356 | * chats. |
295 | * | 357 | * |