From 6c7c9ce1611a7d5f437f47f4f5da99772d7600a3 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 13 Mar 2019 04:04:08 -0400 Subject: fix /msg and /quit commands (quote argument with colon) --- src/commands.c | 11 ++++++++--- src/features.h | 3 +++ src/fujichat.atr | Bin 92176 -> 92176 bytes src/fujichat.c | 20 +++++++++++++++++++- src/fujichat.h | 1 + src/fujitest.atr | Bin 92176 -> 92176 bytes 6 files changed, 31 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/commands.c b/src/commands.c index 001f384..c7e0f9a 100644 --- a/src/commands.c +++ b/src/commands.c @@ -13,7 +13,7 @@ void cmd_msg(void); void cmd_nick(void); void cmd_part(void); void cmd_ping(void); -// void cmd_quit(void); +void cmd_quit(void); void cmd_quote(void); void cmd_ver(void); void do_me(void); @@ -30,7 +30,7 @@ fuji_cmd_t cmd_list[] = { { "NICK", ARGTYPE_REQUIRED, cmd_nick }, { "PART", ARGTYPE_NONE, cmd_part }, { "PING", ARGTYPE_REQUIRED, cmd_ping }, - // { "QUIT", ARGTYPE_OPT, cmd_quit }, + { "QUIT", ARGTYPE_OPT, cmd_quit }, { "QUOTE", ARGTYPE_REQUIRED, cmd_quote }, { "VER", ARGTYPE_REQUIRED, cmd_ver }, { "VERSION", ARGTYPE_REQUIRED, cmd_ver }, @@ -104,7 +104,12 @@ void cmd_part(void) { } void cmd_msg(void) { - send_server_cmd("PRIVMSG", cmd_arg); + send_server_cmd_2arg("PRIVMSG", cmd_arg); +} + +void cmd_quit(void) { + joined_channel = 0; + send_server_cmd("QUIT", cmd_arg); } void cmd_quote(void) { diff --git a/src/features.h b/src/features.h index ec7d194..90f0cd9 100644 --- a/src/features.h +++ b/src/features.h @@ -1,6 +1,9 @@ #ifndef FEATURES_H #define FEATURES_H +/* Note: just defining one of these doesn't result in a 64 or + 80 column build. You also have to run mkfuji64.sh or + mkfuji80.sh to built the final .xex and disk image. */ // #define FEAT_COL64_HACK // #define FEAT_COL80_HACK diff --git a/src/fujichat.atr b/src/fujichat.atr index 613a085..21c058b 100644 Binary files a/src/fujichat.atr and b/src/fujichat.atr differ diff --git a/src/fujichat.c b/src/fujichat.c index c6412c6..cf147cf 100644 --- a/src/fujichat.c +++ b/src/fujichat.c @@ -578,7 +578,7 @@ void send_serv_msg_buf(void) { void send_server_cmd(char *cmd, char *arg) { if(arg) { - serv_msg_buf_len = sprintf(serv_msg_buf, "%s %s%c", cmd, arg, NL); + serv_msg_buf_len = sprintf(serv_msg_buf, "%s :%s%c", cmd, arg, NL); } else { serv_msg_buf_len = sprintf(serv_msg_buf, "%s%c", cmd, NL); } @@ -586,6 +586,24 @@ void send_server_cmd(char *cmd, char *arg) { send_serv_msg_buf(); } +/* 20190313 bkw: for the /msg command and similar. arg contains the + full argument (nick and text). We have to quote the text + with a colon. User enters "/m nick this stuff" and we say + to the server "PRIVMSG nick :this stuff" */ +void send_server_cmd_2arg(char *cmd, char *arg) { + char *p; + + for(p = arg; *p; p++) { + if(*p == ' ') { + *p = '\0'; + serv_msg_buf_len = sprintf(serv_msg_buf, "%s %s :%s%c", cmd, arg, p + 1, NL); + send_serv_msg_buf(); + return; + } + } + puts("> Invalid argument"); +} + /* The telnet_* functions are uIP application callbacks. */ void telnet_connected(struct telnet_state *s) { /* puts("Connected to host, press START to disconnect"); */ diff --git a/src/fujichat.h b/src/fujichat.h index 6b899ea..b85a980 100644 --- a/src/fujichat.h +++ b/src/fujichat.h @@ -84,6 +84,7 @@ extern char *input_buf; void send_serv_msg_buf(void); void send_server_cmd(char *cmd, char *arg); +void send_server_cmd_2arg(char *cmd, char *arg); void handle_command(void); void bell(); diff --git a/src/fujitest.atr b/src/fujitest.atr index 7157856..3364acc 100644 Binary files a/src/fujitest.atr and b/src/fujitest.atr differ -- cgit v1.2.3