1
0
forked from bip/bip

nick collision recover fix.

This commit is contained in:
Arnaud Cornet 2007-11-15 23:29:10 +01:00
parent d96543f1db
commit a21488ead6

View File

@ -376,11 +376,16 @@ int irc_dispatch_server(bip_t *bip, struct link_server *server,
size_t nicklen = strlen(server->nick);
char *newnick = malloc(nicklen + 2);
strcpy(newnick, server->nick);
if (strlen(server->nick) < 9)
if (strlen(server->nick) < 9) {
strcat(newnick, "`");
else if (newnick[8] != '`') {
} else if (newnick[7] != '`') {
if (newnick[8] != '`') {
newnick[8] = '`';
newnick[9] = 0;
} else {
newnick[7] = '`';
newnick[9] = 0;
}
} else {
newnick[8] = rand() * ('z' - 'a') / RAND_MAX +
'a';