diff options
| -rw-r--r-- | README.7 | 6 | ||||
| -rw-r--r-- | catgirl.1 | 19 | ||||
| -rw-r--r-- | chat.c | 3 | ||||
| -rw-r--r-- | chat.h | 6 | ||||
| -rw-r--r-- | command.c | 8 | ||||
| -rw-r--r-- | handle.c | 13 |
6 files changed, 36 insertions, 19 deletions
diff --git a/README.7 b/README.7 index 878e7ce..c4f82e8 100644 --- a/README.7 +++ b/README.7 @@ -1,5 +1,5 @@ .\" To view this file: $ man ./README.7 -.Dd May 22, 2024 +.Dd May 8, 2025 .Dt README 7 .Os "Causal Agency" . @@ -109,6 +109,10 @@ TLS is now ubiquitous and certificates are easy to obtain. .El . +.Sh TESTIMONIALS +.Dq catgirl has like the best scrolling i've ever used in a terminal application +.D1 \(em my friend kylie +. .Sh INSTALLING .Nm requires ncurses and diff --git a/catgirl.1 b/catgirl.1 index f2a2fbb..9f8ceeb 100644 --- a/catgirl.1 +++ b/catgirl.1 @@ -1,4 +1,4 @@ -.Dd May 24, 2024 +.Dd October 28, 2025 .Dt CATGIRL 1 .Os . @@ -128,14 +128,17 @@ will randomize the chosen colours, in case you don't like the ones chosen for yourself or your crush. .Pp -The default is 0,75, -which uses colours -in the 256-colour terminal set. -To use only colours -from the 16-colour terminal set, -use 0,15. +The default is 0,15, +which uses only colours +from the 16-colour terminal set. +A reasonable option +using the 256-colour terminal set +might be 0,75. To disable nick and channel colours, use 0,0. +To use bright white +for all nicks and channels, +use 0,1. . .It Fl I Ar pattern | Cm highlight Ar pattern Add a case-insensitive message highlight pattern, @@ -640,6 +643,8 @@ can usually contain glob-style wildcards. .It Ic /me Op Ar action Send an action message. These are used to write messages in third person. +.It Ic /motd +Show the server's message of the day again. .It Ic /msg Ar nick message Send a private message to someone. .It Ic /names diff --git a/chat.c b/chat.c index bc23c3f..755bd24 100644 --- a/chat.c +++ b/chat.c @@ -125,7 +125,7 @@ static void utilRead(void) { } uint32_t hashInit; -uint32_t hashBound = 75; +uint32_t hashBound = 15; static void parseHash(char *str) { hashInit = strtoul(str, &str, 0); @@ -399,6 +399,7 @@ int main(int argc, char *argv[]) { ircFormat("CAP LS\r\n"); ircFormat("NICK %s\r\n", self.nicks[0]); ircFormat("USER %s 0 * :%s\r\n", user, real); + replies[ReplyMOTD]++; // Avoid disabling VINTR until main loop. inputInit(); diff --git a/chat.h b/chat.h index 369747c..bd69b5e 100644 --- a/chat.h +++ b/chat.h @@ -147,8 +147,9 @@ static inline uint32_t _hash(const char *str) { return hash; } static inline enum Color hash(const char *str) { - if (hashBound < Blue) return Default; - return Blue + _hash(str) % (hashBound + 1 - Blue); + if (!hashBound) return Default; + enum Color color = Black + _hash(str) % (hashBound + 1 - Black); + return (color == Black ? White : color); } extern struct Network { @@ -285,6 +286,7 @@ enum Reply { ReplyJoin, ReplyList, ReplyMode, + ReplyMOTD, ReplyNames, ReplyNamesAuto, ReplyTopic, diff --git a/command.c b/command.c index 9b2b4eb..35e1d63 100644 --- a/command.c +++ b/command.c @@ -361,6 +361,13 @@ static void commandUninvex(uint id, char *params) { channelListMode(id, '-', network.invex, params); } +static void commandMOTD(uint id, char *params) { + (void)id; + (void)params; + ircFormat("MOTD\r\n"); + replies[ReplyMOTD]++; +} + static void commandList(uint id, char *params) { (void)id; if (params) { @@ -588,6 +595,7 @@ static const struct Handler { { "/list", commandList, 0, 0 }, { "/me", commandMe, Multiline, 0 }, { "/mode", commandMode, 0, 0 }, + { "/motd", commandMOTD, 0, 0 }, { "/move", commandMove, 0, 0 }, { "/msg", commandMsg, Multiline, 0 }, { "/names", commandNames, 0, 0 }, diff --git a/handle.c b/handle.c index 0cc7c04..0b01de6 100644 --- a/handle.c +++ b/handle.c @@ -343,16 +343,12 @@ static void handleReplyMOTD(struct Message *msg) { char *line = msg->params[1]; urlScan(Network, NULL, line); if (!strncmp(line, "- ", 2)) { - uiFormat(Network, Cold, tagTime(msg), "\3%d-\3\t%s", Gray, &line[2]); + uiFormat(Network, Warm, tagTime(msg), "\3%d-\3\t%s", Gray, &line[2]); } else { - uiFormat(Network, Cold, tagTime(msg), "%s", line); + uiFormat(Network, Warm, tagTime(msg), "%s", line); } } -static void handleErrorNoMOTD(struct Message *msg) { - (void)msg; -} - static void handleReplyHelp(struct Message *msg) { require(msg, false, 3); urlScan(Network, NULL, msg->params[2]); @@ -1378,10 +1374,11 @@ static const struct Handler { { "367", +ReplyBan, handleReplyBanList }, { "368", -ReplyBan, NULL }, { "369", -ReplyWhowas, handleReplyEndOfWhowas }, - { "372", 0, handleReplyMOTD }, + { "372", +ReplyMOTD, handleReplyMOTD }, + { "376", -ReplyMOTD, NULL }, { "378", +ReplyWhois, handleReplyWhoisGeneric }, { "379", +ReplyWhois, handleReplyWhoisGeneric }, - { "422", 0, handleErrorNoMOTD }, + { "422", -ReplyMOTD, NULL }, { "432", 0, handleErrorErroneousNickname }, { "433", 0, handleErrorNicknameInUse }, { "437", 0, handleErrorNicknameInUse }, |