summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--chat.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/chat.c b/chat.c
index 0303004..7058802 100644
--- a/chat.c
+++ b/chat.c
@@ -294,14 +294,38 @@ static void handleTopic(char *prefix, char *params) {
 	uiTopic(topic);
 }
 
-static void handle353(char *prefix, char *params) {
+static void handle366(char *prefix, char *params) {
 	(void)prefix;
 	shift(&params);
+	char *chan = shift(&params);
+	clientFmt("WHO %s\r\n", chan);
+}
+
+static char whoBuf[4096];
+static size_t whoLen;
+static void handle352(char *prefix, char *params) {
+	(void)prefix;
+	shift(&params);
+	shift(&params);
+	char *user = shift(&params);
+	shift(&params);
+	shift(&params);
+	char *nick = shift(&params);
+	whoLen += snprintf(
+		&whoBuf[whoLen], sizeof(whoBuf) - whoLen,
+		"%s\3%d%s\3",
+		(whoLen ? ", " : ""), color(user), nick
+	);
+}
+static void handle315(char *prefix, char *params) {
+	(void)prefix;
 	shift(&params);
 	char *chan = shift(&params);
-	char *names = shift(&params);
-	// TODO: Do a WHO instead to get usernames
-	uiFmt("In %s are %s", chan, names);
+	whoLen = 0;
+	uiFmt(
+		"In \3%d%s\3 are %s",
+		color(chan), chan, whoBuf
+	);
 }
 
 static void handlePrivmsg(char *prefix, char *params) {
@@ -324,8 +348,10 @@ static const struct {
 	Handler handler;
 } HANDLERS[] = {
 	{ "001", handle001 },
+	{ "315", handle315 },
 	{ "332", handle332 },
-	{ "353", handle353 },
+	{ "352", handle352 },
+	{ "366", handle366 },
 	{ "JOIN", handleJoin },
 	{ "NOTICE", handleNotice },
 	{ "PART", handlePart },
1-09Avoid the reserved _A names with BIT macroJune McEnroe 2019-11-09Define macro for bit flag enumsJune McEnroe 2019-11-08Check that password is hashedJune McEnroe 2019-11-08Avoid calling getopt_long again after it returns -1June McEnroe 2019-11-08Only change AWAY status for registered clientsJune McEnroe 2019-11-07Just write the example normallyJune McEnroe 2019-11-07Include path in readlinkat errorJune McEnroe 2019-11-07Call clientConsume before clientRecvJune McEnroe 2019-11-06Use -l:filename in Linux.mkJune McEnroe 2019-11-06Fix compat.h for #defined strlcpyJune McEnroe 2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe 2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe