1.1 --- a/imiptools/mail.py Sat Oct 14 16:44:49 2017 +0200
1.2 +++ b/imiptools/mail.py Sat Oct 14 19:11:58 2017 +0200
1.3 @@ -44,11 +44,19 @@
1.4
1.5 "Sending of outgoing messages."
1.6
1.7 - def __init__(self, lmtp_socket=None, local_smtp=False, sender=None, subject=None, preamble_text=None):
1.8 + def __init__(self, lmtp_socket=None, local_smtp=False, sender=None,
1.9 + subject=None, preamble_text=None, suppress_bcc=False):
1.10
1.11 """
1.12 Deliver to a local mail system using LMTP if 'lmtp_socket' is provided
1.13 or if 'local_smtp' is given as a true value.
1.14 +
1.15 + Use 'sender' as the sender identity (or the configured default if not
1.16 + specified). Use any explicitly specified 'subject' and 'preamble_text'
1.17 + in sent messages.
1.18 +
1.19 + Where 'suppress_bcc' is set to a true value, messages will not be sent
1.20 + to an outgoing destination for the sender even if this is requested.
1.21 """
1.22
1.23 self.lmtp_socket = lmtp_socket
1.24 @@ -56,6 +64,7 @@
1.25 self.sender = sender or MESSAGE_SENDER
1.26 self.subject = subject
1.27 self.preamble_text = preamble_text
1.28 + self.suppress_bcc = suppress_bcc
1.29
1.30 # The translation method is set by the client once locale information is
1.31 # known.
1.32 @@ -85,7 +94,7 @@
1.33 else:
1.34 smtp = SMTP("localhost")
1.35
1.36 - if outgoing_bcc:
1.37 + if outgoing_bcc and not self.suppress_bcc:
1.38 recipients = list(recipients) + ["%s+%s" % (OUTGOING_PREFIX, outgoing_bcc)]
1.39 elif self.local_smtp:
1.40 recipients = [self.make_local(recipient) for recipient in recipients]
1.41 @@ -121,8 +130,10 @@
1.42 message["From"] = sender or self.sender
1.43 for recipient in recipients:
1.44 message["To"] = recipient
1.45 - if outgoing_bcc:
1.46 +
1.47 + if outgoing_bcc and not self.suppress_bcc:
1.48 message["Bcc"] = "%s+%s" % (OUTGOING_PREFIX, outgoing_bcc)
1.49 +
1.50 message["Subject"] = self.subject or \
1.51 self.gettext and self.gettext(MESSAGE_SUBJECT) or MESSAGE_SUBJECT
1.52
2.1 --- a/imiptools/period.py Sat Oct 14 16:44:49 2017 +0200
2.2 +++ b/imiptools/period.py Sat Oct 14 19:11:58 2017 +0200
2.3 @@ -426,6 +426,31 @@
2.4 overlapping.sort()
2.5 return overlapping
2.6
2.7 +def get_overlapping_members(periods):
2.8 +
2.9 + "Return members of the 'periods' collection that overlap with others."
2.10 +
2.11 + if not periods:
2.12 + return []
2.13 +
2.14 + l = periods[:]
2.15 + l.sort()
2.16 +
2.17 + overlapping = []
2.18 +
2.19 + last = l[0]
2.20 + last_added = None
2.21 +
2.22 + for p in l[1:]:
2.23 + if p.get_start_point() < last.get_end_point():
2.24 + if last_added != last:
2.25 + overlapping.append(last)
2.26 + overlapping.append(p)
2.27 + last_added = p
2.28 + last = p
2.29 +
2.30 + return overlapping
2.31 +
2.32 # Period layout.
2.33
2.34 def get_scale(periods, tzid, view_period=None):