about summary refs log tree commit diff
path: root/reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'reply.c')
-rw-r--r--reply.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/reply.c b/reply.c
index eaa56f4..2aa0e9b 100644
--- a/reply.c
+++ b/reply.c
@@ -29,8 +29,11 @@
 #define M5(x, ...) ARG(x); M4(__VA_ARGS__)
 #define M6(x, ...) ARG(x); M5(__VA_ARGS__)
 #define M7(x, ...) ARG(x); M6(__VA_ARGS__)
-#define GET_M(_0,_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
-#define ARGS(_0, ...) GET_M(_0,__VA_ARGS__,M7,M6,M5,M4,M3,M2,M1,M0,)(__VA_ARGS__,)
+#define M8(x, ...) ARG(x); M7(__VA_ARGS__)
+#define M10(x, ...) ARG(x); M9(__VA_ARGS__)
+#define M11(x, ...) ARG(x); M10(__VA_ARGS__)
+#define GET_M(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,NAME,...) NAME
+#define ARGS(_0, ...) GET_M(_0,__VA_ARGS__,M11,M10,M9,M8,M7,M6,M5,M4,M3,M2,M1,M0,)(__VA_ARGS__,)
 
 /*
  * REPLY macro allows to write less boilerplate for each IRC reply
@@ -71,6 +74,18 @@ vreply(const struct Peer *peer, int number, va_list ap)
 		peer->user,
 		peer->host
 	), _);
+	REPLY(221, WRITE(
+		":%s 221 %s +%s%s%s%s%s%s%s",
+		hostname,
+		getnick(peer),
+		peer->modes & AWAY ? "a" : "",
+		peer->modes & INVISIBLE ? "i" : "",
+		peer->modes & WALLOPS ? "w" : "",
+		peer->modes & RESTRICTED ? "r" : "",
+		peer->modes & OPER ? "o" : "",
+		peer->modes & LOCALOPER ? "O" : "",
+		peer->modes & SNOTICE ? "s" : ""
+	), _);
 	REPLY(401, WRITE(
 		":%s 401 %s %s :No such nick/channel",
 		hostname,
@@ -138,7 +153,18 @@ vreply(const struct Peer *peer, int number, va_list ap)
 		getnick(peer),
 		channel
 	), channel, _);
-	default: warn("unknown reply: %d", number); WRITE(
+	REPLY(484, WRITE(
+		":%s 484 %s :Your connection is restricted!",
+		hostname,
+		getnick(peer)
+	), _);
+	REPLY(501, WRITE(
+		":%s 501 %s :Unknown MODE flag (+%c)",
+		hostname,
+		getnick(peer),
+		*m
+	), m, _);
+	default: warn("unknown reply: %d", number); return WRITE(
 		":%s 421 %s err :Reply %d is not implemented yet",
 		hostname,
 		getnick(peer),