summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorCurtis McEnroe2018-08-03 19:34:19 -0400
committerCurtis McEnroe2018-08-03 19:34:19 -0400
commit0e99c4891229b7e1c84d476ac9c6848a8098fa84 (patch)
treef3d77e3970ba2edd40bea772149ae34a82524c81 /chat.c
parenta2ea9a9035603f1971058a80afb1fad8fff63a26 (diff)
Handle KICK and NICK
Diffstat (limited to 'chat.c')
-rw-r--r--chat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/chat.c b/chat.c
index d616b91..0482c03 100644
--- a/chat.c
+++ b/chat.c
@@ -271,6 +271,17 @@ static void handleQuit(char *prefix, char *params) {
 		color(user), nick, quot, mesg, quot
 	);
 }
+static void handleKick(char *prefix, char *params) {
+	char *nick = prift(&prefix);
+	char *user = prift(&prefix);
+	char *chan = shift(&params);
+	char *kick = shift(&params);
+	char *mesg = shift(&params);
+	uiFmt(
+		"\3%d%s\3 kicked \3%d%s\3 out of \3%d%s\3, \"%s\"",
+		color(user), nick, color(kick), kick, color(chan), chan, mesg
+	);
+}
 
 static void handle332(char *prefix, char *params) {
 	(void)prefix;
@@ -329,6 +340,16 @@ static void handle315(char *prefix, char *params) {
 	);
 }
 
+static void handleNick(char *prefix, char *params) {
+	char *prev = prift(&prefix);
+	char *user = prift(&prefix);
+	char *next = shift(&params);
+	uiFmt(
+		"\3%d%s\3 is now known as \3%d%s\3",
+		color(user), prev, color(user), next
+	);
+}
+
 static void handlePrivmsg(char *prefix, char *params) {
 	char *nick = prift(&prefix);
 	char *user = prift(&prefix);
@@ -359,6 +380,8 @@ static const struct {
 	{ "352", handle352 },
 	{ "366", handle366 },
 	{ "JOIN", handleJoin },
+	{ "KICK", handleKick },
+	{ "NICK", handleNick },
 	{ "NOTICE", handleNotice },
 	{ "PART", handlePart },
 	{ "PING", handlePing },