#!/usr/bin/perl
#use Mooix::Thing;
#use Mooix::Verb;
run sub {
	my $this=shift;
	%_=@_;

	# Only allow use by builders, since this command can be used for
	# some pretty evil stuff, like blinding avatars.
	unless ($_{avatar}->isa($Mooix::Root->abstract->builder)) {
		fail "You can't do that.";
	}

	my $mf = $_{direct_object}->messagefilters;
	unless (ref $mf) {
		fail "Cannot apply filter to that object.";
	}

	if (grep $this, $mf->list) {
		fail "Filter is already in place.";
	}

	if (! $mf->add(object => $this)) {
		fail "Unable to add filter.";
	}
	$_{session}->write("Filter applied. Use unfilter command to remove.");
}
