diff -up hplip-1.6.7/base/g.py.static-alerts-table hplip-1.6.7/base/g.py --- hplip-1.6.7/base/g.py.static-alerts-table 2008-07-29 14:56:27.000000000 +0100 +++ hplip-1.6.7/base/g.py 2008-07-29 14:56:28.000000000 +0100 @@ -118,9 +118,11 @@ class Config(dict): # Config file: directories and ports prop.sys_config_file = '/etc/hp/hplip.conf' prop.user_config_file = os.path.expanduser('~/.hplip.conf') +prop.alerts_config_file = '/etc/hp/alerts.conf' sys_cfg = Config(prop.sys_config_file) user_cfg = Config(prop.user_config_file) +alerts_cfg = Config(prop.alerts_config_file) # Language settings diff -up hplip-1.6.7/hpssd.py.static-alerts-table hplip-1.6.7/hpssd.py --- hplip-1.6.7/hpssd.py.static-alerts-table 2008-07-29 14:57:04.000000000 +0100 +++ hplip-1.6.7/hpssd.py 2008-07-29 15:22:15.000000000 +0100 @@ -71,6 +71,12 @@ from prnt import cups # Per user alert settings alerts = {} +for user, cfg in alerts_cfg.iteritems (): + entry = {} + entry['email-alerts'] = utils.to_bool (cfg.get('email-alerts', 0)) + entry['email-from-address'] = cfg.get('email-from-address', '') + entry['email-to-addresses'] = cfg.get('email-to-addresses', '') + alerts[user] = entry # Fax temp files fax_file = {} @@ -803,15 +809,10 @@ class hpssd_handler(dispatcher): self.out_buffer = buildResultMessage('InjectValueResult', None, result_code) - # TODO: Need to load alerts at start-up def handle_setalerts(self): result_code = ERROR_SUCCESS - username = self.fields.get('username', '') - alerts[username] = {'email-alerts' : utils.to_bool(self.fields.get('email-alerts', '0')), - 'email-from-address' : self.fields.get('email-from-address', ''), - 'email-to-addresses' : self.fields.get('email-to-addresses', ''), - } + # Do nothing. We use the alerts table in /etc/hp/alerts.conf. self.out_buffer = buildResultMessage('SetAlertsResult', None, result_code)