about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-03-08 10:47:18 -0500
committerJune McEnroe <june@causal.agency>2021-03-08 10:47:18 -0500
commit6435dfdda5c50b0244260d881210538c81d43fa0 (patch)
treee86f4c0a2c54a1a11a4f7bd78f1a294e6cb95a25
parentAdd bindings for C-Left and C-Right (diff)
downloadcatgirl-6435dfdda5c50b0244260d881210538c81d43fa0.tar.gz
catgirl-6435dfdda5c50b0244260d881210538c81d43fa0.zip
Disable nick and channel colors with hash bound 0
-rw-r--r--catgirl.17
-rw-r--r--chat.c1
-rw-r--r--chat.h1
3 files changed, 6 insertions, 3 deletions
diff --git a/catgirl.1 b/catgirl.1
index 0543be3..72c0408 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd February 15, 2021
+.Dd March  8, 2021
 .Dt CATGIRL 1
 .Os
 .
@@ -96,12 +96,15 @@ The default is the first available of
 .
 .It Fl H Ar init,bound , Cm hash = Ar init,bound
 Set the initial value of
-the nick color hash function
+the nick and channel
+color hash function
 and the maximum IRC color value used.
 The default is 0,75.
 To use only colors from
 the 16-color terminal set,
 use 0,15.
+To disable nick and channel colors,
+use 0,0.
 .
 .It Fl I Ar pattern , Cm highlight = Ar pattern
 Add a case-insensitive message highlight pattern,
diff --git a/chat.c b/chat.c
index 60ec7d2..7335520 100644
--- a/chat.c
+++ b/chat.c
@@ -123,7 +123,6 @@ uint32_t hashBound = 75;
 static void parseHash(char *str) {
 	hashInit = strtoul(str, &str, 0);
 	if (*str) hashBound = strtoul(&str[1], NULL, 0);
-	if (hashBound < 2) errx(EX_USAGE, "hash bound must be >= 2");
 }
 
 #ifdef __OpenBSD__
diff --git a/chat.h b/chat.h
index 6a21930..8249564 100644
--- a/chat.h
+++ b/chat.h
@@ -139,6 +139,7 @@ static inline uint idFor(const char *name) {
 extern uint32_t hashInit;
 extern uint32_t hashBound;
 static inline enum Color hash(const char *str) {
+	if (hashBound < Blue) return Default;
 	if (*str == '~') str++;
 	uint32_t hash = hashInit;
 	for (; *str; ++str) {
ight'> 2020-08-15Check if pipe is writable in wrapperJune McEnroe 2020-08-15Parse config laterJune McEnroe This is just to keep the list of open file descriptors tidier, since parsing the config creates many pipes. 2020-08-15Only log signals other than SIGTERMJune McEnroe 2020-08-15Clarify restart interval in catsitd manualJune McEnroe 2020-08-15Fix resetting restart interval with explicit restartJune McEnroe 2020-08-15Add reset interval after which restart interval is resetJune McEnroe 2020-08-15Log when service name pattern doesn't matchJune McEnroe 2020-08-15Add FreeBSD rc scriptJune McEnroe I'm expecting to also have an OpenBSD rc script. 2020-08-15Call setproctitle with number of servicesJune McEnroe 2020-08-15Rename project to catsitJune McEnroe 2020-08-15Use only LOG_NOTICE and LOG_WARNINGJune McEnroe These are the two priorities that go to a normal place (/var/log/messages) by default. 2020-08-15Make log messages consistentJune McEnroe 2020-08-15Remove closelog callJune McEnroe It's unclear whether closelog is really safe to call in pre-exec context, so just trust that the log is opened with CLOEXEC. 2020-08-15Implement service statusJune McEnroe 2020-08-15Parse control commandsJune McEnroe 2020-08-15Read service pipesJune McEnroe Changed line reading functions to return const char * because modifying the strings by adding '\0' into them screws up the following call. 2020-08-15Implement non-blocking line-buffered readingJune McEnroe 2020-08-15Generate tags fileJune McEnroe 2020-08-15Just use CLOCK_MONOTONIC and clean up includesJune McEnroe CLOCK_MONOTONIC exists everywhere. 2020-08-15Reap childrenJune McEnroe 2020-08-14Implement serviceSignal, serviceStop, serviceRestartJune McEnroe 2020-08-14Reset restartInterval and restartDeadline on startJune McEnroe 2020-08-14Switch to timespec for timeoutsJune McEnroe Can be passed to ppoll(2) directly. 2020-08-14Implement serviceStartJune McEnroe 2020-08-14Flesh out Service structJune McEnroe 2020-08-14Build environment for servicesJune McEnroe 2020-08-14Implement spawntab parsingJune McEnroe 2020-08-14Open syslog, daemonize, write PIDJune McEnroe 2020-08-14Implement user and group lookupJune McEnroe 2020-08-14Add install targetJune McEnroe 2020-08-14Add spawnd skeletonJune McEnroe