diff options
author | C. McEnroe | 2020-02-16 23:05:43 -0500 |
---|---|---|
committer | C. McEnroe | 2020-02-16 23:05:43 -0500 |
commit | b20be7cbad775ec2119e022ed8e4d225a488c90c (patch) | |
tree | caba6234d7027c5d2090f6482c23f5411abef3eb /chat.h | |
parent | ba524ed8045ea0e14664a64790fee53dd72a4541 (diff) |
Various small cleanups
Haven't really gone through ui.c yet.
Diffstat (limited to 'chat.h')
-rw-r--r-- | chat.h | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/chat.h b/chat.h index 1f4274f..d7f7c5c 100644 --- a/chat.h +++ b/chat.h @@ -65,8 +65,8 @@ static inline uint idFor(const char *name) { if (id) return id; if (idNext == IDCap) return Network; idNames[idNext] = strdup(name); - if (!idNames[idNext]) err(EX_OSERR, "strdup"); idColors[idNext] = Default; + if (!idNames[idNext]) err(EX_OSERR, "strdup"); return idNext++; } @@ -79,9 +79,22 @@ static inline enum Color hash(const char *str) { hash ^= *str; hash *= 0x27220A95; } - return 2 + hash % 74; + return Blue + hash % 74; } +extern struct Network { + char *name; + char *chanTypes; + char *prefixes; + char *prefixModes; + char *listModes; + char *paramModes; + char *setParamModes; + char *channelModes; + char excepts; + char invex; +} network; + #define ENUM_CAP \ X("extended-join", CapExtendedJoin) \ X("invite-notify", CapInviteNotify) \ @@ -96,25 +109,12 @@ enum Cap { #undef X }; -extern struct Network { - char *name; - char *chanTypes; - char *prefixes; - char *prefixModes; - char *listModes; - char *paramModes; - char *setParamModes; - char *channelModes; - char excepts; - char invex; -} network; - extern struct Self { bool debug; bool restricted; - char *plain; - const char *join; enum Cap caps; + char *plain; + char *join; char *nick; char *user; enum Color color; @@ -155,25 +155,8 @@ void ircFormat(const char *format, ...) __attribute__((format(printf, 1, 2))); void ircClose(void); -extern struct Replies { - uint away; - uint join; - uint list; - uint names; - uint topic; - uint whois; -} replies; - uint execID; int execPipe[2]; - -void handle(struct Message msg); -void command(uint id, char *input); -const char *commandIsPrivmsg(uint id, const char *input); -const char *commandIsNotice(uint id, const char *input); -const char *commandIsAction(uint id, const char *input); -void commandComplete(void); - int utilPipe[2]; enum { UtilCap = 16 }; @@ -190,6 +173,22 @@ static inline void utilPush(struct Util *util, const char *arg) { } } +extern struct Replies { + uint away; + uint join; + uint list; + uint names; + uint topic; + uint whois; +} replies; + +void handle(struct Message msg); +void command(uint id, char *input); +const char *commandIsPrivmsg(uint id, const char *input); +const char *commandIsNotice(uint id, const char *input); +const char *commandIsAction(uint id, const char *input); +void commandComplete(void); + enum Heat { Cold, Warm, Hot }; extern struct Util uiNotifyUtil; void uiInit(void); |