m_nick: Reject nicks with '~' in them, rather than cutting at the '~'
The behavior of cutting at the first '~' is confusing at first, and looks too much like a bug.
This commit is contained in:
parent
90e3d1b7e1
commit
fda96b89dc
1 changed files with 2 additions and 18 deletions
|
@ -115,7 +115,6 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
|
|||
{
|
||||
struct Client *target_p;
|
||||
char nick[NICKLEN];
|
||||
char *s;
|
||||
|
||||
if (strlen(client_p->id) == 3)
|
||||
{
|
||||
|
@ -123,20 +122,13 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(parc < 2 || EmptyString(parv[1]) || (parv[1][0] == '~'))
|
||||
if(parc < 2 || EmptyString(parv[1]))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
|
||||
me.name, EmptyString(source_p->name) ? "*" : source_p->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* due to the scandinavian origins, (~ being uppercase of ^) and ~
|
||||
* being disallowed as a nick char, we need to chop the first ~
|
||||
* instead of just erroring.
|
||||
*/
|
||||
if((s = strchr(parv[1], '~')))
|
||||
*s = '\0';
|
||||
|
||||
/* copy the nick and terminate it */
|
||||
rb_strlcpy(nick, parv[1], ConfigFileEntry.nicklen);
|
||||
|
||||
|
@ -181,21 +173,13 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
|||
{
|
||||
struct Client *target_p;
|
||||
char nick[NICKLEN];
|
||||
char *s;
|
||||
|
||||
if(parc < 2 || EmptyString(parv[1]) || (parv[1][0] == '~'))
|
||||
if(parc < 2 || EmptyString(parv[1]))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, source_p->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* due to the scandinavian origins, (~ being uppercase of ^) and ~
|
||||
* being disallowed as a nick char, we need to chop the first ~
|
||||
* instead of just erroring.
|
||||
*/
|
||||
if((s = strchr(parv[1], '~')))
|
||||
*s = '\0';
|
||||
|
||||
/* mark end of grace period, to prevent nickflooding */
|
||||
if(!IsFloodDone(source_p))
|
||||
flood_endgrace(source_p);
|
||||
|
|
Loading…
Reference in a new issue