From 25e7c22891b81a187c147e2e6340472be896fdc7 Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Sun, 15 Sep 2013 21:41:36 -0700 Subject: [PATCH] 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@96b89dce38aa0ba86125acc329739376c3a82 --- modules/core/m_nick.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 62720c1..6251168 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -114,7 +114,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) { @@ -122,20 +121,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], 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; 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);