From 4371dcbd55928135796c5d369cb06583b777565a Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 26 Jun 2020 19:55:12 +0000 Subject: [PATCH] invite: rework the way can_invite hook is called --- modules/m_invite.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/modules/m_invite.c b/modules/m_invite.c index 77ff593a..dcd965e5 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -145,24 +145,27 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source return; } - if (MyClient(source_p)) - { - hdata.chptr = chptr; - hdata.msptr = msptr; - hdata.client = source_p; - hdata.target = target_p; - hdata.approved = !(is_chanop(msptr) || (chptr->mode.mode & MODE_FREEINVITE)); + hdata.chptr = chptr; + hdata.msptr = msptr; + hdata.client = source_p; + hdata.target = target_p; + hdata.approved = !(is_chanop(msptr) || (chptr->mode.mode & MODE_FREEINVITE)); - call_hook(can_invite_hook, &hdata); - if (hdata.approved) + call_hook(can_invite_hook, &hdata); + if (hdata.approved) + { + if (MyClient(target_p)) { if (hdata.error) sendto_one_numeric(source_p, hdata.approved, "%s", hdata.error); else if (hdata.approved == ERR_CHANOPRIVSNEEDED) sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), - me.name, source_p->name, parv[2]); - return; + me.name, source_p->name, parv[2]); + + add_reply_target(target_p, source_p); } + + return; } /* store invites when they could affect the ability to join