m_nick: Reject nicks with '~' in them, rather than cutting at the '~'
Merge of commit da2fc2cbdec471b516a2aa56ed9f3513da8df87c in master The behavior of cutting at the first '~' is confusing at first, and looks too much like a bug. atheme/charybdis@96b89dce38
This commit is contained in:
parent
5efee8cc5e
commit
25e7c22891
|
@ -114,7 +114,6 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
|
||||||
{
|
{
|
||||||
struct Client *target_p;
|
struct Client *target_p;
|
||||||
char nick[NICKLEN];
|
char nick[NICKLEN];
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (strlen(client_p->id) == 3)
|
if (strlen(client_p->id) == 3)
|
||||||
{
|
{
|
||||||
|
@ -122,20 +121,13 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
|
||||||
return 0;
|
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),
|
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
|
||||||
me.name, EmptyString(source_p->name) ? "*" : source_p->name);
|
me.name, EmptyString(source_p->name) ? "*" : source_p->name);
|
||||||
return 0;
|
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 */
|
/* copy the nick and terminate it */
|
||||||
rb_strlcpy(nick, parv[1], sizeof(nick));
|
rb_strlcpy(nick, parv[1], sizeof(nick));
|
||||||
|
|
||||||
|
@ -180,21 +172,13 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
||||||
{
|
{
|
||||||
struct Client *target_p;
|
struct Client *target_p;
|
||||||
char nick[NICKLEN];
|
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);
|
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, source_p->name);
|
||||||
return 0;
|
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 */
|
/* mark end of grace period, to prevent nickflooding */
|
||||||
if(!IsFloodDone(source_p))
|
if(!IsFloodDone(source_p))
|
||||||
flood_endgrace(source_p);
|
flood_endgrace(source_p);
|
||||||
|
|
Loading…
Reference in New Issue