summaryrefslogtreecommitdiff
path: root/alot/settings.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/settings.py')
-rw-r--r--alot/settings.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/alot/settings.py b/alot/settings.py
index 37e550ad..3b0bb563 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -197,12 +197,22 @@ class SettingsManager(object):
accsec = config['accounts'][acc]
args = dict(config['accounts'][acc])
- if 'abook_command' in accsec:
- cmd = accsec['abook_command']
- regexp = accsec['abook_regexp']
- args['abook'] = MatchSdtoutAddressbook(cmd, match=regexp)
- del(args['abook_command'])
- del(args['abook_regexp'])
+ # create abook for this account
+ abook = accsec['abook']
+ logging.debug('abook defined: %s' % abook)
+ if abook['type'] == 'shellcommand':
+ cmd = abook['command']
+ regexp = abook['regexp']
+ logging.debug('abook: %s: %s' % (cmd, regexp))
+ if cmd is not None and regexp is not None:
+ args['abook'] = MatchSdtoutAddressbook(cmd,
+ match=regexp)
+ else:
+ msg = 'underspecified abook of type \'shellcommand\':'
+ msg += '\ncommand: %s\nregexp:%s' % (cmd, regexp)
+ raise ConfigError(msg)
+ else:
+ del(args['abook'])
cmd = args['sendmail_command']
del(args['sendmail_command'])