diff options
author | June McEnroe <june@causal.agency> | 2021-06-18 12:28:09 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-06-18 12:28:09 -0400 |
commit | a5a225c52c39f438a95b0ed2481ee273aab02640 (patch) | |
tree | ce756be25021a323d536443e135cbe0286a8cd6e | |
parent | Handle 338 as whois reply (diff) | |
download | catgirl-a5a225c52c39f438a95b0ed2481ee273aab02640.tar.gz catgirl-a5a225c52c39f438a95b0ed2481ee273aab02640.zip |
Add -m mode option to set user modes
-rw-r--r-- | catgirl.1 | 7 | ||||
-rw-r--r-- | chat.c | 2 | ||||
-rw-r--r-- | chat.h | 1 | ||||
-rw-r--r-- | handle.c | 1 |
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) { |