diff options
author | June McEnroe <june@causal.agency> | 2022-05-08 17:49:20 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-05-08 17:49:20 -0400 |
commit | fc518e301f817f1ff2092eb2bf80451508085b7e (patch) | |
tree | 1dfc9bc246bcad58421b5e7a06bc15f76c0cdc0c | |
parent | Show "You arrive" message only once (diff) | |
download | catgirl-fc518e301f817f1ff2092eb2bf80451508085b7e.tar.gz catgirl-fc518e301f817f1ff2092eb2bf80451508085b7e.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | handle.c | 15 |
1 files changed, 12 insertions, 3 deletions
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) { |