mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 03:02:47 +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 $result;
|
||||
|
||||
my $MAX_UNDO_HISTORY = 100;
|
||||
|
||||
my $output = "";
|
||||
my $nooutput = 'No output.';
|
||||
|
||||
@ -204,16 +206,22 @@ while($subcode =~ s/^\s*(and)?\s*undo//) {
|
||||
|
||||
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;
|
||||
foreach my $line (@last_code) {
|
||||
last if(++$i > 10);
|
||||
last if(++$i > $MAX_UNDO_HISTORY);
|
||||
print FILE "$line\n";
|
||||
}
|
||||
|
||||
close FILE;
|
||||
|
||||
if($got_undo and not $got_sub) {
|
||||
print "$nick: $code\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
open FILE, ">> ideone_log.txt";
|
||||
print FILE "$nick: $code\n";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user