Update of /cvsroot/tmda/tmda/bin
In directory usw-pr-cvs1:/tmp/cvs-serv31253/bin

Modified Files:
        ChangeLog tmda-rfilter 
Log Message:
Added ability to use 'hold' as both the action part of a rule and as the
default incoming action.  The 'hold' action deposits the message in the
pending/ directory but does not send a confirmation request.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -r1.229 -r1.230
--- ChangeLog   13 Sep 2002 00:22:36 -0000      1.229
+++ ChangeLog   13 Sep 2002 05:42:12 -0000      1.230
@@ -19,6 +19,11 @@
        * tmda-ofmipd: Add -R option for authentication against a pop3,
        imap or imaps server.
 
+2002-08-29  <[EMAIL PROTECTED]>
+
+       * tmda-rfilter (do_default_action, bouncegen, main): Added code to
+       support "hold" action written by J C Lawrence <[EMAIL PROTECTED]>.
+
 2002-08-21  Jason R. Mastaler  <[EMAIL PROTECTED]>
 
        * tmda-rfilter (autorespond_to_sender): New function.  Determine

Index: tmda-rfilter
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-rfilter,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- tmda-rfilter        11 Sep 2002 22:35:59 -0000      1.63
+++ tmda-rfilter        13 Sep 2002 05:42:12 -0000      1.64
@@ -410,6 +410,9 @@
     elif action in ('accept', 'deliver', 'ok'):
         logit('%s %s' % ('OK', logname))
         mta.deliver(message_headers, message_body)
+    elif action == 'hold':
+        logit('%s %s' % ('HOLD', logname))
+        bouncegen('hold')
     else:
         logit('%s %s' % ('CONFIRM', logname))
         bouncegen('request')
@@ -611,6 +614,19 @@
         do_default_action(defact, 'action_fail_keyword', bouncetext)
 
 
+def create_pending_msg(timestamp, pid):
+    pending_message = "%s.%s.msg" % (timestamp, pid)
+    # Create ~/.tmda/ and friends if necessary.
+    if not os.path.exists(pendingdir):
+        os.makedirs(pendingdir, 0700) # stores the unconfirmed messages
+    # X-TMDA-Recipient is used by release_pending().
+    message_headers['X-TMDA-Recipient'] = recipient_address
+    # Write ~/.tmda/pending/TIMESTAMP.PID.msg
+    pending_contents = str(message_headers) + '\n' + message_body
+    Util.writefile(pending_contents,
+                   os.path.join(pendingdir, pending_message))
+
+
 def bouncegen(mode, text=None):
     """Bounce a message back to sender."""
     # Stop right away if --discard was specified.
@@ -660,17 +676,15 @@
                                                              timestamp,
                                                              pid,
                                                              'accept')
-        pending_message = "%s.%s.msg" % (timestamp, pid)
-        # Create ~/.tmda/ and friends if necessary.
-        if not os.path.exists(pendingdir):
-            os.makedirs(pendingdir, 0700) # stores the unconfirmed messages
-        # X-TMDA-Recipient is used by release_pending().
-        message_headers['X-TMDA-Recipient'] = recipient_address
-        # Write ~/.tmda/pending/TIMESTAMP.PID.msg
-        pending_contents = str(message_headers) + '\n' + message_body
-        Util.writefile(pending_contents,
-                       os.path.join(pendingdir, pending_message))
-    # Create the message and then send it.
+        create_pending_msg(timestamp, pid)
+    elif mode == 'hold':
+        create_pending_msg(str('%d' % now), Defaults.PID)
+        # Don't send anything for silently held messages
+        if Defaults.CONFIRM_CC:
+            send_cc(Defaults.CONFIRM_CC)
+        mta.stop()
+
+    # Create the confirm message and then send it.
     bounce_message = Util.maketext(templatefile, vars())
     if mode in ('accept', 'bounce'):
         send_bounce(bounce_message, already_confirmed=1)
@@ -682,7 +696,7 @@
         logit("CONFIRM pending " + pending_message)
         send_bounce(bounce_message,
                     confirm_accept_address = confirm_accept_address)
-        mta.stop()  
+        mta.stop()     
 
 
 ######
@@ -753,6 +767,10 @@
     elif action == 'confirm':
         logit('%s (%s)' % ('CONFIRM', matching_line))
         bouncegen('request')
+    elif action == 'hold':
+        logit('%s (%s)' % ('HOLD', matching_line))
+        bouncegen('hold')
+                
 
     # The message didn't match the filter file, so check if it was
     # sent to a 'tagged' address.

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to