Skip to content

Commit

Permalink
Improve behavior for nicknames with too many symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDaniel committed Aug 17, 2019
1 parent eda26f4 commit 98bb939
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xbin/Tellable.p6
Expand Up @@ -33,21 +33,21 @@ method help($msg) {
}

#| normalize nicknames, somewhat
sub normalize-weirdly($_ is copy) {
sub normalize-weirdly($nick) {
# We knowingly ignore CASEMAPPING and its bullshit rules.
# Instead we'll do our own crazy stuff in order to DWIM.
# These rules are based on messages that were never delivered.

# XXX not using s/// because there's a sub s (rakudo/rakudo#3111)
$_ .= fc;
$_ = $nick.fc;
s:!g/‘[m]’$//; # matrix users
s:!g/\W+$//; # garbage at the end
s:!g/^\W+//; # garbage at the beginning
s:g/-//; # hyphens
s:g/‘_’//; # underscores
s:g/(.)$0+/$0/; # accidentally doubled characters
s:g/\d// if S:g/\d//.chars > 4; # remove numbers if we still have letters
$_;
.chars2 ?? $_ !! $nick; # return original if too much was removed
}

sub guest-like($nick) { so $nick ~~ /^Guest\d/ }
Expand Down

0 comments on commit 98bb939

Please sign in to comment.