File hplip-static-alerts-table-2.7.7.patch of Package hplip
--- base/g.py.orig 2007-06-18 18:56:32.000000000 +0200
+++ base/g.py 2008-08-21 10:35:53.000000000 +0200
@@ -151,9 +151,12 @@ if not os.path.exists(prop.user_config_f
os.chown(prop.user_config_file, s[stat.ST_UID], s[stat.ST_GID])
except IOError:
pass
+
+prop.alerts_config_file = '/etc/hp/alerts.conf'
sys_cfg = Config(prop.sys_config_file, True)
user_cfg = Config(prop.user_config_file)
+alerts_cfg = Config(prop.alerts_config_file)
# Language settings
--- hpssd.py.hplip-validate-uri-2.7.7.patch 2008-08-21 10:31:33.000000000 +0200
+++ hpssd.py 2008-08-21 10:38:13.000000000 +0200
@@ -70,6 +70,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
fax_file = {}
@@ -289,15 +295,10 @@ class hpssd_handler(dispatcher):
self.out_buffer = buildResultMessage('QueryHistoryResult', payload, 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)