# Type: Input # Category: Config # Description: Configures minimum time to determine if user is away # Author: Andriy Lesyuk new Orangutan::Context( response => [ '^(?:Please )?(?:do(?:n\'t| not)(?: ever)? )?ask(?: me)? to (?:record (?:(?:a|the) )?breaks?|break (?:(?:a|the) )?tasks?) '. '(?:only )?(?:if|when) I(?:\'m| am) away for (?:less|more) than ([0-9]+) min(?:ute)?s?!*\.*$', '^(?:(?:The|a|my) )?break can(?:\'t|not) (?:be|last) less than ([0-9]+) min(?:ute)?s?!*\.*$' ], handler => sub { my ($context, $user, $item, $minutes) = @_; if ($minutes >= 5) { if ($minutes < 60) { my $current = $user->GetOption('BreakTime'); if (!defined($current) || ($current != $minutes)) { $user->SetOption('BreakTime', $minutes); $main::config->Context('Ok')->Tell($user); } else { $user->SendMessage([ "That's the current value!", 'Nothing to change...' ]); } } else { $user->SendMessage([ "Eek! Can't accept such a long break... which is not break...", 'Oh! It should be less than a hour...', "Wow! That's too much!" ]); } } else { $user->SendMessage([ 'The time should be greater than 5 minutes!', 'Cannot accept less than 5 minutes...', 'Cannot use less than 5 minutes!' ]); } }, help => { title => 'How can I specify minimum time for a break?', question => '^(?:How )?(?:(?:can|do) I |to )(?:specify|change|set|select) minim(?:um|al) '. '(?:time|(?:(?:number|amount) of)?minutes) for (?:a|the|my) break\?*!*\.*$', answer => "When you come online after being away for some time Orangutan assumes you have had a break. ". "If a break is too short (less than 5 minutes) Orangutan does nothing. ". "Otherwise by default he suggests to record a break. ". "You can control the minimum time of the break.\n". "Check queries:\n". " o Don't ask me to record a break if I am away for less than 20 minutes!\n". " o Don't ask to break tasks when I'm away for less than 10 minutes!\n". " o Break can't last less than 15 minutes...\n". "The value must be between 5 and 60 minutes.", weight => 565 } ); # kate: syntax perl