Fix the sqlite3 addition: Newly registered nicks shouldn't interfere with already registered ones.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@377 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2007-12-28 10:01:35 +00:00
parent 843b212de7
commit 0633108e74
1 changed files with 5 additions and 1 deletions

View File

@ -1327,7 +1327,11 @@ userexist (char *cname, int isnew)
char tmpbuf[32];
strncpy(tmpbuf, cname, (isnew ? globalconfig.max_newnick_len : 20));
qbuf = sqlite3_mprintf("select * from dglusers where username='%q' limit 1", tmpbuf);
/* Check that the nick doesn't interfere with already registered nicks */
if (isnew && (strlen(cname) >= globalconfig.max_newnick_len))
strcat(tmpbuf, "%");
qbuf = sqlite3_mprintf("select * from dglusers where username like '%q' limit 1", tmpbuf);
ret = sqlite3_open(DGL_SQLITE_DB, &db); /* FIXME: use globalconfig->passwd? */
if (ret) {