diff options
author | dequis <dx@dxzone.com.ar> | 2015-01-16 16:50:25 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-01-16 16:50:25 -0300 |
commit | fed4f766c05e44e99917909b266c99c052ed9c3e (patch) | |
tree | ca0f96eba21d6fd019b40a6f2d2af8f0d0ebecb9 /lib/misc.h | |
parent | 4cff28fdfca2eaf71a13715b0fda114796091065 (diff) |
Fix UTF8 nick truncation issues
When nicks exceeded the length limit, they were cut at 24 bytes and that
sometimes left invalid utf8 at the end, which made the nick_ok()
validation fail and often broke those nicks completely.
This adds a truncate_utf8 function to cut the string at a safe place
Also, the method to deduplicate nicks when there's no more place to add
underscores was changed to add "_XX" at the end, where XX are two random
hex chars. The previous method in those cases was increasing the value
of the first character of the nick... which leads to silly and confusing
results (i.e. FacebookUser -> GacebookUser)
Diffstat (limited to 'lib/misc.h')
-rw-r--r-- | lib/misc.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -149,5 +149,6 @@ G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl ); G_MODULE_EXPORT int md5_verify_password( char *password, char *hash ); G_MODULE_EXPORT char **split_command_parts( char *command, int limit ); G_MODULE_EXPORT char *get_rfc822_header( const char *text, const char *header, int len ); +G_MODULE_EXPORT int truncate_utf8( char *string, int maxlen ); #endif |