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.
weechat-hashes
June McEnroe 2022-05-08 17:49:20 -04:00
parent 7ee327ccb6
commit fc518e301f
1 changed files with 12 additions and 3 deletions

View File

@ -128,12 +128,21 @@ static void handleErrorGeneric(struct Message *msg) {
} }
static void handleReplyGeneric(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 buf[1024];
char *ptr = buf, *end = &buf[sizeof(buf)]; char *ptr = buf, *end = &buf[sizeof(buf)];
for (uint i = 1; i < ParamCap && msg->params[i]; ++i) { ptr = seprintf(ptr, end, "\3%02d%s\3\t", Gray, msg->cmd);
ptr = seprintf(ptr, end, "%s%s", (i > 1 ? " " : ""), msg->params[i]); 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) { static void handleErrorNicknameInUse(struct Message *msg) {