diff options
Diffstat (limited to 'src/cmd.c')
| -rw-r--r-- | src/cmd.c | 57 |
1 files changed, 44 insertions, 13 deletions
@@ -46,9 +46,9 @@ cmd_t command_defs[] = { { "COLOR", do_color, 1 }, { "CTCP", do_ctcp, 1 }, { "INFO", do_info, 0 }, - { "J", do_j, 1 }, + { "J", do_j, 0 }, { "J1", do_j1, 1 }, - { "JOIN", do_j, 1 }, + { "JOIN", do_j, 0 }, { "JOIN1", do_j1, 1 }, { "LIST", do_list, 1 }, { "M", do_msg, 1 }, @@ -137,12 +137,35 @@ static char *nextarg(char *arg) { return 0; } -static void do_j1(void) { +static char have_commas(void) { + if(strchr(arg1, ',')) { + err_marker(); + scr_print_current("JOIN doesn't support commas\n"); + return 1; + } + return 0; +} + +static void join_arg1(void) { txbuf_set_str2("JOIN ", arg1); txbuf_send(); } +static void do_j1(void) { + if(have_commas()) + return; + join_arg1(); +} + static void do_j(void) { + if(!arg1) + arg1 = target; /* rejoin channel if window is 'dead' */ + if(!arg1) { + err_no_scr_target(); + return; + } + if(have_commas()) + return; if(!scr_getbyname(arg1)) scr_create(arg1, 1); do_j1(); @@ -229,14 +252,13 @@ static void send_ctcp(void) { txbuf_send(); } -long read_rtclok(void) { - return (OS.rtclok[0] << 16) | (OS.rtclok[1] << 8) | OS.rtclok[2]; +/* only the bottom 15 bits! */ +unsigned int read_rtclok(void) { + return ((OS.rtclok[1] << 8) | (OS.rtclok[2])) & 0x7fff; } static void rtclok_to_numbuf(void) { - long r; - r = read_rtclok(); - ltoa(r, numbuf, 10); + itoa(read_rtclok(), numbuf, 10); } static void do_ctcp_ping(void) { @@ -286,7 +308,7 @@ static void do_me(void) { scr_print_current(usernick); scr_print_current("\x02 "); scr_print_current(arg1); - scr_print_current("\n"); + scr_eol_current(); } static void do_ping(void) { @@ -338,18 +360,17 @@ static void do_query(void) { } scr_print_current("Starting conversation with "); scr_print_current(arg1); - scr_print_current("\n"); + scr_eol_current(); } static void do_msg(void) { - char s; arg2 = nextarg(arg1); if(arg2) { scr_print_current("->*"); scr_print_current(arg1); scr_print_current("* "); scr_print_current(arg2); - scr_print_current("\n"); + scr_eol_current(); txbuf_set_str3("PRIVMSG ", arg1, " :"); txbuf_append_str(arg2); @@ -376,7 +397,7 @@ static int cmd_local(void) { /* scr_print_current("command: "); scr_print_current(command); - scr_print_current("\n"); + scr_eol_current(); */ for(cmd_def = &command_defs[0]; cmd_def->cmd; cmd_def++) { @@ -432,3 +453,13 @@ void cmd_execute(void) { if(!*edit_box) return; cmd_command(edit_box); } + +void cmd_rejoin_chans(void) { + char i; + for(i = 2; i < MAX_SCREENS; i++) { + if(scr_names[i][0] == '#') { + arg1 = scr_names[i]; + join_arg1(); + } + } +} |
