From b2544d9d5ad1adde36e28ccf2d6af205b3a72bd9 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 2 Apr 2014 23:48:43 +0000 Subject: [PATCH] compiler_vm: remember last output per channel and print "Same output." if the current output matches the last output --- PBot/VERSION.pm | 4 ++-- modules/compiler_vm/compiler_vm_client.pl | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index d2b70e78..0a8bac07 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 537, - BUILD_DATE => "2014-04-01", + BUILD_REVISION => 538, + BUILD_DATE => "2014-04-02", }; 1; diff --git a/modules/compiler_vm/compiler_vm_client.pl b/modules/compiler_vm/compiler_vm_client.pl index c2d7ce9b..a85957ba 100755 --- a/modules/compiler_vm/compiler_vm_client.pl +++ b/modules/compiler_vm/compiler_vm_client.pl @@ -1142,4 +1142,22 @@ if(defined $got_paste or (defined $got_run and $got_run eq "paste")) { exit 0; } +if(open FILE, "< history/$channel.last-output") { + my $last_output; + + while(my $line = ) { + $last_output .= $line; + } + close FILE; + + if($last_output eq $output) { + print "$nick: Same output.\n"; + exit 0; + } +} + print "$nick: $output\n"; + +open FILE, "> history/$channel.last-output" or die "Couldn't open $channel.last-output: $!"; +print FILE "$output"; +close FILE;