summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-11 19:30:30 -0400
committerJune McEnroe <june@causal.agency>2018-08-11 20:02:03 -0400
commita281f89592cf5531ebf53863768fccd054de252c (patch)
tree502042617c3909ed5143d3e51562a7314666b250 /chat.h
parentAdd term.c for extra terminal features (diff)
downloadcatgirl-a281f89592cf5531ebf53863768fccd054de252c.tar.gz
catgirl-a281f89592cf5531ebf53863768fccd054de252c.zip
Rework UI code for multi-channel
Tags are now permanently assigned (and I'm betting on never needing more
than 256 of them) and the UI maps tags to a linked list of views for
easy reordering and removal. Currently, views can only be added. Views
don't have a topic window until they need one. All UI code wants to be
functional reactive.

Beeping is temporarily removed until message priorities (status,
message, ping) can be added to the UI. At that point spawning
notify-send should also be possible. Priorities will also help with
unnecessary markers, which will not appear for status messages.

The tab system is now used to send QUIT and NICK messages to all the
relevant tags. Verbose output now goes to its own tag, and sending to
it sends raw IRC.

IRC colors are now listed in chat.h and handler functions for numeric
replies have real names. The color algorithm now uses a real hash
function for hopefully better results. QUIT, PART and KICK messages are
scanned for URLs.
Diffstat (limited to '')
-rw-r--r--chat.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/chat.h b/chat.h
index f900172..be1e05b 100644
--- a/chat.h
+++ b/chat.h
@@ -42,13 +42,30 @@ struct Tag {
 };
 
 enum { TAGS_LEN = 256 };
-const struct Tag TAG_ALL;
-const struct Tag TAG_DEFAULT;
+const struct Tag TAG_NONE;
+const struct Tag TAG_STATUS;
+const struct Tag TAG_VERBOSE;
 struct Tag tagFor(const char *name);
-struct Tag tagName(const char *name);
-struct Tag tagNum(size_t num);
 
 enum {
+	IRC_WHITE,
+	IRC_BLACK,
+	IRC_BLUE,
+	IRC_GREEN,
+	IRC_RED,
+	IRC_BROWN,
+	IRC_MAGENTA,
+	IRC_ORANGE,
+	IRC_YELLOW,
+	IRC_LIGHT_GREEN,
+	IRC_CYAN,
+	IRC_LIGHT_CYAN,
+	IRC_LIGHT_BLUE,
+	IRC_PINK,
+	IRC_GRAY,
+	IRC_LIGHT_GRAY,
+};
+enum {
 	IRC_BOLD      = 002,
 	IRC_COLOR     = 003,
 	IRC_REVERSE   = 026,
@@ -72,9 +89,9 @@ void uiInit(void);
 void uiHide(void);
 void uiExit(void);
 void uiDraw(void);
-void uiBeep(void);
 void uiRead(void);
-void uiFocus(struct Tag tag);
+void uiViewTag(struct Tag tag);
+void uiViewNum(int num);
 void uiTopic(struct Tag tag, const char *topic);
 void uiLog(struct Tag tag, const wchar_t *line);
 void uiFmt(struct Tag tag, const wchar_t *format, ...);
@@ -115,8 +132,9 @@ const wchar_t *editTail(void);
 
 void tabTouch(struct Tag tag, const char *word);
 void tabRemove(struct Tag tag, const char *word);
+void tabReplace(struct Tag tag, const char *prev, const char *next);
 void tabClear(struct Tag tag);
-void tabReplace(const char *prev, const char *next);
+struct Tag tabTag(const char *word);
 const char *tabNext(struct Tag tag, const char *prefix);
 void tabAccept(void);
 void tabReject(void);