Opened 8 years ago

Last modified 8 years ago

#228 new enhancement

Provide buzzfilter

Reported by: Owned by:
Priority: minor Milestone:
Component: ui Keywords:


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 8 years ago by

    no warnings 'redefine';
    sub BarnOwl::Message::body {

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}.

comment:2 Changed 8 years ago by

  • Component changed from internals to ui
Note: See TracTickets for help on using tickets.