diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-04-27 10:58:36 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-04-27 10:58:36 +0100 |
commit | 5ad5aea6512f43a06e720d0b8e0fbf405d532dca (patch) | |
tree | 12d91d81962bf32972ddd6097c815e2ccdad9cd3 /lib/mauve/configuration_builders/person.rb | |
parent | 050d56934033c1cb1c2a6e613c706e3415acbd53 (diff) |
Added default configuration options for a person.
Diffstat (limited to 'lib/mauve/configuration_builders/person.rb')
-rw-r--r-- | lib/mauve/configuration_builders/person.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/mauve/configuration_builders/person.rb b/lib/mauve/configuration_builders/person.rb index 7a20491..afb967b 100644 --- a/lib/mauve/configuration_builders/person.rb +++ b/lib/mauve/configuration_builders/person.rb @@ -72,10 +72,31 @@ module Mauve def created_person(person) name = person.username raise ArgumentError.new("Duplicate person '#{name}'") if @result.people[name] + # # Add a default notification threshold # - person.notification_thresholds[60] = Array.new(10) if person.notification_thresholds.empty? + person.notification_thresholds[600] = Array.new(5) if person.notification_thresholds.empty? + + # + # Add a default notify clause + # + if person.notifications.empty? + default_notification = Notification.new(person) + default_notification.every = 30.minutes + default_notification.during = lambda { working_hours? } + person.notifications << default_notification + end + + # + # Set up some default notify levels. + # + if person.urgent.nil? and person.normal.nil? and person.low.nil? + person.urgent = lambda { sms ; xmpp ; email } + person.normal = lambda { xmpp ; email } + person.low = lambda { email } + end + @result.people[person.username] = person end |