X-Git-Url: https://git.cworth.org/git?p=ttt;a=blobdiff_plain;f=src%2Fttt-client.c;h=9c9b819f8c1a3dfeebcbe5c693e58811bca45c9b;hp=1c23fcc3aced5d29ffa25ba19b4c3bebde00fa50;hb=980a478f042f8cf48f4484bb117fab8dafd8b450;hpb=82b903360548669988e41ffe055bc2215a28b404 diff --git a/src/ttt-client.c b/src/ttt-client.c index 1c23fcc..9c9b819 100644 --- a/src/ttt-client.c +++ b/src/ttt-client.c @@ -51,6 +51,11 @@ _ttt_client_execute_helo (ttt_client_t *client, char **args, int num_args); +static ttt_error_t +_ttt_client_execute_who (ttt_client_t *client, + char **args, + int num_args); + static ttt_error_t _ttt_client_execute_quit (ttt_client_t *client, char **args, @@ -64,6 +69,7 @@ typedef struct _ttt_command_description { ttt_command_description_t command_descriptions[] = { {"HELO", 1, _ttt_client_execute_helo}, + {"WHO", 0, _ttt_client_execute_who}, {"QUIT", 0, _ttt_client_execute_quit} }; #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) @@ -97,6 +103,24 @@ _ttt_client_execute_helo (ttt_client_t *client, return TTT_ERROR_NONE; } +static ttt_error_t +_ttt_client_execute_who (ttt_client_t *client, + char **args, + int num_args) +{ + const char *response; + + assert (num_args == 0); + + response = ttt_server_who (client->server); + + ttt_client_send (client, response); + + free (response); + + return TTT_ERROR_NONE; +} + static ttt_error_t _ttt_client_execute_quit (ttt_client_t *client, char **args,