diff options
Diffstat (limited to 'src/cmd.c')
| -rw-r--r-- | src/cmd.c | 40 |
1 files changed, 28 insertions, 12 deletions
@@ -7,34 +7,50 @@ /* A "command" is actually anything the user types, whether or not it starts with a /character. */ -void cmd_chan_text(const char *cmd) { +static char *target; +static const char *command; +static char slashcmd[10]; +static char *slasharg; + +static void cmd_chan_text(void) { char s; - s = scr_getbyname(channel); - scr_activate(s); + scr_activate(scr_current); /* 0x02 = ^B = enable bold */ - scr_print_active("\x02<"); + scr_print_active("<\x02"); scr_print_active(usernick); + scr_print_active("\x02"); if(!s) { scr_print_active("/"); - scr_print_active(channel); + scr_print_active(target); } - scr_print_active(">\x02 "); + scr_print_active(" "); + scr_print_active(command); + scr_print_active(">"); + scr_eol_active(); txbuf_set_str("PRIVMSG "); - txbuf_append_str(channel); + txbuf_append_str(target); txbuf_append_str(" :"); - txbuf_append_str(cmd); + txbuf_append_str(command); txbuf_send(); } +static void cmd_slash(void) { + txbuf_send_str(command + 1); +} + void cmd_command(const char *cmd) { + command = cmd; + + target = scr_get_cur_name(); + if(*cmd == '/') - txbuf_send_str(cmd + 1); - else if(channel[0]) - cmd_chan_text(cmd); - else scr_print_current("*** You are not on a channel\n"); + cmd_slash(); + else if(target) + cmd_chan_text(); + else scr_print_current("*** You are not in a channel\n"); } void cmd_execute(void) { |
