about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-02 02:30:35 -0500
committerJune McEnroe <june@causal.agency>2020-02-02 02:30:35 -0500
commit14066b79d424561b0ab4be74574edf6fae422378 (patch)
tree900d4d65fedc1f5b7b6fb3ad33d9f8b70698e5eb
parentCall reset_shell_mode on err (diff)
downloadcatgirl-14066b79d424561b0ab4be74574edf6fae422378.tar.gz
catgirl-14066b79d424561b0ab4be74574edf6fae422378.zip
Handle nickname errors
Diffstat (limited to '')
-rw-r--r--handle.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index 9157419..350a636 100644
--- a/handle.c
+++ b/handle.c
@@ -85,6 +85,17 @@ static const struct tm *tagTime(const struct Message *msg) {
 
 typedef void Handler(struct Message *msg);
 
+static void handleErrorNicknameInUse(struct Message *msg) {
+	if (self.nick) return;
+	require(msg, false, 2);
+	ircFormat("NICK :%s_\r\n", msg->params[1]);
+}
+
+static void handleErrorErroneousNickname(struct Message *msg) {
+	require(msg, false, 3);
+	errx(EX_CONFIG, "%s: %s", msg->params[1], msg->params[2]);
+}
+
 static void handleCap(struct Message *msg) {
 	require(msg, false, 3);
 	enum Cap caps = capParse(msg->params[2]);
@@ -178,6 +189,8 @@ static const struct Handler {
 	{ "001", handleReplyWelcome },
 	{ "005", handleReplyISupport },
 	{ "372", handleReplyMOTD },
+	{ "432", handleErrorErroneousNickname },
+	{ "433", handleErrorNicknameInUse },
 	{ "900", handleReplyLoggedIn },
 	{ "904", handleErrorSASLFail },
 	{ "905", handleErrorSASLFail },
d>Remove tag X macros againJune McEnroe 2019-02-25Add M-a to switch to hot or unread windowJune McEnroe 2019-02-25Refactor uiReadJune McEnroe 2019-02-24Scroll by full pages with PageUp/PageDownJune McEnroe 2019-02-23Clarify /window documentationJune McEnroe 2019-02-23Use first word of params in input commandsJune McEnroe 2019-02-23Add C-n and C-p key bindings to switch windowsJune McEnroe 2019-02-23Change example command to join #ascii.town on freenodeJune McEnroe 2019-02-23Call def_prog_mode after termNoFlowJune McEnroe 2019-02-22Move IRC formatting reset to C-sJune McEnroe 2019-02-22Disable terminal flow controlJune McEnroe 2019-02-22Bind up and down arrows to scrollJune McEnroe 2019-02-22Remove topic TODOJune McEnroe 2019-02-22Add /znc commandJune McEnroe 2019-02-22Update status line after scrolling and term eventsJune McEnroe 2019-02-22Reorganize input.cJune McEnroe 2019-02-22Fix name of <raw> window in man pageJune McEnroe 2019-02-22Rename global tags with angle bracketsJune McEnroe 2019-02-22Show status window while connectingJune McEnroe 2019-02-22Reorganize UI code for the umpteenth timeJune McEnroe 2019-02-21Replace "view" with "window"June McEnroe 2019-02-21Remove ROT13June McEnroe 2019-02-21Clean up man pageJune McEnroe 2019-01-26Draw UI before connectingJune McEnroe 2019-01-25Avoid unused variable warnings with getyxJune McEnroe 2019-01-25Add GNU/Linux build instructionsJune McEnroe