Opened 14 years ago
Last modified 14 years ago
#228 new enhancement
Provide buzzfilter
| Reported by: | price@mit.edu | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | ui | Keywords: | |
| Cc: |
Description
I have a handy command for dealing with trolls in my .owl/barnowlconf, which Nelson provided in 2010. (Below. My version may differ slightly from his.)
This should go in tree. Nelson seemed to agree on -c geofft in May 2010: "Someone poke me with a stick until I package that better." But anyone could do it.
As a quibble, it might be better to say something like s/[b-df-hj-np-tv-z]/z/ig so as to leave punctuation intact. Or to provide disemvowelment instead, s/aeiou//ig. For over(?)engineering bonus points, make the substitution itself configurable. But any version probably provides 90% of the value of the optimal version.
my %buzzfilter = ();
{
no warnings 'redefine';
sub BarnOwl::Message::body {
my $m = shift;
if($buzzfilter{$m->pretty_sender||""}) {
my $b = $m->{body};
$b =~ s/[^\saeiou]/z/ig;
return $b;
} else {
return $m->{body}
}
}
}
BarnOwl::new_command(buzzfilter => sub {$buzzfilter{$_[1]} = 1});
BarnOwl::new_command(debuzzfilter => sub {delete $buzzfilter{$_[1]}});
BarnOwl::alias(unbuzzfilter => 'debuzzfilter');
Change History (2)
comment:1 Changed 14 years ago by geofft@mit.edu
comment:2 Changed 14 years ago by adehnert@mit.edu
- Component changed from internals to ui

This is the same technique used by Alias. While I don't think this should block putting this feature in, we should maybe think about a more extensible / robust way to do this than monkeypatching. In particular, it'd be nice to chain to any other filter that might be present instead of just using $m->{body}.