Changeset fed4f76 for lib/misc.h


Ignore:
Timestamp:
2015-01-16T19:50:25Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
ecbd22a
Parents:
4cff28f
Message:

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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/misc.h

    r4cff28f rfed4f76  
    150150G_MODULE_EXPORT char **split_command_parts( char *command, int limit );
    151151G_MODULE_EXPORT char *get_rfc822_header( const char *text, const char *header, int len );
     152G_MODULE_EXPORT int truncate_utf8( char *string, int maxlen );
    152153
    153154#endif
Note: See TracChangeset for help on using the changeset viewer.