Changeset badd148 for nick.c


Ignore:
Timestamp:
2010-07-12T23:22:53Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
db2cef1
Parents:
09dfb68
Message:

Reformat nicks whenever fullname/nick/group changes (but at least for now
still only for offline users).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nick.c

    r09dfb68 rbadd148  
    116116        while( fmt && *fmt && ret->len < MAX_NICK_LENGTH )
    117117        {
    118                 char *part, chop = '\0';
     118                char *part, chop = '\0', *asc = NULL;
    119119               
    120120                if( *fmt != '%' )
     
    177177                }
    178178               
     179                /* Credits to Josay_ in #bitlbee for this idea. //TRANSLIT
     180                   should do lossy/approximate conversions, so letters with
     181                   accents don't just get stripped. Note that it depends on
     182                   LC_CTYPE being set to something other than C/POSIX. */
     183                if( part )
     184                        part = asc = g_convert( part, -1, "ASCII//TRANSLIT//IGNORE",
     185                                                "UTF-8", NULL, NULL, NULL );
     186               
    179187                while( part && *part && *part != chop )
    180188                {
     
    185193                        part ++;
    186194                }
     195                g_free( asc );
    187196        }
    188197       
     
    195204        irc_t *irc = (irc_t*) bu->bee->ui_data;
    196205        int inf_protection = 256;
     206        irc_user_t *iu;
    197207       
    198208        /* Now, find out if the nick is already in use at the moment, and make
    199209           subtle changes to make it unique. */
    200         while( !nick_ok( nick ) || irc_user_by_name( irc, nick ) )
     210        while( !nick_ok( nick ) ||
     211               ( ( iu = irc_user_by_name( irc, nick ) ) && iu->bu != bu ) )
    201212        {
    202213                if( strlen( nick ) < ( MAX_NICK_LENGTH - 1 ) )
Note: See TracChangeset for help on using the changeset viewer.