#!/usr/bin/perl
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	
	# Make sure that this command is not spoofed, just in case.
        if ($_{avatar} != $this) {
		fail "No!"; 
	}
	
	my @lines;
	if (length $_{quote}) {
		@lines=$_{quote};
	}
	else {
		my $session=$_{session};
		while (1) {
			my $line=$session->prompt(prompt => "paste> ");
			exit unless defined $line; # client exited
			chomp $line;
			fail "Aborting.." if $line eq 'abort!';
			last if $line eq '.';
			push @lines, $line;
		}
	}

	foreach my $line (@lines) {
		$this->msg('paste', quote => $line, %_);
	}
}
