# Type: Input # Category: Config # Description: Specifies if Orangutan should notify a user about Redmine events # Author: Andriy Lesyuk use Orangutan::User; new Orangutan::Context( response => [ '^(?:Please )?((?:do(?:n\'t| not)|never|stop) )?(?:notify|write?|tell)(?:ing)?(?: me)?'. '(?:(?:(?:,| (?:or|and)))? (?:about )?'. '(?:(?:changes|modifications) (?:made )?(?:to|in) issues|'. '(?:new )?issues(?: (?:(?:added|created) )?(?:to|in) projects?)?))*'. '(?: (?:any|no) (?:more|longer))?!*\.*$', '^(?:I )?(do(?:n\'t| not) )?(?:want|need) to be notified'. '(?:(?:(?:,| (?:or|and)))? (?:about )?'. '(?:(?:changes|modifications) (?:made )?(?:to|in) issues|'. '(?:new )?issues(?: (?:(?:added|created) )?(?:to|in) projects?)?))*'. '(?: (?:any|no) (?:more|longer))?!*\.*$', '^Turn (?:on|(off)) notifications'. '(?:(?:(?:,| (?:or|and)))? (?:about )?'. '(?:(?:changes|modifications) (?:made )?(?:to|in) issues|'. '(?:new )?issues(?: (?:(?:added|created) )?(?:to|in) projects?)?))*!*\.*$', '^(?:(Disable)|enable) notifications!*\.*$' ], handler => sub { my ($context, $user, $item, $negation) = @_; my $message; if (defined($negation)) { if (!$user->IsSet(USER_NONOTIFY)) { $user->Set(USER_NONOTIFY); $message = Orangutan::Context::Random('Ok... ', 'Got it!.. ', 'I see... '); $message .= Orangutan::Context::Random( "I won't disturb you any more!..", 'No more notifications...', "I won't.", 'Sorry...' ); } else { $message = Orangutan::Context::Random( 'Your notifications are already turned off...', 'I was not going to notify you!..', 'Hm... I was not going to...' ); } } else { if ($user->IsSet(USER_NONOTIFY)) { $user->Unset(USER_NONOTIFY); $message = Orangutan::Context::Random('Ok. ', 'Cool! ', 'Okay. '); $message .= Orangutan::Context::Random( 'Thanks for letting me know.', 'Will notify you!..', 'I like it!' ); } else { $message = Orangutan::Context::Random( 'Hm... Notifications are already turned on...', 'This is how it is configured right now!', 'I was going to notify you...' ); } } $user->SendMessage($message); }, help => { title => 'How can I disable/enable notifications?', question => '^(?:How )?(?:(?:can|do) I |to )(?:disable(?:/enable)?|turn (?:off|on)|enable) notifications\?*!*\.*$', answer => "By default Orangutan is notifying users about changes made to issues they are watching ". "and about new issues added to projects they are watching. ". "However the same (except new issues) is done by Redmine using email. ". "So users may choose to turn off Jabber or email notifications.\n". "Jabber notifications can be turned off this way:\n". " o I do not want to be notified about changes made to issues\n". " o Never notify me about new issues\n". " o Turn off notifications\n". " o Disable notifications\n". "Note that notifications can be turned off or on totally - ". "that is you can't turn off only notifications about new issues!\n". "Notifications can be turned on this way:\n". " o Notify me about new issues and changes made to issues\n". " o Turn on notifications\n". " o Enable notifications\n". "See also: How can I disable/enable Redmine email notifications?", weight => 580 } ); # kate: syntax perl