invite: remove hardcoded UMODE_REGONLYMSG code

This commit is contained in:
Ariadne Conill 2020-06-26 11:41:05 -06:00
parent 01ef07c1c8
commit 0b8910e40b

View file

@ -158,7 +158,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
if (hdata.error) if (hdata.error)
sendto_one_numeric(source_p, hdata.approved, "%s", 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), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[2]); me.name, source_p->name, parv[2]);
return; return;
@ -200,40 +200,28 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(MyConnect(target_p)) if(MyConnect(target_p))
{ {
if(!IsOper(source_p) && (IsSetCallerId(target_p) || if(!IsOper(source_p) && (IsSetCallerId(target_p)) && !accept_message(source_p, target_p))
(IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])) &&
!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, sendto_one_numeric(source_p, RPL_TARGNOTIFY,
form_str(ERR_NONONREG), form_str(RPL_TARGNOTIFY),
target_p->name); target_p->name);
return;
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 + return;
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;
}
} }
hdata.chptr = chptr; hdata.chptr = chptr;