dequis / bitlbee-old

Old personal fork, use https://github.com/bitlbee/bitlbee instead
3 stars 4 forks source link

[review] Fix UTF8 nick truncation issues #59

Closed dequis closed 9 years ago

dequis commented 9 years ago

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)

dequis commented 9 years ago

Mergesquashed as 68a11ddb986adf856eb369780d74b42b1470d2c0