summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-11 19:30:30 -0400
committerJune McEnroe <june@causal.agency>2018-08-11 20:02:03 -0400
commita281f89592cf5531ebf53863768fccd054de252c (patch)
tree502042617c3909ed5143d3e51562a7314666b250 /irc.c
parentAdd term.c for extra terminal features (diff)
downloadcatgirl-a281f89592cf5531ebf53863768fccd054de252c.tar.gz
catgirl-a281f89592cf5531ebf53863768fccd054de252c.zip
Rework UI code for multi-channel
Tags are now permanently assigned (and I'm betting on never needing more
than 256 of them) and the UI maps tags to a linked list of views for
easy reordering and removal. Currently, views can only be added. Views
don't have a topic window until they need one. All UI code wants to be
functional reactive.

Beeping is temporarily removed until message priorities (status,
message, ping) can be added to the UI. At that point spawning
notify-send should also be possible. Priorities will also help with
unnecessary markers, which will not appear for status messages.

The tab system is now used to send QUIT and NICK messages to all the
relevant tags. Verbose output now goes to its own tag, and sending to
it sends raw IRC.

IRC colors are now listed in chat.h and handler functions for numeric
replies have real names. The color algorithm now uses a real hash
function for hopefully better results. QUIT, PART and KICK messages are
scanned for URLs.
Diffstat (limited to '')
-rw-r--r--irc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/irc.c b/irc.c
index 579f23b..0a131b2 100644
--- a/irc.c
+++ b/irc.c
@@ -106,15 +106,15 @@ void ircFmt(const char *format, ...) {
 	int len = vasprintf(&buf, format, ap);
 	va_end(ap);
 	if (!buf) err(EX_OSERR, "vasprintf");
-	if (self.verbose) uiFmt(tagFor("(irc)"), "\00314<<<\3 %.*s", len - 2, buf);
+	if (self.verbose) uiFmt(TAG_VERBOSE, "\3%d<<<\3 %.*s", IRC_WHITE, len - 2, buf);
 	ircWrite(buf, len);
 	free(buf);
 }
 
-static char buf[4096];
-static size_t len;
-
 void ircRead(void) {
+	static char buf[4096];
+	static size_t len;
+
 	ssize_t read = tls_read(client, &buf[len], sizeof(buf) - len);
 	if (read < 0) errx(EX_IOERR, "tls_read: %s", tls_error(client));
 	if (!read) {
@@ -126,7 +126,7 @@ void ircRead(void) {
 	char *crlf, *line = buf;
 	while ((crlf = strnstr(line, "\r\n", &buf[len] - line))) {
 		crlf[0] = '\0';
-		if (self.verbose) uiFmt(tagFor("(irc)"), "\00314>>>\3 %s", line);
+		if (self.verbose) uiFmt(TAG_VERBOSE, "\3%d>>>\3 %s", IRC_GRAY, line);
 		handle(line);
 		line = &crlf[2];
 	}