X-Git-Url: https://git.cworth.org/git?p=ttt;a=blobdiff_plain;f=src%2Fttt-server.h;h=80f22bf25b0ffa9ce1884931e59524966fcc5a27;hp=8d0f9c410ac6a9ef69e83ba41aa0e84693ae36c7;hb=df6ad6c8658a9f3a537a070a89a067c5ae598fcc;hpb=da40516db47b4c719aaad66a05302f13d1b6358e diff --git a/src/ttt-server.h b/src/ttt-server.h index 8d0f9c4..80f22bf 100644 --- a/src/ttt-server.h +++ b/src/ttt-server.h @@ -73,10 +73,38 @@ ttt_server_broadcast (ttt_server_t *server, const char *message); const char* ttt_server_who (ttt_server_t *server); -/* Generates the statistics for the user. If the function does not - * return an error, the response will be allocated in this function - * and will need to be free'd by the caller. +/* Checks to see whether a username exists. * + * Returns: ttt_server_get_client_from_username(server, username) + * + * Locking: See ttt_server_get_client_from_username + * + * Errors: See ttt_server_get_client_from_username + */ +ttt_error_t +ttt_server_verify_username (ttt_server_t *server, + const char *username); + +/* Points *client to the client with the supplied username, else + * leaves *client unhanged. + * + * Returns: TTT_ERROR_NONE, else TTT_ERROR_NO_USER if username not + * found. + * + * Locking: The server mutex will be acquired and held throughout the + * execution of this function. Each client mutex may also be acquired + * and held by functions called during the execution of this function. + * + * Errors: If an error such as an IO error occurs, this function will + * not return. + */ +ttt_error_t +ttt_server_get_client_from_username (ttt_server_t *server, + const char *username, + ttt_client_t **client); + +/* Adds an invitation + * * Locking: The server mutex will be acquired and held throughout the * execution of this function. Each client mutex may also be acquired * and held by functions called during the execution of this function. @@ -85,13 +113,15 @@ ttt_server_who (ttt_server_t *server); * not return. */ ttt_error_t -ttt_server_statistics (ttt_server_t *server, - const char *username, - char **response); +ttt_server_add_invite (ttt_server_t *server, + ttt_client_t *actor, + ttt_client_t *invitee); -/* Checks to see if the username is registered. If the username exists - * will return TTT_ERROR_NONE, else TTT_ERROR_NO_USER. +/* Removes an invitation * + * Returns: TTT_ERROR_NONE, else TTT_ERROR_NO_INVITE if no invite + * found. + * * Locking: The server mutex will be acquired and held throughout the * execution of this function. Each client mutex may also be acquired * and held by functions called during the execution of this function. @@ -100,8 +130,9 @@ ttt_server_statistics (ttt_server_t *server, * not return. */ ttt_error_t -ttt_server_verify_username (ttt_server_t *server, - const char *username); +ttt_server_remove_invite (ttt_server_t *server, + ttt_client_t *actor, + ttt_client_t *invitee); /* Gets the server hostname. *