From e28beb737fa78cd9b6a65f15e8371e92ddadbc9b Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:05:55 +0100 Subject: [PATCH 1/3] gotpart(): If ismember() returns 0, fallback to get_user_by_host() --- src/mod/irc.mod/chan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod/irc.mod/chan.c b/src/mod/irc.mod/chan.c index 2467b2d1b..00dcf0c4b 100644 --- a/src/mod/irc.mod/chan.c +++ b/src/mod/irc.mod/chan.c @@ -2240,7 +2240,7 @@ static int gotjoin(char *from, char *channame) */ static int gotpart(char *from, char *msg) { - char *nick, *chname, *key; + char *nick, *chname, uhost[UHOSTLEN], *key; struct chanset_t *chan; struct userrec *u; memberlist *m; @@ -2255,9 +2255,13 @@ static int gotpart(char *from, char *msg) return 0; } if (chan && !channel_pending(chan)) { + strlcpy(uhost, from, sizeof uhost); nick = splitnick(&from); m = ismember(chan, nick); - u = get_user_from_member(m); + if (m) + u = get_user_from_member(m); + else + u = get_user_by_host(uhost); if (!channel_active(chan)) { /* whoa! */ putlog(LOG_MISC, chan->dname, From 48f54e2086244400100eaa16ff1854e4db048237 Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Tue, 29 Oct 2024 03:59:57 +0100 Subject: [PATCH 2/3] Dont call killmember() in gotpart(), if we already know it is not ismember() --- src/mod/irc.mod/chan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/irc.mod/chan.c b/src/mod/irc.mod/chan.c index 00dcf0c4b..198fcec02 100644 --- a/src/mod/irc.mod/chan.c +++ b/src/mod/irc.mod/chan.c @@ -2280,7 +2280,8 @@ static int gotpart(char *from, char *msg) if (!chan) return 0; - killmember(chan, nick); + if (m) + killmember(chan, nick); if (msg[0]) putlog(LOG_JOIN, chan->dname, "%s (%s) left %s (%s).", nick, from, chan->dname, msg); From b9d3f31ae62eef851ceabcb4441f037a6ab9898e Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sun, 24 Nov 2024 02:13:36 +0100 Subject: [PATCH 3/3] Add comment --- src/mod/irc.mod/chan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/irc.mod/chan.c b/src/mod/irc.mod/chan.c index 198fcec02..7e57ffcfa 100644 --- a/src/mod/irc.mod/chan.c +++ b/src/mod/irc.mod/chan.c @@ -2258,6 +2258,7 @@ static int gotpart(char *from, char *msg) strlcpy(uhost, from, sizeof uhost); nick = splitnick(&from); m = ismember(chan, nick); + // TODO: check account from rawt account-tags if (m) u = get_user_from_member(m); else