Add -m mode option to set user modes

weechat-hashes
C. McEnroe 2021-06-18 12:28:09 -04:00
parent d3b2f86a4b
commit a5a225c52c
4 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
.Dd June 17, 2021 .Dd June 18, 2021
.Dt CATGIRL 1 .Dt CATGIRL 1
.Os .Os
. .
@ -22,6 +22,7 @@
.Op Fl i Ar ignore .Op Fl i Ar ignore
.Op Fl j Ar join .Op Fl j Ar join
.Op Fl k Ar priv .Op Fl k Ar priv
.Op Fl m Ar mode
.Op Fl n Ar nick .Op Fl n Ar nick
.Op Fl p Ar port .Op Fl p Ar port
.Op Fl r Ar real .Op Fl r Ar real
@ -287,6 +288,10 @@ as configuration files.
Log chat events to files in paths Log chat events to files in paths
.Pa $XDG_DATA_HOME/catgirl/log/network/channel/YYYY-MM-DD.log . .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 .It Fl n Ar nick | Cm nick No = Ar nick
Set nickname to Set nickname to
.Ar nick . .Ar nick .

2
chat.c
View File

@ -180,6 +180,7 @@ int main(int argc, char *argv[]) {
{ .val = 'j', .name = "join", required_argument }, { .val = 'j', .name = "join", required_argument },
{ .val = 'k', .name = "priv", required_argument }, { .val = 'k', .name = "priv", required_argument },
{ .val = 'l', .name = "log", no_argument }, { .val = 'l', .name = "log", no_argument },
{ .val = 'm', .name = "mode", required_argument },
{ .val = 'n', .name = "nick", required_argument }, { .val = 'n', .name = "nick", required_argument },
{ .val = 'o', .name = "print-chain", no_argument }, { .val = 'o', .name = "print-chain", no_argument },
{ .val = 'p', .name = "port", required_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 'j': self.join = optarg;
break; case 'k': priv = optarg; break; case 'k': priv = optarg;
break; case 'l': logEnable = true; break; case 'l': logEnable = true;
break; case 'm': self.mode = optarg;
break; case 'n': nick = optarg; break; case 'n': nick = optarg;
break; case 'o': insecure = true; printCert = true; break; case 'o': insecure = true; printCert = true;
break; case 'p': port = optarg; break; case 'p': port = optarg;

1
chat.h
View File

@ -192,6 +192,7 @@ extern struct Self {
size_t pos; size_t pos;
enum Cap caps; enum Cap caps;
char *plain; char *plain;
char *mode;
char *join; char *join;
char *nick; char *nick;
char *user; char *user;

View File

@ -241,6 +241,7 @@ static void handleReplyWelcome(struct Message *msg) {
require(msg, false, 1); require(msg, false, 1);
set(&self.nick, msg->params[0]); set(&self.nick, msg->params[0]);
completeTouch(Network, self.nick, Default); completeTouch(Network, self.nick, Default);
if (self.mode) ircFormat("MODE %s %s\r\n", self.nick, self.mode);
if (self.join) { if (self.join) {
uint count = 1; uint count = 1;
for (const char *ch = self.join; *ch && *ch != ' '; ++ch) { for (const char *ch = self.join; *ch && *ch != ' '; ++ch) {