summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.h9
-rw-r--r--ui.c11
2 files changed, 12 insertions, 8 deletions
diff --git a/chat.h b/chat.h
index cd8798c..89d5797 100644
--- a/chat.h
+++ b/chat.h
@@ -105,6 +105,15 @@ static inline size_t styleParse(struct Style *style, const char **str) {
 	return strcspn(*str, (const char[]) { B, C, O, R, I, U, '\0' });
 }
 
+static inline void styleStrip(struct Cat *cat, const char *str) {
+	struct Style style = StyleDefault;
+	while (*str) {
+		size_t len = styleParse(&style, &str);
+		catf(cat, "%.*s", (int)len, str);
+		str += len;
+	}
+}
+
 enum { None, Debug, Network, IDCap = 256 };
 extern char *idNames[IDCap];
 extern enum Color idColors[IDCap];
diff --git a/ui.c b/ui.c
index 22ec02e..e2b832e 100644
--- a/ui.c
+++ b/ui.c
@@ -534,16 +534,11 @@ struct Util uiNotifyUtil;
 static void notify(uint id, const char *str) {
 	if (!uiNotifyUtil.argc) return;
 
+	char buf[1024] = "";
+	styleStrip(&(struct Cat) { buf, sizeof(buf), 0 }, str);
+
 	struct Util util = uiNotifyUtil;
 	utilPush(&util, idNames[id]);
-	char buf[1024] = "";
-	struct Cat cat = { buf, sizeof(buf), 0 };
-	while (*str) {
-		struct Style style = StyleDefault;
-		size_t len = styleParse(&style, &str);
-		catf(&cat, "%.*s", (int)len, str);
-		str += len;
-	}
 	utilPush(&util, buf);
 
 	pid_t pid = fork();
ollow=1'>Break nicks with ZWNJJune McEnroe This should prevent bad wrapping. 2019-05-26Add DawnJune McEnroe 2019-05-20Declare vasprintf(3) for GNUJune McEnroe who the fuck is scraeming "#define _GNU_SOURCE" at my house. show yourself, coward. i will never #define _GNU_SOURCE 2019-05-20Fix comparison warning in ttpreJune McEnroe 2019-05-20Add AuthorityJune McEnroe 2019-05-19Specify precedence of unary versions of operatorsJune McEnroe 2019-05-18Add compound assignment operators to orderJune McEnroe 2019-05-15Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe Their %-prefixed directives should probably be highlighted Macro. 2019-05-10Use val instead of suboptargJune McEnroe suboptarg doesn't exist in GNU. Hopefully BSD getsubopt also sets val on failure? 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe Need to do some stuff in the Makefile for lex and yacc and generating HTML pages for it. 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe