From fc518e301f817f1ff2092eb2bf80451508085b7e Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 8 May 2022 17:49:20 -0400 Subject: Route unknown channel replies to channels Also prefix with the numeric. I don't really want to show numerics to the user, but I'm not sure these really make sense without. --- handle.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'handle.c') diff --git a/handle.c b/handle.c index df21cbf..8a6a9c6 100644 --- a/handle.c +++ b/handle.c @@ -128,12 +128,21 @@ static void handleErrorGeneric(struct Message *msg) { } static void handleReplyGeneric(struct Message *msg) { + uint first = 1; + uint id = Network; + if (msg->params[1] && strchr(network.chanTypes, msg->params[1][0])) { + id = idFor(msg->params[1]); + first++; + } char buf[1024]; char *ptr = buf, *end = &buf[sizeof(buf)]; - for (uint i = 1; i < ParamCap && msg->params[i]; ++i) { - ptr = seprintf(ptr, end, "%s%s", (i > 1 ? " " : ""), msg->params[i]); + ptr = seprintf(ptr, end, "\3%02d%s\3\t", Gray, msg->cmd); + for (uint i = first; i < ParamCap && msg->params[i]; ++i) { + ptr = seprintf( + ptr, end, "%s%s", (i > first ? " " : ""), msg->params[i] + ); } - if (ptr != buf) uiWrite(Network, Ice, tagTime(msg), buf); + uiWrite(id, Ice, tagTime(msg), buf); } static void handleErrorNicknameInUse(struct Message *msg) { -- cgit 1.4.1-2-gfad0