]> git.cworth.org Git - ttt/blobdiff - src/ttt-client.c
* AUTHORS: Add Richard D. Worth
[ttt] / src / ttt-client.c
index 1c23fcc3aced5d29ffa25ba19b4c3bebde00fa50..9c9b819f8c1a3dfeebcbe5c693e58811bca45c9b 100644 (file)
@@ -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,