# Type: Output (event based) # Category: Task # Description: Reminds user to tell the task description # Events: status, task # Uses: YesNo # Delay: 30 min # Copied: No # Author: Andriy Lesyuk use Orangutan::User; sub WhatTask_Remind { my ($context, $user, $type, $status) = @_; if (!$user->IsSet(USER_NOASKTASK)) { if (!defined($user->GetTask)) { if ($type eq 'status') { my $previous = $user->GetStatus; if (!defined($previous) || (($previous eq 'away') && defined($status) && ($status eq 'online'))) { my $time = new Orangutan::Date; if ($user->IsWorkTime($time)) { my $entry = $user->GetHistoryEntry; if (!defined($entry) || (($time->Date - $entry->{'date'}->Date) > 1800)) { if (!$user->GetRequest($context->GetID)) { $user->AddRequest($context, 90); } } } } } elsif ($type eq 'task') { if (($status eq 'end') || ($status eq 'cancel')) { my $time = new Orangutan::Date; if ($user->IsWorkTime($time)) { if (!$user->GetRequest($context->GetID)) { $user->AddRequest($context, 90); } } } } elsif ($type eq 'workday') { if ($status eq 'start') { if ($user->IsOnline) { if (!$user->GetRequest($context->GetID)) { $user->AddRequest($context, 90); } } } } } elsif ($type eq 'task') { if ($status eq 'start') { $user->RemoveRequest($context); } } } } new Orangutan::Context( request => sub { my ($context, $user) = @_; if (!$user->IsSet(USER_NOASKTASK)) { my $time = new Orangutan::Date; if ($user->IsWorkTime($time)) { return Orangutan::Context::Random( 'Just reminding that you should tell me if you are working on something...', "Don't forget to tell me what are you working on...", 'Just tell me if you are working on something...' ); } } return undef; }, onstatus => \&WhatTask_Remind, ontask => \&WhatTask_Remind, onworkday => \&WhatTask_Remind, delay => 1800, weight => undef ); # kate: syntax perl