aboutsummaryrefslogtreecommitdiffstats
path: root/nick.c
diff options
context:
space:
mode:
Diffstat (limited to 'nick.c')
-rw-r--r--nick.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/nick.c b/nick.c
index 5e24547a..88c3faea 100644
--- a/nick.c
+++ b/nick.c
@@ -56,7 +56,6 @@ char *nick_get( account_t *acc, const char *handle )
{
static char nick[MAX_NICK_LENGTH+1];
char *store_handle, *found_nick;
- int inf_protection = 256;
memset( nick, 0, MAX_NICK_LENGTH + 1 );
@@ -82,6 +81,17 @@ char *nick_get( account_t *acc, const char *handle )
}
g_free( store_handle );
+ /* Make sure the nick doesn't collide with an existing one by adding
+ underscores and that kind of stuff, if necessary. */
+ nick_dedupe( acc, handle, nick );
+
+ return nick;
+}
+
+void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] )
+{
+ int inf_protection = 256;
+
/* Now, find out if the nick is already in use at the moment, and make
subtle changes to make it unique. */
while( !nick_ok( nick ) || user_find( acc->irc, nick ) )
@@ -119,8 +129,6 @@ char *nick_get( account_t *acc, const char *handle )
break;
}
}
-
- return nick;
}
/* Just check if there is a nickname set for this buddy or if we'd have to