diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-06-04 14:22:05 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-06-04 14:22:05 +0100 |
commit | d06eabf19ec3f849d8bab22c13d43e4eba9a48ee (patch) | |
tree | 0528ff030b32b1de53967641ce29f44653286012 /nick.c | |
parent | 54f2f55f983f4b6bb8a58772bbd1137580e3307f (diff) |
Added imcb_buddy_nick_hint so the Jabber conference module can suggest sane
nicknames for chatroom participants. There'll probably be a lot of
underscores now, but this is by far the cleanest way to implement this, I
think. At least now whispers will work properly. Also using this function
call to set names for ICQ contacts in a slightly saner way.
Diffstat (limited to 'nick.c')
-rw-r--r-- | nick.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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 |