hirc

IRC client
Log | Files | Refs

commit 8d91edeec256c0b4c224efb408472f4b079ed5e8
parent 2fe444c9937ee1eb82d2099792624421b3899b85
Author: hhvn <dev@hhvn.uk>
Date:   Tue,  7 Dec 2021 21:04:18 +0000

commands.c: /echo command

Diffstat:
Mcommands.c | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/commands.c b/commands.c @@ -23,6 +23,7 @@ static void command_names(struct Server *server, char *str); static void command_topic(struct Server *server, char *str); static void command_bind(struct Server *server, char *str); static void command_help(struct Server *server, char *str); +static void command_echo(struct Server *server, char *str); static char *command_optarg; enum { @@ -90,6 +91,9 @@ struct Command commands[] = { "usage: /help [command or variable]", "Print help information.", "`/help commands` and `/help variables` will list respectively", NULL}}, + {"echo", command_echo, { + "usage: /echo ...", + "Print temporarily to selected buffer.", NULL}}, {NULL, NULL}, }; @@ -618,6 +622,14 @@ command_help(struct Server *server, char *str) { ui_error("no help on '%s'", str); } +static void +command_echo(struct Server *server, char *str) { + if (!str) + str = ""; + + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP, "SELF_UI :%s", str); +} + int command_getopt(char **str, struct CommandOpts *opts) { char *opt;