summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-26 22:37:18 -0400
committerJune McEnroe <june@causal.agency>2019-10-26 22:37:18 -0400
commited4a5d35864edac6da02a2ca3970f45b1279911b (patch)
tree42c08d0b937085ebe746ecd0b1d057a92fe13ae5
parentWait for AUTHENTICATE + from server (diff)
downloadpounce-ed4a5d35864edac6da02a2ca3970f45b1279911b.tar.gz
pounce-ed4a5d35864edac6da02a2ca3970f45b1279911b.zip
Handle nick collision
-rw-r--r--state.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/state.c b/state.c
index ee3ae78..01829a4 100644
--- a/state.c
+++ b/state.c
@@ -162,6 +162,12 @@ static void handleReplyISupport(struct Message *msg) {
 	}
 }
 
+static void handleErrorNicknameInUse(struct Message *msg) {
+	if (self.nick) return;
+	if (!msg->params[1]) errx(EX_PROTOCOL, "ERR_NICKNAMEINUSE without nick");
+	serverFormat("NICK %s_\r\n", msg->params[1]);
+}
+
 static bool fromSelf(const struct Message *msg) {
 	if (!self.nick) return false;
 	size_t len = strlen(self.nick);
@@ -226,6 +232,7 @@ static const struct {
 	{ "004", handleReplyMyInfo },
 	{ "005", handleReplyISupport },
 	{ "332", handleReplyTopic },
+	{ "433", handleErrorNicknameInUse },
 	{ "AUTHENTICATE", handleAuthenticate },
 	{ "CAP", handleCap },
 	{ "ERROR", handleError },
-08-25 14:01:27 -0400'>2017-08-25Install ddateJune McEnroe 2017-08-19Move nethack options to envJune McEnroe 2017-08-17Remove scala syntax fileJune McEnroe 2017-08-06Add wakeJune McEnroe That payload can appear anywhere within an ethernet frame. Wake-on-LAN is funny. 2017-08-04Use $() in install.shJune McEnroe Something gave me the impression that sh did not like this, but it's specified by POSIX. 2017-08-02Create Code Tarmak 3 layoutJune McEnroe 2017-07-31Add tupJune McEnroe 2017-07-31Use designated initializer for hnel tableJune McEnroe I did not know this syntax worked! 2017-07-30Add juneJune McEnroe 2017-07-30Play nethack as ValkyrieJune McEnroe 2017-07-28Add toggle to hnelJune McEnroe 2017-07-28Install slJune McEnroe 2017-07-25Add up, supJune McEnroe 2017-07-24Autopickup ringsJune McEnroe 2017-07-24Name dogJune McEnroe 2017-07-23Add nethackrcJune McEnroe 2017-07-23Remove useless setuid in briJune McEnroe Don't you think it would be better if the setuid bit only gave you permission to do it and didn't do it for you? 2017-07-23Clean up hnel a tiny bitJune McEnroe 2017-07-21Set window size in hnelJune McEnroe 2017-07-21Add hnelJune McEnroe 2017-07-19chmod 600 in dtchJune McEnroe