aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-03-11 02:44:35 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-03-11 02:44:35 +0100
commitafd5d7cb5fdb8d2cf20f50d3942f553be78ca0ca (patch)
treeb7e14d3e02b73647ae546acc2caee02c72b048df /include
parent59f4fc5b4ea2a5426446f9c81a1acaf104e71a8f (diff)
downloadlibgnunetchat-afd5d7cb5fdb8d2cf20f50d3942f553be78ca0ca.tar.gz
libgnunetchat-afd5d7cb5fdb8d2cf20f50d3942f553be78ca0ca.zip
Added new declarations of functions for lobbies
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/gnunet_chat_lib.h87
1 files changed, 85 insertions, 2 deletions
diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h
index 10e36a4..b1810d5 100644
--- a/include/gnunet_chat_lib.h
+++ b/include/gnunet_chat_lib.h
@@ -116,6 +116,16 @@ struct GNUNET_CHAT_Handle;
116struct GNUNET_CHAT_Account; 116struct GNUNET_CHAT_Account;
117 117
118/** 118/**
119 * Struct of a chat URI.
120 */
121struct GNUNET_CHAT_Uri;
122
123/**
124 * Struct of a chat lobby.
125 */
126struct GNUNET_CHAT_Lobby;
127
128/**
119 * Struct of a chat contact. 129 * Struct of a chat contact.
120 */ 130 */
121struct GNUNET_CHAT_Contact; 131struct GNUNET_CHAT_Contact;
@@ -159,6 +169,16 @@ typedef int
159 struct GNUNET_CHAT_Account *account); 169 struct GNUNET_CHAT_Account *account);
160 170
161/** 171/**
172 * Method called when a lobby is opened to share with others via a chat URI.
173 *
174 * @param[in,out] cls Closure from #GNUNET_CHAT_lobby_open
175 * @param[in] uri Chat URI of the lobby
176 */
177typedef void
178(*GNUNET_CHAT_LobbyCallback) (void *cls,
179 const struct GNUNET_CHAT_Uri *uri);
180
181/**
162 * Iterator over chat contacts of a specific chat handle. 182 * Iterator over chat contacts of a specific chat handle.
163 * 183 *
164 * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_contacts 184 * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_contacts
@@ -299,7 +319,8 @@ typedef void
299struct GNUNET_CHAT_Handle* 319struct GNUNET_CHAT_Handle*
300GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 320GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
301 const char *directory, 321 const char *directory,
302 GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls); 322 GNUNET_CHAT_ContextMessageCallback msg_cb,
323 void *msg_cls);
303 324
304/** 325/**
305 * Stops a chat handle closing all its remaining resources and frees the 326 * Stops a chat handle closing all its remaining resources and frees the
@@ -410,6 +431,68 @@ const char*
410GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle); 431GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle);
411 432
412/** 433/**
434 * Convert an UTF-8 String to a chat URI which will be newly allocated.
435 *
436 * @param[in] uri UTF-8 string to parse
437 * @param[out] emsg Where to store the parser error message (if any)
438 * @return NULL on error
439 */
440struct GNUNET_CHAT_Uri*
441GNUNET_CHAT_uri_parse (const char *uri,
442 char **emsg);
443
444/**
445 * Convert a chat URI to a UTF-8 String.
446 *
447 * @param[in] uri Chat URI
448 * @return The UTF-8 string representing the URI
449 */
450char*
451GNUNET_CHAT_uri_to_string (const struct GNUNET_CHAT_Uri *uri);
452
453/**
454 * Free an allocated chat URI.
455 *
456 * @param[in,out] uri Chat URI
457 */
458void
459GNUNET_CHAT_uri_destroy (struct GNUNET_CHAT_Uri *uri);
460
461/**
462 * Opens an empty chat lobby which will expire after a custom <i>delay</i>.
463 *
464 * @param[in,out] handle Chat handle
465 * @param[in] delay Expiration delay
466 * @param[in] callback Callback for the lobby opening
467 * @param[in,out] cls Closure for the lobby opening (optional)
468 * @return Chat lobby
469 */
470struct GNUNET_CHAT_Lobby*
471GNUNET_CHAT_lobby_open (struct GNUNET_CHAT_Handle *handle,
472 struct GNUNET_TIME_Relative delay,
473 GNUNET_CHAT_LobbyCallback callback,
474 void *cls);
475
476/**
477 * Closes a chat <i>lobby</i> overriding the expiration to be now.
478 *
479 * @param[in,out] lobby Chat lobby
480 */
481void
482GNUNET_CHAT_lobby_close (struct GNUNET_CHAT_Lobby *lobby);
483
484/**
485 * Joins an open lobby via URI with a given chat <i>handle</i> if it can still
486 * be resolved (depends on connection and expiration of the lobby).
487 *
488 * @param[in,out] handle Chat handle
489 * @param[in] uri Chat URI
490 */
491void
492GNUNET_CHAT_lobby_join (struct GNUNET_CHAT_Handle *handle,
493 const struct GNUNET_CHAT_Uri *uri);
494
495/**
413 * Iterates through the contacts of a given chat <i>handle</i> with a selected 496 * Iterates through the contacts of a given chat <i>handle</i> with a selected
414 * callback and custom closure. 497 * callback and custom closure.
415 * 498 *
@@ -426,7 +509,7 @@ GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle,
426/** 509/**
427 * Returns the provided name of a given <i>account</i> or NULL on failure. 510 * Returns the provided name of a given <i>account</i> or NULL on failure.
428 * 511 *
429 * @param account Chat account 512 * @param[in] account Chat account
430 * @return Name or NULL 513 * @return Name or NULL
431 */ 514 */
432const char* 515const char*