mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-04 22:19:57 +00:00
MODE: Reply with ERR_NOSUCHCHANNEL when the target is a channel (#319)
While it is common for IRC servers to use ERR_NOSUCHNICK instead of ERR_NOSUCHCHANNEL when a target can be either a channel or a nick, it seems every other IRCd but UnrealIRCd uses ERR_NOSUCHCHANNEL in this particular case.
This commit is contained in:
parent
02a572d829
commit
acf8409c60
@ -62,6 +62,7 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
|
|||||||
{
|
{
|
||||||
CLIENT *cl, *origin;
|
CLIENT *cl, *origin;
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
|
bool is_valid_nick, is_valid_chan;
|
||||||
|
|
||||||
assert(Client != NULL);
|
assert(Client != NULL);
|
||||||
assert(Req != NULL);
|
assert(Req != NULL);
|
||||||
@ -76,10 +77,12 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
|
|||||||
Client = Client_Search(Req->prefix);
|
Client = Client_Search(Req->prefix);
|
||||||
|
|
||||||
/* Channel or user mode? */
|
/* Channel or user mode? */
|
||||||
|
is_valid_nick = Client_IsValidNick(Req->argv[0]);
|
||||||
|
is_valid_chan = Channel_IsValidName(Req->argv[0]);
|
||||||
cl = NULL; chan = NULL;
|
cl = NULL; chan = NULL;
|
||||||
if (Client_IsValidNick(Req->argv[0]))
|
if (is_valid_nick)
|
||||||
cl = Client_Search(Req->argv[0]);
|
cl = Client_Search(Req->argv[0]);
|
||||||
if (Channel_IsValidName(Req->argv[0]))
|
if (is_valid_chan)
|
||||||
chan = Channel_Search(Req->argv[0]);
|
chan = Channel_Search(Req->argv[0]);
|
||||||
|
|
||||||
if (cl)
|
if (cl)
|
||||||
@ -88,8 +91,12 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
|
|||||||
return Channel_Mode(Client, Req, origin, chan);
|
return Channel_Mode(Client, Req, origin, chan);
|
||||||
|
|
||||||
/* No target found! */
|
/* No target found! */
|
||||||
return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
|
if (is_valid_nick)
|
||||||
Client_ID(Client), Req->argv[0]);
|
return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
|
||||||
|
Client_ID(Client), Req->argv[0]);
|
||||||
|
else
|
||||||
|
return IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG,
|
||||||
|
Client_ID(Client), Req->argv[0]);
|
||||||
} /* IRC_MODE */
|
} /* IRC_MODE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user