summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-18 12:28:09 -0400
committerJune McEnroe <june@causal.agency>2021-06-18 12:28:09 -0400
commita5a225c52c39f438a95b0ed2481ee273aab02640 (patch)
treece756be25021a323d536443e135cbe0286a8cd6e
parentHandle 338 as whois reply (diff)
downloadcatgirl-a5a225c52c39f438a95b0ed2481ee273aab02640.tar.gz
catgirl-a5a225c52c39f438a95b0ed2481ee273aab02640.zip
Add -m mode option to set user modes
-rw-r--r--catgirl.17
-rw-r--r--chat.c2
-rw-r--r--chat.h1
-rw-r--r--handle.c1
4 files changed, 10 insertions, 1 deletions
diff --git a/catgirl.1 b/catgirl.1
index 19a12f2..7e39408 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd June 17, 2021
+.Dd June 18, 2021
 .Dt CATGIRL 1
 .Os
 .
@@ -22,6 +22,7 @@
 .Op Fl i Ar ignore
 .Op Fl j Ar join
 .Op Fl k Ar priv
+.Op Fl m Ar mode
 .Op Fl n Ar nick
 .Op Fl p Ar port
 .Op Fl r Ar real
@@ -287,6 +288,10 @@ as configuration files.
 Log chat events to files in paths
 .Pa $XDG_DATA_HOME/catgirl/log/network/channel/YYYY-MM-DD.log .
 .
+.It Fl m Ar mode | Cm mode No = Ar mode
+Set the user
+.Ar mode .
+.
 .It Fl n Ar nick | Cm nick No = Ar nick
 Set nickname to
 .Ar nick .
diff --git a/chat.c b/chat.c
index 49fc8c0..8816068 100644
--- a/chat.c
+++ b/chat.c
@@ -180,6 +180,7 @@ int main(int argc, char *argv[]) {
 		{ .val = 'j', .name = "join", required_argument },
 		{ .val = 'k', .name = "priv", required_argument },
 		{ .val = 'l', .name = "log", no_argument },
+		{ .val = 'm', .name = "mode", required_argument },
 		{ .val = 'n', .name = "nick", required_argument },
 		{ .val = 'o', .name = "print-chain", no_argument },
 		{ .val = 'p', .name = "port", required_argument },
@@ -222,6 +223,7 @@ int main(int argc, char *argv[]) {
 			break; case 'j': self.join = optarg;
 			break; case 'k': priv = optarg;
 			break; case 'l': logEnable = true;
+			break; case 'm': self.mode = optarg;
 			break; case 'n': nick = optarg;
 			break; case 'o': insecure = true; printCert = true;
 			break; case 'p': port = optarg;
diff --git a/chat.h b/chat.h
index 3b6ac6a..c4499a8 100644
--- a/chat.h
+++ b/chat.h
@@ -192,6 +192,7 @@ extern struct Self {
 	size_t pos;
 	enum Cap caps;
 	char *plain;
+	char *mode;
 	char *join;
 	char *nick;
 	char *user;
diff --git a/handle.c b/handle.c
index de5bc43..0a5d95c 100644
--- a/handle.c
+++ b/handle.c
@@ -241,6 +241,7 @@ static void handleReplyWelcome(struct Message *msg) {
 	require(msg, false, 1);
 	set(&self.nick, msg->params[0]);
 	completeTouch(Network, self.nick, Default);
+	if (self.mode) ircFormat("MODE %s %s\r\n", self.nick, self.mode);
 	if (self.join) {
 		uint count = 1;
 		for (const char *ch = self.join; *ch && *ch != ' '; ++ch) {
or change. I suppose this book had a bit of one, but only in the last two chapters. 2022-07-30Add Normal PeopleJune McEnroe Unbearably straight. Eyerolls and sighs per page off the charts. Shout out to Joanna, I guess. I kinda like the lack of quotation marks though to be honest. After half of the Ruth Ozeki novel and now this, I need to get back to some genre fiction. 2022-07-26Rewrite glitch from new pngoJune McEnroe 2022-07-26Update Care with time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe There is not that much distinct stuff here anymore. 2022-07-03Add The Bone Shard EmperorJune McEnroe Suffers a little bit from middle book but I really enjoyed it. Read it faster than the first one too, despite its length. 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe Mixed bag like most collections of short stories. Some of them are pretty good. The author of the worst written story also has the worst written bio. 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe Absolutely indiscriminately. 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe For some reason I haven't been able to figure out, trying to poll /dev/tty returns POLLNVAL (and this was using 100% CPU looping), but using stderr instead works fine. 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe