Skip to content

Commit a58810b

Browse files
author
Richard Jones
committed
roundupdb nosymessage() takes an optional bcc list
1 parent 46657aa commit a58810b

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4-
2004-??-?? 0.7.0
4+
2004-04-18 0.7.0b3
55
Feature:
66
- added a favicon
77
- added url_quote and html_quote methods to the utils object
@@ -13,6 +13,7 @@ Feature:
1313
- added search_checkboxes as an option for the search form
1414
- added IMAP support to mail gateway (sf rfe 934000)
1515
- check MANIFEST against the files actually unpacked
16+
- roundupdb nosymessage() takes an optional bcc list
1617

1718
Fixed:
1819
- mysql and postgresql schema mutation now handle added Multilinks

roundup/roundupdb.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.106 2004-04-05 06:13:42 richard Exp $
18+
# $Id: roundupdb.py,v 1.107 2004-04-18 06:13:48 richard Exp $
1919

2020
"""Extending hyperdb with types specific to issue-tracking.
2121
"""
@@ -123,7 +123,7 @@ def addmessage(self, nodeid, summary, text):
123123

124124
# XXX "bcc" is an optional extra here...
125125
def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy',
126-
from_address=None, cc=[]): #, bcc=[]):
126+
from_address=None, cc=[], bcc=[]):
127127
"""Send a message to the members of an issue's nosy list.
128128
129129
The message is sent only to users on the nosy list who are not
@@ -138,15 +138,16 @@ def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy',
138138
recipients = self.db.msg.safeget(msgid, 'recipients', [])
139139

140140
sendto = []
141+
bcc_sendto = []
141142
seen_message = {}
142143
for recipient in recipients:
143144
seen_message[recipient] = 1
144145

145-
def add_recipient(userid):
146+
def add_recipient(userid, to):
146147
# make sure they have an address
147148
address = self.db.user.get(userid, 'address')
148149
if address:
149-
sendto.append(address)
150+
to.append(address)
150151
recipients.append(userid)
151152

152153
def good_recipient(userid):
@@ -161,15 +162,20 @@ def good_recipient(userid):
161162
if (good_recipient(authid) and
162163
(self.db.config.MESSAGES_TO_AUTHOR == 'yes' or
163164
(self.db.config.MESSAGES_TO_AUTHOR == 'new' and not oldvalues))):
164-
add_recipient(authid)
165+
add_recipient(authid, sendto)
165166

166167
if authid:
167168
seen_message[authid] = 1
168169

169170
# now deal with the nosy and cc people who weren't recipients.
170171
for userid in cc + self.get(nodeid, whichnosy):
171172
if good_recipient(userid):
172-
add_recipient(userid)
173+
add_recipient(userid, sendto)
174+
175+
# now deal with bcc people.
176+
for userid in bcc:
177+
if good_recipient(userid):
178+
add_recipient(userid, bcc_sendto)
173179

174180
if oldvalues:
175181
note = self.generateChangeNote(nodeid, oldvalues)
@@ -178,15 +184,17 @@ def good_recipient(userid):
178184

179185
# If we have new recipients, update the message's recipients
180186
# and send the mail.
181-
if sendto:
187+
if sendto or bcc_sendto:
182188
if msgid:
183189
self.db.msg.set(msgid, recipients=recipients)
184-
self.send_message(nodeid, msgid, note, sendto, from_address)
190+
self.send_message(nodeid, msgid, note, sendto, from_address,
191+
bcc_sendto)
185192

186193
# backwards compatibility - don't remove
187194
sendmessage = nosymessage
188195

189-
def send_message(self, nodeid, msgid, note, sendto, from_address=None):
196+
def send_message(self, nodeid, msgid, note, sendto, from_address=None,
197+
bcc_sendto=[]):
190198
'''Actually send the nominated message from this node to the sendto
191199
recipients, with the note appended.
192200
'''
@@ -328,7 +336,7 @@ def send_message(self, nodeid, msgid, note, sendto, from_address=None):
328336
body = writer.startbody('text/plain; charset=%s'%charset)
329337
body.write(content_encoded)
330338

331-
mailer.smtp_send(sendto, message)
339+
mailer.smtp_send(sendto + bcc_sendto, message)
332340

333341
def email_signature(self, nodeid, msgid):
334342
''' Add a signature to the e-mail with some useful information

0 commit comments

Comments
 (0)