Changes in nick.c [e3e2059:5ebff60]
Legend:
- Unmodified
- Added
- Removed
-
nick.c
re3e2059 r5ebff60 214 214 } 215 215 216 /* Used for nicks and channel names too! */217 void underscore_dedupe(char nick[MAX_NICK_LENGTH + 1])218 {219 if (strlen(nick) < (MAX_NICK_LENGTH - 1)) {220 nick[strlen(nick) + 1] = 0;221 nick[strlen(nick)] = '_';222 } else {223 /* We've got no more space for underscores,224 so truncate it and replace the last three225 chars with a random "_XX" suffix */226 int len = truncate_utf8(nick, MAX_NICK_LENGTH - 3);227 nick[len] = '_';228 g_snprintf(nick + len + 1, 3, "%2x", rand());229 }230 }231 232 216 void nick_dedupe(bee_user_t *bu, char nick[MAX_NICK_LENGTH + 1]) 233 217 { … … 240 224 while (!nick_ok(irc, nick) || 241 225 ((iu = irc_user_by_name(irc, nick)) && iu->bu != bu)) { 242 243 underscore_dedupe(nick); 226 if (strlen(nick) < (MAX_NICK_LENGTH - 1)) { 227 nick[strlen(nick) + 1] = 0; 228 nick[strlen(nick)] = '_'; 229 } else { 230 /* We've got no more space for underscores, 231 so truncate it and replace the last three 232 chars with a random "_XX" suffix */ 233 int len = truncate_utf8(nick, MAX_NICK_LENGTH - 3); 234 nick[len] = '_'; 235 g_snprintf(nick + len + 1, 3, "%2x", rand()); 236 } 244 237 245 238 if (inf_protection-- == 0) {
Note: See TracChangeset
for help on using the changeset viewer.