TNT/include/commands.h
m1ngsama 8aa34c75b8 refactor: extract commands module (PR2-M3)
Move the vim-mode `:` command dispatcher (`:list`, `:nick`, `:msg`,
`:last`, `:search`, `:mute-joins`, `:help`, `:clear`, `:q`, …) out of
ssh_server.c into a dedicated module.

New API (include/commands.h):
- commands_dispatch(client_t *)  -- single entry point invoked from
  handle_key when Enter is pressed in MODE_COMMAND.

ssh_server.c shrinks from 1769 to 1513 lines (-256).
Behaviour preserved: implementation is byte-for-byte the same.
2026-05-17 09:26:48 +08:00

23 lines
921 B
C

#ifndef COMMANDS_H
#define COMMANDS_H
#include "ssh_server.h" /* for client_t */
/* Dispatch the COMMAND-mode line currently in client->command_input.
*
* Side effects (visible to the caller):
* - May append to client->command_history
* - Resets client->command_input
* - Writes the rendered output into client->command_output (so the next
* redraw shows it), or returns the client to MODE_NORMAL on `:` then
* Enter on an empty line
* - Sets client->connected = false on `:q` / `:quit` / `:exit`
* - Toggles client->mute_joins on `:mute-joins`
* - May broadcast a system rename message on `:nick`
*
* Reads g_room. Caller must already hold the channel I/O serialisation
* established by handle_key() — this function calls back into client_send
* (via tui_render_command_output) which acquires client->io_lock. */
void commands_dispatch(client_t *client);
#endif /* COMMANDS_H */