mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 11:12:42 +01:00
Better handling of undo -- if just undo, then show undone code; otherwise, if undo and substitution, execute
This commit is contained in:
parent
244e91b3fd
commit
c62c24ca42
@ -14,6 +14,8 @@ my $pass = 'test';
|
|||||||
my $soap = SOAP::Lite->new(proxy => 'http://ideone.com/api/1/service');
|
my $soap = SOAP::Lite->new(proxy => 'http://ideone.com/api/1/service');
|
||||||
my $result;
|
my $result;
|
||||||
|
|
||||||
|
my $MAX_UNDO_HISTORY = 100;
|
||||||
|
|
||||||
my $output = "";
|
my $output = "";
|
||||||
my $nooutput = 'No output.';
|
my $nooutput = 'No output.';
|
||||||
|
|
||||||
@ -204,16 +206,22 @@ while($subcode =~ s/^\s*(and)?\s*undo//) {
|
|||||||
|
|
||||||
open FILE, "> ideone_last_code.txt";
|
open FILE, "> ideone_last_code.txt";
|
||||||
|
|
||||||
unshift @last_code, $code unless ($got_undo and not $got_sub);
|
unless ($got_undo and not $got_sub) {
|
||||||
|
unshift @last_code, $code;
|
||||||
|
}
|
||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
foreach my $line (@last_code) {
|
foreach my $line (@last_code) {
|
||||||
last if(++$i > 10);
|
last if(++$i > $MAX_UNDO_HISTORY);
|
||||||
print FILE "$line\n";
|
print FILE "$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
close FILE;
|
close FILE;
|
||||||
|
|
||||||
|
if($got_undo and not $got_sub) {
|
||||||
|
print "$nick: $code\n";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
open FILE, ">> ideone_log.txt";
|
open FILE, ">> ideone_log.txt";
|
||||||
print FILE "$nick: $code\n";
|
print FILE "$nick: $code\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user