summary refs log tree commit diff
path: root/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'server.c')
-rw-r--r--server.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/server.c b/server.c
index 1583d1c..5e23a71 100644
--- a/server.c
+++ b/server.c
@@ -91,7 +91,7 @@ void serverSend(const char *ptr, size_t len) {
 	}
 }
 
-static void format(const char *format, ...) {
+void serverFormat(const char *format, ...) {
 	char buf[513];
 	va_list ap;
 	va_start(ap, format);
@@ -141,7 +141,7 @@ void serverLogin(
 	const char *pass, const char *auth,
 	const char *nick, const char *user, const char *real
 ) {
-	if (pass) format("PASS :%s\r\n", pass);
+	if (pass) serverFormat("PASS :%s\r\n", pass);
 	if (auth) {
 		byte plain[1 + strlen(auth)];
 		plain[0] = 0;
@@ -149,22 +149,20 @@ void serverLogin(
 			plain[1 + i] = (auth[i] == ':' ? 0 : auth[i]);
 		}
 		authBase64 = base64(plain, sizeof(plain));
-		format("CAP REQ :sasl\r\n");
+		serverFormat("CAP REQ :sasl\r\n");
 	}
-	format("NICK %s\r\nUSER %s 0 * :%s\r\n", nick, user, real);
+	serverFormat("NICK %s\r\nUSER %s 0 * :%s\r\n", nick, user, real);
 }
 
 void serverAuth(void) {
 	assert(authBase64);
-	format("AUTHENTICATE PLAIN\r\nAUTHENTICATE %s\r\nCAP END\r\n", authBase64);
+	serverFormat(
+		"AUTHENTICATE PLAIN\r\nAUTHENTICATE %s\r\nCAP END\r\n", authBase64
+	);
 	free(authBase64);
 	authBase64 = NULL;
 }
 
-void serverJoin(const char *join) {
-	format("JOIN :%s\r\n", join);
-}
-
 void serverRecv(void) {
 	static char buf[4096];
 	static size_t len;
@@ -185,7 +183,7 @@ void serverRecv(void) {
 		if (verbose) fprintf(stderr, "\x1B[32m%s\x1B[m\n", line);
 		if (!strncmp(line, "PING ", 5)) {
 			line[1] = 'O';
-			format("%s\r\n", line);
+			serverFormat("%s\r\n", line);
 		} else {
 			// TODO: Add line to ring if stateReady().
 			stateParse(line);
>June McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroetr>2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe 2021-01-12Split fields by tab onlyJune McEnroe 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe 2021-01-09Add c -t flag to print expression typeJune McEnroe 2021-01-05Update taglineJune McEnroe