diff options
-rw-r--r-- | alot/account.py | 3 | ||||
-rw-r--r-- | alot/settings.py | 23 |
2 files changed, 24 insertions, 2 deletions
diff --git a/alot/account.py b/alot/account.py index 106acc46..6caa30ac 100644 --- a/alot/account.py +++ b/alot/account.py @@ -53,8 +53,7 @@ class Account(object): self.address = address self.abook = abook self.aliases = [] - if aliases: - self.aliases = aliases.split(';') + self.aliases = aliases self.realname = realname self.gpg_key = gpg_key self.signature = signature diff --git a/alot/settings.py b/alot/settings.py index e4b4180a..28c30231 100644 --- a/alot/settings.py +++ b/alot/settings.py @@ -11,6 +11,8 @@ from urwid import AttrSpec, AttrSpecError from configobj import ConfigObj, ConfigObjError, flatten_errors, Section from validate import Validator +from account import SendmailAccount, MatchSdtoutAddressbook + from collections import OrderedDict from ConfigParser import SafeConfigParser, ParsingError, NoOptionError @@ -94,6 +96,8 @@ class SettingsManager(object): self.read_config(alot_rc) self.read_notmuch_config(notmuch_rc) + self._accounts = self.parse_accounts(self._config) + def read_notmuch_config(self, path): spec = os.path.join(DEFAULTSPATH, 'notmuch.rc.spec') @@ -114,6 +118,25 @@ class SettingsManager(object): if isinstance(newbindings, Section): self._bindings.merge(newbindings) + def parse_accounts(self, config): + accounts = [] + if 'accounts' in config: + for acc in config['accounts'].sections: + 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']) + + cmd = args['sendmail_command'] + del(args['sendmail_command']) + accounts.append(SendmailAccount(cmd, **args)) + return accounts + def get(self, key): """ |