summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-03-29 18:23:12 -0400
committerJune McEnroe <june@causal.agency>2022-03-29 18:23:12 -0400
commit057fe476c800d7a8e86af3bc49bd5efff8eba28d (patch)
tree167b6d0799b429a78324725b0a7bf9ebb7213a23
parentSet clientOrigin from bindHost, add dot if necessary (diff)
downloadpounce-057fe476c800d7a8e86af3bc49bd5efff8eba28d.tar.gz
pounce-057fe476c800d7a8e86af3bc49bd5efff8eba28d.zip
Track account name from 900 numeric
-rw-r--r--bounce.h1
-rw-r--r--state.c16
2 files changed, 10 insertions, 7 deletions
diff --git a/bounce.h b/bounce.h
index d714f97..8987e38 100644
--- a/bounce.h
+++ b/bounce.h
@@ -238,6 +238,7 @@ void clientConsume(struct Client *client);
 
 extern bool stateNoNames;
 extern enum Cap stateCaps;
+extern char *stateAccount;
 extern bool stateAway;
 void stateLogin(
 	const char *pass, enum Cap blind, const char *plain,
diff --git a/state.c b/state.c
index c3fc96c..b1d5573 100644
--- a/state.c
+++ b/state.c
@@ -38,6 +38,7 @@
 
 bool stateNoNames;
 enum Cap stateCaps;
+char *stateAccount;
 bool stateAway;
 
 typedef void Handler(struct Message *msg);
@@ -52,6 +53,12 @@ static void require(const struct Message *msg, bool origin, size_t len) {
 	}
 }
 
+static void set(char **field, const char *value) {
+	if (*field) free(*field);
+	*field = strdup(value);
+	if (!*field) err(EX_OSERR, "strdup");
+}
+
 // Maximum size of one AUTHENTICATE message.
 enum { AuthLen = 299 };
 static char plainBase64[BASE64_SIZE(AuthLen)];
@@ -127,7 +134,8 @@ static void handleAuthenticate(struct Message *msg) {
 }
 
 static void handleReplyLoggedIn(struct Message *msg) {
-	(void)msg;
+	require(msg, false, 3);
+	set(&stateAccount, msg->params[2]);
 	serverFormat("CAP END\r\n");
 }
 
@@ -166,12 +174,6 @@ bool stateReady(void) {
 		&& intro.myInfo[0];
 }
 
-static void set(char **field, const char *value) {
-	if (*field) free(*field);
-	*field = strdup(value);
-	if (!*field) err(EX_OSERR, "strdup");
-}
-
 static void handleErrorNicknameInUse(struct Message *msg) {
 	if (self.nick) return;
 	require(msg, false, 2);
mmit/contrib/palaver/notify.c?h=2.1p1&id=12ba0a0b67b3aef829a6fc4588ad86725bd69454&follow=1'>contrib/palaver: Use pounce's XDG directoryJune McEnroe 2020-08-27contrib/palaver: Only allow HTTPSJune McEnroe 2020-08-25Support the pounce_env rc variableJune McEnroe 2020-08-25Remove deprecated option namesJune McEnroe 2020-08-25Document configuration and data file searchJune McEnroe 2020-08-24Use dataOpen for save fileJune McEnroe 2020-08-24Use configOpen to load localCAJune McEnroe 2020-08-24Use configPath to load client cert/privJune McEnroe 2020-08-24Use configOpen in getopt_configJune McEnroe 2020-08-24Import xdg.c from catgirlJune McEnroe 2020-08-23Replace “RAND_bytes” by “getentropy”Issam E. Maghni 2020-08-16contrib/palaver: Add no message preview flagsJune McEnroe 2020-08-13contrib/palaver: Don't set channel for PMsJune McEnroe 2020-08-13Fix unintended interception of NICK after registrationJune McEnroe 2020-08-12Add Additional Components section to READMEJune McEnroe 2020-08-12Document -L / palaver optionJune McEnroe 2020-08-11contrib/palaver: Document service configurationJune McEnroe 2020-08-11contrib/palaver: Add install target and rc scriptJune McEnroe 2020-08-11contrib/palaver: Implement command and notificationsJune McEnroe