about summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-09-12 20:23:45 -0400
committerJune McEnroe <june@causal.agency>2018-09-12 20:23:45 -0400
commit872608e5c4fb814604a359a4b8b2f3bcf317cf0f (patch)
tree8f5c47cd8f6db0ab6716931165a2dc4087855a38 /chat.h
parentAdd /help equivalent to /man (diff)
downloadcatgirl-872608e5c4fb814604a359a4b8b2f3bcf317cf0f.tar.gz
catgirl-872608e5c4fb814604a359a4b8b2f3bcf317cf0f.zip
Factor out IRC formatting parsing
Diffstat (limited to 'chat.h')
-rw-r--r--chat.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/chat.h b/chat.h
index 9bd1d3c..50f5c87 100644
--- a/chat.h
+++ b/chat.h
@@ -23,6 +23,9 @@
 #include <time.h>
 #include <wchar.h>
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #define err(...) do { uiHide(); err(__VA_ARGS__); } while (0)
 #define errx(...) do { uiHide(); errx(__VA_ARGS__); } while (0)
 
@@ -80,6 +83,19 @@ enum {
 	IRCUnderline = 037,
 };
 
+struct Format {
+	const wchar_t *str;
+	size_t len;
+	bool bold;
+	bool italic;
+	bool underline;
+	bool reverse;
+	int fg;
+	int bg;
+};
+void formatReset(struct Format *format);
+bool formatParse(struct Format *format, const wchar_t *stop);
+
 void handle(char *line);
 void input(struct Tag tag, char *line);
 void inputTab(void);