summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-09-17 16:18:18 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-09-17 16:18:18 +0100
commitb4b2e7c7affcd5a9fb776da6b9820d170fd8aab8 (patch)
treed67566ef0a6c814d14f8cf01346130cf5cefe19b
parentf17c82bab89abedff9aaf332c0694668c99b9803 (diff)
added hooks for inline forward and reply quotes
define a hook reply_prefix(name,address,datetime) to set the content of the first inline quoted line in reply messages. similarly for forward.
-rw-r--r--alot/command.py20
-rw-r--r--alot/settings.py5
2 files changed, 17 insertions, 8 deletions
diff --git a/alot/command.py b/alot/command.py
index a20ddd22..57f7d617 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -502,8 +502,14 @@ class ReplyCommand(Command):
self.message = ui.current_buffer.get_selected_message()
mail = self.message.get_email()
# set body text
- mailcontent = '\nOn %s, %s wrote:\n' % (self.message.get_datestring(),
- self.message.get_author()[0])
+ name, address = self.message.get_author()
+ timestamp = self.message.get_date()
+ qf = settings.hooks.get('reply_prefix')
+ if qf:
+ quotestring = qf(name, address, timestamp)
+ else:
+ quotestring = 'Quoting %s (%s)\n' % (name, timestamp)
+ mailcontent = quotestring
for line in self.message.accumulate_body().splitlines():
mailcontent += '>' + line + '\n'
@@ -604,8 +610,14 @@ class ForwardCommand(Command):
Charset.add_charset('utf-8', Charset.QP, Charset.QP, 'utf-8')
if self.inline: # inline mode
# set body text
- author = self.message.get_author()[0]
- mailcontent = '\nForwarded message from %s:\n' % author
+ name, address = self.message.get_author()
+ timestamp = self.message.get_date()
+ qf = settings.hooks.get('forward_prefix')
+ if qf:
+ quotestring = qf(name, address, timestamp)
+ else:
+ quotestring = 'Forwarded message from %s (%s):\n' % (name, timestamp)
+ mailcontent = quotestring
for line in self.message.accumulate_body().splitlines():
mailcontent += '>' + line + '\n'
diff --git a/alot/settings.py b/alot/settings.py
index 9b5d2489..feabedaf 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -403,10 +403,7 @@ class HookManager:
if self.module:
if key in self.module.__dict__:
return self.module.__dict__[key]
-
- def f(*args, **kwargs):
- msg = 'called undefined hook: %s with arguments'
- return f
+ return None
config = AlotConfigParser(DEFAULTS)