From 097f17c3e04774f365c7c75f6142ad41b1bc175f Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 26 Feb 2022 16:19:30 -0500 Subject: Use twitch display-name tag Not sure if replacing the nick is really the best thing, but since twitch only lets you change case, it should be safe. --- chat.h | 1 + handle.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/chat.h b/chat.h index 6c2734f..e5602b5 100644 --- a/chat.h +++ b/chat.h @@ -215,6 +215,7 @@ static inline void set(char **field, const char *value) { #define ENUM_TAG \ X("+draft/reply", TagReply) \ X("causal.agency/pos", TagPos) \ + X("display-name", TagDisplayName) \ X("msgid", TagMsgID) \ X("time", TagTime) diff --git a/handle.c b/handle.c index 388a122..e68c4b3 100644 --- a/handle.c +++ b/handle.c @@ -80,6 +80,9 @@ static void require(struct Message *msg, bool origin, uint len) { if (!msg->nick) msg->nick = "*.*"; if (!msg->user) msg->user = msg->nick; if (!msg->host) msg->host = msg->user; + if (msg->tags[TagDisplayName]) { + msg->nick = msg->tags[TagDisplayName]; + } } for (uint i = 0; i < len; ++i) { if (msg->params[i]) continue; -- cgit 1.4.1