From a281f89592cf5531ebf53863768fccd054de252c Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 11 Aug 2018 19:30:30 -0400 Subject: 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. --- chat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'chat.c') diff --git a/chat.c b/chat.c index ed33fbd..5542c82 100644 --- a/chat.c +++ b/chat.c @@ -60,7 +60,7 @@ static union { void spawn(char *const argv[]) { if (fds.pipe.events) { - uiLog(TAG_DEFAULT, L"spawn: existing pipe"); + uiLog(TAG_STATUS, L"spawn: existing pipe"); return; } @@ -93,7 +93,7 @@ static void pipeRead(void) { if (len) { buf[len] = '\0'; len = strcspn(buf, "\n"); - uiFmt(TAG_DEFAULT, "%.*s", (int)len, buf); + uiFmt(TAG_STATUS, "spawn: %.*s", (int)len, buf); } else { close(fds.pipe.fd); fds.pipe.events = 0; @@ -124,15 +124,15 @@ static void sigchld(int sig) { pid_t pid = wait(&status); if (pid < 0) err(EX_OSERR, "wait"); if (WIFEXITED(status) && WEXITSTATUS(status)) { - uiFmt(TAG_DEFAULT, "spawn: exit %d", WEXITSTATUS(status)); + uiFmt(TAG_STATUS, "spawn: exit %d", WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { - uiFmt(TAG_DEFAULT, "spawn: signal %d", WTERMSIG(status)); + uiFmt(TAG_STATUS, "spawn: signal %d", WTERMSIG(status)); } } static void sigint(int sig) { (void)sig; - input(TAG_DEFAULT, "/quit"); + input(TAG_STATUS, "/quit"); uiExit(); exit(EX_OK); } @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { inputTab(); uiInit(); - uiLog(TAG_DEFAULT, L"Traveling..."); + uiLog(TAG_STATUS, L"Traveling..."); uiDraw(); fds.irc.fd = ircConnect(host, port, pass, webirc); -- cgit 1.4.1