about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-23 16:52:24 -0400
committerJune McEnroe <june@causal.agency>2020-03-23 16:52:24 -0400
commit4f40ace9d4cf475d445678e63b3f48cc03cf7d7e (patch)
treea99352ca1396d742369301705071a0cf6a26f851
parentFix non-multiline command newline handling (diff)
downloadcatgirl-4f40ace9d4cf475d445678e63b3f48cc03cf7d7e.tar.gz
catgirl-4f40ace9d4cf475d445678e63b3f48cc03cf7d7e.zip
Track MODE in replies
-rw-r--r--chat.h1
-rw-r--r--command.c2
-rw-r--r--handle.c6
3 files changed, 9 insertions, 0 deletions
diff --git a/chat.h b/chat.h
index 3f93f3d..7ffcfcd 100644
--- a/chat.h
+++ b/chat.h
@@ -187,6 +187,7 @@ extern struct Replies {
 	uint invex;
 	uint join;
 	uint list;
+	uint mode;
 	uint names;
 	uint topic;
 	uint whois;
diff --git a/command.c b/command.c
index 5da8bb9..7339574 100644
--- a/command.c
+++ b/command.c
@@ -185,12 +185,14 @@ static void commandMode(uint id, char *params) {
 			ircFormat("MODE %s %s\r\n", self.nick, params);
 		} else {
 			ircFormat("MODE %s\r\n", self.nick);
+			replies.mode++;
 		}
 	} else {
 		if (params) {
 			ircFormat("MODE %s %s\r\n", idNames[id], params);
 		} else {
 			ircFormat("MODE %s\r\n", idNames[id]);
+			replies.mode++;
 		}
 	}
 }
diff --git a/handle.c b/handle.c
index 376e722..e690caa 100644
--- a/handle.c
+++ b/handle.c
@@ -527,6 +527,9 @@ static const char *UserModes[256] = {
 
 static void handleReplyUserModeIs(struct Message *msg) {
 	require(msg, false, 2);
+	if (!replies.mode) return;
+	replies.mode--;
+
 	char buf[1024] = "";
 	for (char *ch = msg->params[1]; *ch; ++ch) {
 		if (*ch == '+') continue;
@@ -560,6 +563,9 @@ static const char *ChanModes[256] = {
 
 static void handleReplyChannelModeIs(struct Message *msg) {
 	require(msg, false, 3);
+	if (!replies.mode) return;
+	replies.mode--;
+
 	uint param = 3;
 	char buf[1024] = "";
 	for (char *ch = msg->params[2]; *ch; ++ch) {
45&follow=1'>Use dataOpen for save fileJune McEnroe 2020-08-24Use configOpen to load localCAJune McEnroe 2020-08-24Use configPath to load client cert/privJune McEnroe 2020-08-24Use configOpen in getopt_configJune McEnroe 2020-08-24Import xdg.c from catgirlJune McEnroe 2020-08-23Replace “RAND_bytes” by “getentropy”Issam E. Maghni 2020-08-16contrib/palaver: Add no message preview flagsJune McEnroe 2020-08-13contrib/palaver: Don't set channel for PMsJune McEnroe 2020-08-13Fix unintended interception of NICK after registrationJune McEnroe 2020-08-12Add Additional Components section to READMEJune McEnroe 2020-08-12Document -L / palaver optionJune McEnroe 2020-08-11contrib/palaver: Document service configurationJune McEnroe 2020-08-11contrib/palaver: Add install target and rc scriptJune McEnroe 2020-08-11contrib/palaver: Implement command and notificationsJune McEnroe