about summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-02 03:27:50 -0500
committerJune McEnroe <june@causal.agency>2020-02-02 03:27:50 -0500
commit8bb9ea7b7ff2e98bbe629f9f2e63f1dcb70250e3 (patch)
tree713c9916a5160ba96204844a8fd70799ded19072 /chat.h
parentImplement window switching and status line (diff)
downloadtest-8bb9ea7b7ff2e98bbe629f9f2e63f1dcb70250e3.tar.gz
test-8bb9ea7b7ff2e98bbe629f9f2e63f1dcb70250e3.zip
Add idColors
Diffstat (limited to 'chat.h')
-rw-r--r--chat.h47
1 files changed, 25 insertions, 22 deletions
diff --git a/chat.h b/chat.h
index 9060f29..4ced983 100644
--- a/chat.h
+++ b/chat.h
@@ -26,8 +26,21 @@
 
 typedef unsigned char byte;
 
+#define B "\2"
+#define C "\3"
+#define R "\17"
+#define V "\26"
+#define I "\35"
+#define U "\37"
+enum Color {
+	White, Black, Blue, Green, Red, Brown, Magenta, Orange,
+	Yellow, LightGreen, Cyan, LightCyan, LightBlue, Pink, Gray, LightGray,
+	Default = 99,
+};
+
 enum { None, Debug, Network, IDCap = 256 };
 extern char *idNames[IDCap];
+extern enum Color idColors[IDCap];
 extern size_t idNext;
 
 static inline size_t idFind(const char *name) {
@@ -36,6 +49,7 @@ static inline size_t idFind(const char *name) {
 	}
 	return None;
 }
+
 static inline size_t idFor(const char *name) {
 	size_t id = idFind(name);
 	if (id) return id;
@@ -83,28 +97,6 @@ struct Message {
 	char *params[ParamCap];
 };
 
-#define B "\2"
-#define C "\3"
-#define R "\17"
-#define V "\26"
-#define I "\35"
-#define U "\37"
-enum Color {
-	White, Black, Blue, Green, Red, Brown, Magenta, Orange,
-	Yellow, LightGreen, Cyan, LightCyan, LightBlue, Pink, Gray, LightGray,
-	Default = 99,
-};
-static inline enum Color hash(const char *str) {
-	if (*str == '~') str++;
-	uint32_t hash = 0;
-	for (; *str; ++str) {
-		hash = (hash << 5) | (hash >> 27);
-		hash ^= *str;
-		hash *= 0x27220A95;
-	}
-	return 2 + hash % 14;
-}
-
 void ircConfig(bool insecure, const char *cert, const char *priv);
 int ircConnect(const char *host, const char *port);
 void ircRecv(void);
@@ -140,6 +132,17 @@ void termTitle(const char *title);
 void termMode(enum TermMode mode, bool set);
 enum TermEvent termEvent(char ch);
 
+static inline enum Color hash(const char *str) {
+	if (*str == '~') str++;
+	uint32_t hash = 0;
+	for (; *str; ++str) {
+		hash = (hash << 5) | (hash >> 27);
+		hash ^= *str;
+		hash *= 0x27220A95;
+	}
+	return 2 + hash % 14;
+}
+
 #define BASE64_SIZE(len) (1 + ((len) + 2) / 3 * 4)
 static const char Base64[64] = {
 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
ct'>Use first word of params in input commandsJune McEnroe Prevents anything weird from happening when tab-completing, which inserts a space. 2019-02-23Add C-n and C-p key bindings to switch windowsJune McEnroe 2019-02-23Change example command to join #ascii.town on freenodeJune McEnroe 2019-02-23Call def_prog_mode after termNoFlowJune McEnroe So that the settings get restored after /url or /man. 2019-02-22Move IRC formatting reset to C-sJune McEnroe Opens C-n for window switching. 2019-02-22Disable terminal flow controlJune McEnroe This opens up C-o, C-q and C-s for key bindings without C-v. 2019-02-22Bind up and down arrows to scrollJune McEnroe Honestly it's kind of weird that IRC clients usually use these for input history. 2019-02-22Remove topic TODOJune McEnroe I played around with it and it doesn't look right unless there is only one channel listed in the status. 2019-02-22Add /znc commandJune McEnroe Only because ZNC tells you to use it and expects it to work. 2019-02-22Update status line after scrolling and term eventsJune McEnroe 2019-02-22Reorganize input.cJune McEnroe 2019-02-22Fix name of <raw> window in man pageJune McEnroe 2019-02-22Rename global tags with angle bracketsJune McEnroe 2019-02-22Show status window while connectingJune McEnroe 2019-02-22Reorganize UI code for the umpteenth timeJune McEnroe It's actually in a good state now, I think. 2019-02-21Replace "view" with "window"June McEnroe I think originally I didn't want to use the same word as curses WINDOW but it's really much clearer for the user if they're just called windows. UI code probably needs yet another rewrite though. Still feels messy. 2019-02-21Remove ROT13June McEnroe It's just not convenient when it can only do the whole line... 2019-02-21Clean up man pageJune McEnroe 2019-01-26Draw UI before connectingJune McEnroe Otherwise the "Traveling" message isn't visible while connecting. 2019-01-25Avoid unused variable warnings with getyxJune McEnroe 2019-01-25Add GNU/Linux build instructionsJune McEnroe