X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=blobdiff_plain;f=ircd%2Fs_user.c;fp=ircd%2Fs_user.c;h=96d88a15e3db5ab173052a8a5c78159063c90e8f;hp=2c9a9bce35be8aeaa46866eab9ef0925ba10f38e;hb=96f1ae9c934d475960c2aa6b3b4f1336c37833c2;hpb=fa4486fe3e166152a57a42320fd1f2faee37b0c3 diff --git a/ircd/s_user.c b/ircd/s_user.c index 2c9a9bc..96d88a1 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -728,7 +728,23 @@ int set_nick_name(struct Client* cptr, struct Client* sptr, } else { /* Local client setting NICK the first time */ - strcpy(cli_name(sptr), nick); + if(!force) + strcpy(cli_name(sptr), nick); + else { + /* use a "temponary" nick here (we'll switch later) */ + char tmpnick[NICKLEN + 2]; + int tmpnickend; + strcpy(tmpnick, nick); + /* we need at least 10 characters */ + if (strlen(tmpnick) > IRCD_MIN(NICKLEN, feature_int(FEAT_NICKLEN)) - 10) + tmpnick[IRCD_MIN(NICKLEN, feature_int(FEAT_NICKLEN))-10] = '\0'; + tmpnickend = strlen(tmpnick); + + do { /* get a non-used nick... */ + sprintf(tmpnick + tmpnickend, "[rz%d]", ircrandom() % 10000); + } while(FindClient(tmpnick)); + strcpy(cli_name(sptr), tmpnick); + } hAddClient(sptr); return auth_set_nick(cli_auth(sptr), nick); }