#include #include #include "irc.h" #include "addrs.h" #include "screen.h" /* A "command" is actually anything the user types, whether or not it starts with a /character. */ static char *target; static const char *command; static char slashcmd[10]; static char *slasharg; static void cmd_chan_text(void) { char s; scr_activate(scr_current); /* 0x02 = ^B = enable bold */ scr_print_active("<\x02"); scr_print_active(usernick); scr_print_active("\x02"); if(!s) { scr_print_active("/"); scr_print_active(target); } scr_print_active(" "); scr_print_active(command); scr_print_active(">"); scr_eol_active(); txbuf_set_str("PRIVMSG "); txbuf_append_str(target); txbuf_append_str(" :"); 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 == '/') cmd_slash(); else if(target) cmd_chan_text(); else scr_print_current("*** You are not in a channel\n"); } void cmd_execute(void) { cmd_command(edit_box); }