From 0b8910e40bdf7deb610382455bed5305ac15c086 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 26 Jun 2020 11:41:05 -0600 Subject: [PATCH] invite: remove hardcoded UMODE_REGONLYMSG code --- modules/m_invite.c | 50 ++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/modules/m_invite.c b/modules/m_invite.c index 08bda62f..77ff593a 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -158,7 +158,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source { if (hdata.error) sendto_one_numeric(source_p, hdata.approved, "%s", hdata.error); - else + else if (hdata.approved == ERR_CHANOPRIVSNEEDED) sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), me.name, source_p->name, parv[2]); return; @@ -200,40 +200,28 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source if(MyConnect(target_p)) { - if(!IsOper(source_p) && (IsSetCallerId(target_p) || - (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])) && - !accept_message(source_p, target_p)) + if(!IsOper(source_p) && (IsSetCallerId(target_p)) && !accept_message(source_p, target_p)) { - if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]) + sendto_one_numeric(source_p, ERR_TARGUMODEG, + form_str(ERR_TARGUMODEG), + target_p->name); + + if((target_p->localClient->last_caller_id_time + + ConfigFileEntry.caller_id_wait) < rb_current_time()) { - sendto_one_numeric(source_p, ERR_NONONREG, - form_str(ERR_NONONREG), - target_p->name); - return; + sendto_one_numeric(source_p, RPL_TARGNOTIFY, + form_str(RPL_TARGNOTIFY), + target_p->name); + + add_reply_target(target_p, source_p); + sendto_one(target_p, form_str(RPL_UMODEGMSG), + me.name, target_p->name, source_p->name, + source_p->username, source_p->host); + + target_p->localClient->last_caller_id_time = rb_current_time(); } - else - { - sendto_one_numeric(source_p, ERR_TARGUMODEG, - form_str(ERR_TARGUMODEG), - target_p->name); - if((target_p->localClient->last_caller_id_time + - ConfigFileEntry.caller_id_wait) < rb_current_time()) - { - sendto_one_numeric(source_p, RPL_TARGNOTIFY, - form_str(RPL_TARGNOTIFY), - target_p->name); - - add_reply_target(target_p, source_p); - sendto_one(target_p, form_str(RPL_UMODEGMSG), - me.name, target_p->name, source_p->name, - source_p->username, source_p->host); - - target_p->localClient->last_caller_id_time = rb_current_time(); - } - - return; - } + return; } hdata.chptr = chptr;