Warn when someone leaves without paying.

This commit is contained in:
Juerd Waalboer 2014-01-10 21:17:43 +01:00
parent 71817a0783
commit 8f84891b0c
3 changed files with 66 additions and 9 deletions

28
plugins/idle Executable file
View file

@ -0,0 +1,28 @@
#!perl
my $timeout = 10;
sub command { NEXT }
sub hook_prompt_idle {
my ($class, $cart, $plugin, $seconds, $readline) = @_;
if ($seconds >= $timeout and $cart->size and not $plugin) {
$readline->ding;
return if $seconds > $timeout; # text only once
my $text = $readline->copy_text;
my $point = $readline->{point};
$readline->save_prompt;
$readline->replace_line("");
$readline->redisplay;
print "\e[33;2;1mTransaction incomplete.\e[0m Enter username to pay/finish or 'abort' to abort.\n";
$readline->restore_prompt;
$readline->replace_line($text);
$readline->{point} = $point;
$readline->redisplay;
}
}