diff options
author | ulim <a.sporto+bee@gmail.com> | 2007-12-19 01:24:32 +0100 |
---|---|---|
committer | ulim <a.sporto+bee@gmail.com> | 2007-12-19 01:24:32 +0100 |
commit | 0fbd3a6d26d8fe747bd5e061748e75f397801064 (patch) | |
tree | 7a731363cfd014eb59ce65734c52cbc3d46b1b73 /nick.c | |
parent | 793cc254ad2479d95d00266d6cb7ab2bcd158834 (diff) | |
parent | 2379566b07de55bd0f59503c39ba253ce2556877 (diff) |
Now with sending via a proxy. The proxy is automatically discovered from your
jabber server.
Also merged in revs 279..288 from upstream (e.g. PING)
Diffstat (limited to 'nick.c')
-rw-r--r-- | nick.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -153,10 +153,10 @@ void nick_del( account_t *acc, const char *handle ) /* Character maps, _lc_[x] == _uc_[x] (but uppercase), according to the RFC's. With one difference, we allow dashes. */ -static char *nick_lc_chars = "0123456789abcdefghijklmnopqrstuvwxyz{}^-_|"; -static char *nick_uc_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]~-_\\"; +static char *nick_lc_chars = "0123456789abcdefghijklmnopqrstuvwxyz{}^`-_|"; +static char *nick_uc_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]~`-_\\"; -void nick_strip( char * nick ) +void nick_strip( char *nick ) { int i, j; @@ -169,6 +169,15 @@ void nick_strip( char * nick ) j++; } } + if( isdigit( nick[0] ) ) + { + char *orig; + + orig = g_strdup( nick ); + g_snprintf( nick, MAX_NICK_LENGTH, "_%s", orig ); + g_free( orig ); + j ++; + } while( j <= MAX_NICK_LENGTH ) nick[j++] = '\0'; } @@ -177,8 +186,8 @@ int nick_ok( const char *nick ) { const char *s; - /* Empty/long nicks are not allowed */ - if( !*nick || strlen( nick ) > MAX_NICK_LENGTH ) + /* Empty/long nicks are not allowed, nor numbers at [0] */ + if( !*nick || isdigit( nick[0] ) || strlen( nick ) > MAX_NICK_LENGTH ) return( 0 ); for( s = nick; *s; s ++ ) |