aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2019-03-13 04:04:08 -0400
committerB. Watson <yalhcru@gmail.com>2019-03-13 04:04:08 -0400
commit6c7c9ce1611a7d5f437f47f4f5da99772d7600a3 (patch)
treea32d34439e8a4158af460fc7e1255195be243fbf
parent293037f30ee89933551421df1a5193c4322179ab (diff)
downloadfujichat-6c7c9ce1611a7d5f437f47f4f5da99772d7600a3.tar.gz
fix /msg and /quit commands (quote argument with colon)
-rw-r--r--src/commands.c11
-rw-r--r--src/features.h3
-rw-r--r--src/fujichat.atrbin92176 -> 92176 bytes
-rw-r--r--src/fujichat.c20
-rw-r--r--src/fujichat.h1
-rw-r--r--src/fujitest.atrbin92176 -> 92176 bytes
6 files changed, 31 insertions, 4 deletions
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
--- a/src/fujichat.atr
+++ b/src/fujichat.atr
Binary files 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
--- a/src/fujitest.atr
+++ b/src/fujitest.atr
Binary files differ