SF.net SVN: tmda: [2035] trunk/tmda

[email protected] Mon, 25 Sep 2006 12:19:37 -0700
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2035
          http://svn.sourceforge.net/tmda/?rev=2035&view=rev
Author:   jasonrm
Date:     2006-09-25 12:19:35 -0700 (Mon, 25 Sep 2006)

Log Message:
-----------
remove duplicate code.

Modified Paths:
--------------
    trunk/tmda/TMDA/Queue/Util.py
    trunk/tmda/bin/tmda-rfilter

Modified: trunk/tmda/TMDA/Queue/Util.py
===================================================================
--- trunk/tmda/TMDA/Queue/Util.py	2006-09-25 02:56:10 UTC (rev 2034)
+++ trunk/tmda/TMDA/Queue/Util.py	2006-09-25 19:19:35 UTC (rev 2035)
@@ -37,15 +37,19 @@
 	os.makedirs(dirpath, 0700)
     
 
-def create_pending_msg(timestamp, pid, msg):
+def create_pending_msg(timestamp, pid, recip, msg):
     """ """
     fname = "%s.%s.msg" % (timestamp, pid)
     # Create ~/.tmda/ and friends if necessary.
     create_pending_dir(Defaults.PENDING_DIR)
+    # X-TMDA-Recipient is used by release_pending()
+    del msg['X-TMDA-Recipient']
+    msg['X-TMDA-Recipient'] = recip
     # Write ~/.tmda/pending/TIMESTAMP.PID.msg
     fcontents = msg_as_string(msg)
     fpath = os.path.join(Defaults.PENDING_DIR, fname)
     writefile(fcontents, fpath)
+    del msg['X-TMDA-Recipient']
     return fname
 
 

Modified: trunk/tmda/bin/tmda-rfilter
===================================================================
--- trunk/tmda/bin/tmda-rfilter	2006-09-25 02:56:10 UTC (rev 2034)
+++ trunk/tmda/bin/tmda-rfilter	2006-09-25 19:19:35 UTC (rev 2035)
@@ -706,17 +706,10 @@
                                                   Cookie.make_confirm_cookie(timestamp,
                                                                              pid,
                                                                              'accept'))
-	# X-TMDA-Recipient is used by release_pending()
-	del msgin['X-TMDA-Recipient']
-        msgin['X-TMDA-Recipient'] = recipient_address
-        pending_message = create_pending_msg(timestamp, pid, msgin)
-	del msgin['X-TMDA-Recipient']
-    
+        pending_message = create_pending_msg(timestamp, pid, recipient_address, msgin)
     elif mode == 'hold':
-	del msgin['X-TMDA-Recipient']
-        msgin['X-TMDA-Recipient'] = recipient_address
-        pending_message = create_pending_msg(str('%d' % now), Defaults.PID, msgin)
-	del msgin['X-TMDA-Recipient']
+        pending_message = create_pending_msg(str('%d' % now), Defaults.PID, 
+					     recipient_address, msgin)
         # Don't send anything for silently held messages
         if Defaults.CONFIRM_CC:
             send_cc(Defaults.CONFIRM_CC)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.