summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-09-18 12:36:01 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-09-18 12:36:01 +0100
commit90a04bdfeb91404f4d629f682c55e4b259da20ae (patch)
tree5bb9bcb7b4e500647ad8c8c9bfb29ba4b416022e /alot
parentfca437cfda167e62edd9234f73c61ad45ccfb05e (diff)
new hook paramter layout
all hooks get called with the following as keywords: ui, dbm, aman, log, config
Diffstat (limited to 'alot')
-rw-r--r--alot/command.py8
-rw-r--r--alot/ui.py7
2 files changed, 11 insertions, 4 deletions
diff --git a/alot/command.py b/alot/command.py
index 393aafdc..3e22ec94 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -511,7 +511,9 @@ class ReplyCommand(Command):
timestamp = self.message.get_date()
qf = settings.hooks.get('reply_prefix')
if qf:
- quotestring = qf(name, address, timestamp)
+ quotestring = qf(name, address, timestamp,
+ ui=ui, dbm=ui.dbman, aman=ui.accountman,
+ log=ui.logger, config=settings.config)
else:
quotestring = 'Quoting %s (%s)\n' % (name, timestamp)
mailcontent = quotestring
@@ -619,7 +621,9 @@ class ForwardCommand(Command):
timestamp = self.message.get_date()
qf = settings.hooks.get('forward_prefix')
if qf:
- quote = qf(name, address, timestamp)
+ quote = qf(name, address, timestamp,
+ ui=ui, dbm=ui.dbman, aman=ui.accountman,
+ log=ui.logger, config=settings.config)
else:
quote = 'Forwarded message from %s (%s):\n' % (name, timestamp)
mailcontent = quote
diff --git a/alot/ui.py b/alot/ui.py
index 5256467f..88759289 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -377,7 +377,9 @@ class UI:
if cmd.prehook:
self.logger.debug('calling pre-hook')
try:
- cmd.prehook(self, self.dbman, self.accountman, config)
+ cmd.prehook(ui=self, dbm=self.dbman, aman=self.accountman,
+ log=self.logger, config=config)
+
except:
self.logger.exception('prehook failed')
self.logger.debug('apply command: %s' % cmd)
@@ -385,6 +387,7 @@ class UI:
if cmd.posthook:
self.logger.debug('calling post-hook')
try:
- cmd.posthook(self, self.dbman, self.accountman, config)
+ cmd.posthook(ui=self, dbm=self.dbman, aman=self.accountman,
+ log=self.logger, config=config)
except:
self.logger.exception('posthook failed')