diff --git a/modules/m_invite.c b/modules/m_invite.c index e097930c..71bd0ab6 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -145,27 +145,28 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source return; } - 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) + if (MyClient(source_p)) { - if (MyClient(target_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)); + + call_hook(can_invite_hook, &hdata); + if (hdata.approved) { 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]); + me.name, source_p->name, parv[2]); - add_reply_target(target_p, source_p); + if (MyClient(target_p)) + add_reply_target(target_p, source_p); + + return; } - - return; } /* store invites when they could affect the ability to join