Changes in nick.c [5ebff60:e3e2059]
Legend:
- Unmodified
- Added
- Removed
-
nick.c
r5ebff60 re3e2059 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 three 225 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 216 232 void nick_dedupe(bee_user_t *bu, char nick[MAX_NICK_LENGTH + 1]) 217 233 { … … 224 240 while (!nick_ok(irc, nick) || 225 241 ((iu = irc_user_by_name(irc, nick)) && iu->bu != bu)) { 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 } 242 243 underscore_dedupe(nick); 237 244 238 245 if (inf_protection-- == 0) {
Note: See TracChangeset
for help on using the changeset viewer.