From b01bc76a69ecad525f05f81fea1b643f34b03da8 Mon Sep 17 00:00:00 2001 From: k4be Date: Tue, 20 Jul 2021 21:38:42 +0200 Subject: [PATCH] WATCH command should only modify own entries. --- src/modules/watch.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/watch.c b/src/modules/watch.c index 547238cd4..0bdfc0d65 100644 --- a/src/modules/watch.c +++ b/src/modules/watch.c @@ -197,7 +197,7 @@ CMD_FUNC(cmd_watch) if (*s == 'C' || *s == 'c') { watch_del_list(client); - +#warning remove only my entries continue; } @@ -216,7 +216,9 @@ CMD_FUNC(cmd_watch) /* * Send a list of how many users they have on their WATCH list - * and how many WATCH lists they are on. + * and how many WATCH lists they are on. This will also include + * other WATCH types if present - we're not checking for + * WATCH_FLAG_TYPE_*. */ watch = watch_get(client->name); if (watch) @@ -241,6 +243,8 @@ CMD_FUNC(cmd_watch) strlen(buf); while ((lp = lp->next)) { + if (!(lp->flags & WATCH_FLAG_TYPE_WATCH)) + continue; /* this one is not ours */ if (count + strlen(lp->value.wptr->nick) + 1 > BUFSIZE - 2) { @@ -271,6 +275,8 @@ CMD_FUNC(cmd_watch) while (lp) { + if (!(lp->flags & WATCH_FLAG_TYPE_WATCH)) + continue; /* this one is not ours */ if ((target = find_person(lp->value.wptr->nick, NULL))) { sendnumeric(client, RPL_NOWON, target->name,