From 1815d26c7042d3d592e624d8edf73805c7b3bc6d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 8 Mar 2026 04:03:03 -0400 Subject: Send PMs to the correct window, more protocol stuff, add start+esc hotkey. --- src/cmd.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'src/cmd.c') diff --git a/src/cmd.c b/src/cmd.c index ea3f9fa..f4e94b6 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -15,6 +15,7 @@ static char *target; static void do_color(void); static void do_info(void); static void do_j(void); +static void do_j1(void); static void do_list(void); static void do_me(void); static void do_msg(void); @@ -23,6 +24,7 @@ static void do_ping(void); static void do_query(void); static void do_quit(void); static void do_quote(void); +static void do_topic(void); static void do_ver(void); typedef struct { @@ -38,7 +40,9 @@ cmd_t command_defs[] = { { "COLOR", do_color, 1 }, { "INFO", do_info, 0 }, { "J", do_j, 1 }, + { "J1", do_j1, 1 }, { "JOIN", do_j, 1 }, + { "JOIN1", do_j1, 1 }, { "LIST", do_list, 1 }, { "M", do_msg, 1 }, { "ME", do_me, 1 }, @@ -49,6 +53,7 @@ cmd_t command_defs[] = { { "QUERY", do_query, 1 }, { "QUIT", do_quit, 0 }, { "QUOTE", do_quote, 1 }, + { "TOPIC", do_topic, 0 }, { "VER", do_ver, 0 }, { "VERSION", do_ver, 0 }, { 0, 0 } @@ -130,12 +135,17 @@ static char *nextarg(char *arg) { return 0; } -static void do_j(void) { - /* TODO: add to channel list, once we have one */ +static void do_j1(void) { txbuf_set_str2("JOIN ", arg1); txbuf_send(); } +static void do_j(void) { + if(!scr_getbyname(arg1)) + scr_create(arg1, 1); + do_j1(); +} + static void do_quit(void) { txbuf_set_str("QUIT"); if(arg1) @@ -162,6 +172,25 @@ static void do_part(void) { txbuf_send(); } +static void do_topic(void) { + if(arg1[0] == '#') { + target = arg1; + arg2 = nextarg(arg1); + } else { + arg2 = arg1; + } + + if(!target) { + err_target_req(); + return; + } + + txbuf_set_str2("TOPIC ", target); + if(arg2) + txbuf_append_str2(" :", arg2); + txbuf_send(); +} + static void do_server_info(void) { txbuf_send_str("INFO"); } @@ -316,7 +345,10 @@ static void cmd_slash(void) { void cmd_command(char *cmd) { command = cmd; - target = scr_get_cur_name(); + if(scr_current > 1) + target = scr_get_cur_name(); + else + target = 0; if(cmd[0] == '/' && cmd[1] && cmd[1] != '/') cmd_slash(); -- cgit v1.2.3