summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-13 18:01:05 -0500
committerJune McEnroe <june@causal.agency>2020-12-13 18:55:23 -0500
commit93507ad30249e63a29e6eb3289f7cb8c1cf0d90b (patch)
tree7d3fb71d3af970aa0d39eddade080bc63ba60ff1
parentDirectly output IRC-to-ANSI conversion (diff)
downloadlitterbox-93507ad30249e63a29e6eb3289f7cb8c1cf0d90b.tar.gz
litterbox-93507ad30249e63a29e6eb3289f7cb8c1cf0d90b.zip
Use nick for color if user is "*"
Not accurate but better than every message being the same color in
imported logs.
-rw-r--r--litterbox.c1
-rw-r--r--scoop.c34
2 files changed, 15 insertions, 20 deletions
diff --git a/litterbox.c b/litterbox.c
index 5a88132..c3bc46e 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -313,6 +313,7 @@ static void querySearch(struct Message *msg) {
 		const char *message = (const char *)sqlite3_column_text(stmt, i++);
 		if (!target) target = "";
 		if (!message) message = "";
+		if (!strcmp(user, "*")) user = nick;
 
 		format("NOTICE %s :(%s) [%s] ", msg->nick, context, time);
 		switch (type) {
diff --git a/scoop.c b/scoop.c
index 992411c..3acc6b1 100644
--- a/scoop.c
+++ b/scoop.c
@@ -159,31 +159,25 @@ static void formatColor(bool group, struct Event e) {
 	printf("[%s] ", e.time);
 
 #define C(x) "\33[%dm" x "\33[m"
+	int c = color(strcmp(e.user, "*") ? e.user : e.nick);
 	switch (e.type) {
-		break; case Privmsg: printf(C("<%s>") " ", color(e.user), e.nick);
-		break; case Notice:  printf(C("-%s-") " ", color(e.user), e.nick);
-		break; case Action:  printf(C("* %s") " ", color(e.user), e.nick);
-		break; case Join: printf(C("%s") " joined", color(e.user), e.nick);
-		break; case Part: printf(C("%s") " parted: ", color(e.user), e.nick);
-		break; case Quit: printf(C("%s") " quit: ", color(e.user), e.nick);
-		break; case Kick: {
-			printf(C("%s") " kicked %s: ", color(e.user), e.nick, e.target);
-		}
+		break; case Privmsg: printf(C("<%s>") " ", c, e.nick);
+		break; case Notice:  printf(C("-%s-") " ", c, e.nick);
+		break; case Action:  printf(C("* %s") " ", c, e.nick);
+		break; case Join: printf(C("%s") " joined", c, e.nick);
+		break; case Part: printf(C("%s") " parted: ", c, e.nick);
+		break; case Quit: printf(C("%s") " quit: ", c, e.nick);
+		break; case Kick: printf(C("%s") " kicked %s: ", c, e.nick, e.target);
 		break; case Nick: {
 			printf(
-				C("%s") " changed nick to " C("%s") "\n",
-				color(e.user), e.nick, color(e.user), e.target
+				C("%s") " changed nick to " C("%s"),
+				c, e.nick,
+				(strcmp(e.user, "*") ? c : color(e.target)), e.target
 			);
 		}
-		break; case Topic: {
-			printf(C("%s") " set the topic: ", color(e.user), e.nick);
-		}
-		break; case Ban: {
-			printf(C("%s") " banned %s", color(e.user), e.nick, e.target);
-		}
-		break; case Unban: {
-			printf(C("%s") " unbanned %s", color(e.user), e.nick, e.target);
-		}
+		break; case Topic: printf(C("%s") " set the topic: ", c, e.nick);
+		break; case Ban:   printf(C("%s") " banned %s", c, e.nick, e.target);
+		break; case Unban: printf(C("%s") " unbanned %s", c, e.nick, e.target);
 	}
 #undef C