summaryrefslogtreecommitdiff
path: root/alot/commands/thread.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2013-04-23 12:47:13 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2013-04-23 12:47:13 +0100
commit7642647db734ef5ef36905bfb532816b3c22e7c2 (patch)
tree0ff40bf95055ce0b26a2e1c2bbfa88ac0c1b02d3 /alot/commands/thread.py
parenta5e064fc07a73abbf64d5d2a4cbc692dfa732790 (diff)
parent76446960a53aaac1bfa5a0432b0b05b41fb08033 (diff)
Merge branch '0.3.4-fix-self-replies-592'
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r--alot/commands/thread.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 7a4f496f..38a8994c 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -8,7 +8,7 @@ import tempfile
import argparse
from twisted.internet.defer import inlineCallbacks
import subprocess
-from email.Utils import getaddresses
+from email.Utils import getaddresses, parseaddr
import mailcap
from cStringIO import StringIO
@@ -159,14 +159,26 @@ class ReplyCommand(Command):
# set To
sender = mail['Reply-To'] or mail['From']
- recipients = [sender]
my_addresses = settings.get_addresses()
+ sender_address = parseaddr(sender)[1]
+
+ # check if reply is to self sent message
+ if sender_address in my_addresses:
+ recipients = [mail['To']]
+ logging.debug('Replying to own message, set recipients to: %s'
+ % recipients)
+ else:
+ recipients = [sender]
+
if self.groupreply:
if sender != mail['From']:
recipients.append(mail['From'])
- cleared = self.clear_my_address(
- my_addresses, mail.get_all('To', []))
- recipients.append(cleared)
+
+ # append To addresses if not replying to self sent message
+ if sender_address not in my_addresses:
+ cleared = self.clear_my_address(
+ my_addresses, mail.get_all('To', []))
+ recipients.append(cleared)
# copy cc for group-replies
if 'Cc' in mail: