#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. */ void cmd_chan_text(const char *cmd) { char s; s = scr_getbyname(channel); scr_activate(s); /* 0x02 = ^B = enable bold */ scr_print_active("\x02<"); scr_print_active(usernick); if(!s) { scr_print_active("/"); scr_print_active(channel); } scr_print_active(">\x02 "); txbuf_set_str("PRIVMSG "); txbuf_append_str(channel); txbuf_append_str(" :"); txbuf_append_str(cmd); txbuf_send(); } void cmd_command(const char *cmd) { 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"); } void cmd_execute(void) { cmd_command(edit_box); }