From 3475f03ec8c9ee26544c17b5f3d1cba7b1104f5e Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 29 May 2022 18:09:52 -0400 Subject: Allow setting fallback nicks and highlight on any As a side-effect, even with only one nick set you'll still be highlighted by it even if your current nick is different. --- chat.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'chat.c') diff --git a/chat.c b/chat.c index b74fdc0..2d35771 100644 --- a/chat.c +++ b/chat.c @@ -237,7 +237,6 @@ int main(int argc, char *argv[]) { bool log = false; bool sasl = false; char *pass = NULL; - const char *nick = NULL; const char *user = NULL; const char *real = NULL; @@ -306,7 +305,11 @@ int main(int argc, char *argv[]) { break; case 'k': priv = optarg; break; case 'l': log = true; logOpen(); break; case 'm': self.mode = optarg; - break; case 'n': nick = optarg; + break; case 'n': { + for (uint i = 0; i < ARRAY_LEN(self.nicks); ++i) { + self.nicks[i] = strsep(&optarg, " "); + } + } break; case 'o': printCert = true; break; case 'p': port = optarg; break; case 'q': windowThreshold = Warm; @@ -333,10 +336,10 @@ int main(int argc, char *argv[]) { return EX_OK; } - if (!nick) nick = getenv("USER"); - if (!nick) errx(EX_CONFIG, "USER unset"); - if (!user) user = nick; - if (!real) real = nick; + if (!self.nicks[0]) self.nicks[0] = getenv("USER"); + if (!self.nicks[0]) errx(EX_CONFIG, "USER unset"); + if (!user) user = self.nicks[0]; + if (!real) real = self.nicks[0]; if (self.kiosk) { char *hash; @@ -404,7 +407,7 @@ int main(int argc, char *argv[]) { } if (sasl) ircFormat("CAP REQ :sasl\r\n"); ircFormat("CAP LS\r\n"); - ircFormat("NICK :%s\r\n", nick); + ircFormat("NICK %s\r\n", self.nicks[0]); ircFormat("USER %s 0 * :%s\r\n", user, real); // Avoid disabling VINTR until main loop. -- cgit 1.4.1-2-gfad0