mirror of
https://oauth2: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@github.com/m1ngsama/TNT.git
synced 2026-06-26 08:04:37 +08:00
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.
23 lines
921 B
C
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 */
|