diff options
author | June McEnroe | 2022-05-29 18:09:52 -0400 |
---|---|---|
committer | June McEnroe | 2022-05-29 18:09:52 -0400 |
commit | 3475f03ec8c9ee26544c17b5f3d1cba7b1104f5e (patch) | |
tree | 51a7b2881e54369316856602f297827803a4ad53 /chat.c | |
parent | a5162d83bd0f91ee41292798743042606428bfb0 (diff) |
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.
Diffstat (limited to 'chat.c')
-rw-r--r-- | chat.c | 17 |
1 files changed, 10 insertions, 7 deletions
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. |