changeset 2218:5673b24ceb0d

roundupdb nosymessage() takes an optional bcc list
author Richard Jones <richard@users.sourceforge.net>
date Sun, 18 Apr 2004 06:13:48 +0000
parents 98d3bf8ffb19
children 2623b1afc2b6
files CHANGES.txt roundup/roundupdb.py
diffstat 2 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sun Apr 18 05:31:03 2004 +0000
+++ b/CHANGES.txt	Sun Apr 18 06:13:48 2004 +0000
@@ -1,7 +1,7 @@
 This file contains the changes to the Roundup system over time. The entries
 are given with the most recent entry first.
 
-2004-??-?? 0.7.0
+2004-04-18 0.7.0b3
 Feature:
 - added a favicon
 - added url_quote and html_quote methods to the utils object
@@ -13,6 +13,7 @@
 - added search_checkboxes as an option for the search form
 - added IMAP support to mail gateway (sf rfe 934000)
 - check MANIFEST against the files actually unpacked
+- roundupdb nosymessage() takes an optional bcc list
 
 Fixed:
 - mysql and postgresql schema mutation now handle added Multilinks
--- a/roundup/roundupdb.py	Sun Apr 18 05:31:03 2004 +0000
+++ b/roundup/roundupdb.py	Sun Apr 18 06:13:48 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.106 2004-04-05 06:13:42 richard Exp $
+# $Id: roundupdb.py,v 1.107 2004-04-18 06:13:48 richard Exp $
 
 """Extending hyperdb with types specific to issue-tracking.
 """
@@ -123,7 +123,7 @@
 
     # XXX "bcc" is an optional extra here...
     def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy',
-            from_address=None, cc=[]): #, bcc=[]):
+            from_address=None, cc=[], bcc=[]):
         """Send a message to the members of an issue's nosy list.
 
         The message is sent only to users on the nosy list who are not
@@ -138,15 +138,16 @@
         recipients = self.db.msg.safeget(msgid, 'recipients', [])
         
         sendto = []
+        bcc_sendto = []
         seen_message = {}
         for recipient in recipients:
             seen_message[recipient] = 1
 
-        def add_recipient(userid):
+        def add_recipient(userid, to):
             # make sure they have an address
             address = self.db.user.get(userid, 'address')
             if address:
-                sendto.append(address)
+                to.append(address)
                 recipients.append(userid)
 
         def good_recipient(userid):
@@ -161,7 +162,7 @@
         if (good_recipient(authid) and
             (self.db.config.MESSAGES_TO_AUTHOR == 'yes' or
              (self.db.config.MESSAGES_TO_AUTHOR == 'new' and not oldvalues))):
-            add_recipient(authid)
+            add_recipient(authid, sendto)
         
         if authid:
             seen_message[authid] = 1
@@ -169,7 +170,12 @@
         # now deal with the nosy and cc people who weren't recipients.
         for userid in cc + self.get(nodeid, whichnosy):
             if good_recipient(userid):
-                add_recipient(userid)        
+                add_recipient(userid, sendto)        
+
+        # now deal with bcc people.
+        for userid in bcc:
+            if good_recipient(userid):
+                add_recipient(userid, bcc_sendto)
 
         if oldvalues:
             note = self.generateChangeNote(nodeid, oldvalues)
@@ -178,15 +184,17 @@
 
         # If we have new recipients, update the message's recipients
         # and send the mail.
-        if sendto:
+        if sendto or bcc_sendto:
             if msgid:
                 self.db.msg.set(msgid, recipients=recipients)
-            self.send_message(nodeid, msgid, note, sendto, from_address)
+            self.send_message(nodeid, msgid, note, sendto, from_address,
+                bcc_sendto)
 
     # backwards compatibility - don't remove
     sendmessage = nosymessage
 
-    def send_message(self, nodeid, msgid, note, sendto, from_address=None):
+    def send_message(self, nodeid, msgid, note, sendto, from_address=None,
+            bcc_sendto=[]):
         '''Actually send the nominated message from this node to the sendto
            recipients, with the note appended.
         '''
@@ -328,7 +336,7 @@
             body = writer.startbody('text/plain; charset=%s'%charset)
             body.write(content_encoded)
 
-        mailer.smtp_send(sendto, message)
+        mailer.smtp_send(sendto + bcc_sendto, message)
 
     def email_signature(self, nodeid, msgid):
         ''' Add a signature to the e-mail with some useful information

Roundup Issue Tracker: http://roundup-tracker.org/