about summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-10 23:31:20 -0400
committerJune McEnroe <june@causal.agency>2018-08-10 23:31:20 -0400
commit07c750d25cf26883507d46bf319e55d2e35d6a94 (patch)
treedcf7dbc50dd717a1190c2f034ff440badf5a525c /irc.c
parentMove process spawning onto the event loop (diff)
downloadcatgirl-07c750d25cf26883507d46bf319e55d2e35d6a94.tar.gz
catgirl-07c750d25cf26883507d46bf319e55d2e35d6a94.zip
Become multi-channel
There's a lot of UI missing for it, but it technically works.
Diffstat (limited to '')
-rw-r--r--irc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/irc.c b/irc.c
index b9bef73..579f23b 100644
--- a/irc.c
+++ b/irc.c
@@ -39,7 +39,7 @@ static void webirc(const char *pass) {
 	if (sp) len = sp - ssh;
 	ircFmt(
 		"WEBIRC %s %s %.*s %.*s\r\n",
-		pass, chat.user, len, ssh, len, ssh
+		pass, self.user, len, ssh, len, ssh
 	);
 }
 
@@ -83,11 +83,8 @@ int ircConnect(
 
 	if (webPass) webirc(webPass);
 	if (pass) ircFmt("PASS :%s\r\n", pass);
-	ircFmt(
-		"NICK %s\r\n"
-		"USER %s 0 * :%s\r\n",
-		chat.nick, chat.user, chat.nick
-	);
+	ircFmt("NICK %s\r\n", self.nick);
+	ircFmt("USER %s 0 * :%s\r\n", self.user, self.nick);
 
 	return sock;
 }
@@ -109,7 +106,7 @@ void ircFmt(const char *format, ...) {
 	int len = vasprintf(&buf, format, ap);
 	va_end(ap);
 	if (!buf) err(EX_OSERR, "vasprintf");
-	if (chat.verbose) uiFmt("<<< %.*s", len - 2, buf);
+	if (self.verbose) uiFmt(tagFor("(irc)"), "\00314<<<\3 %.*s", len - 2, buf);
 	ircWrite(buf, len);
 	free(buf);
 }
@@ -129,7 +126,7 @@ void ircRead(void) {
 	char *crlf, *line = buf;
 	while ((crlf = strnstr(line, "\r\n", &buf[len] - line))) {
 		crlf[0] = '\0';
-		if (chat.verbose) uiFmt(">>> %s", line);
+		if (self.verbose) uiFmt(tagFor("(irc)"), "\00314>>>\3 %s", line);
 		handle(line);
 		line = &crlf[2];
 	}