Index: openacs-4/packages/acs-mail-lite/tcl/bounce-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/Attic/bounce-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/acs-mail-lite/tcl/bounce-procs.tcl 14 Jun 2018 20:56:07 -0000 1.21 +++ openacs-4/packages/acs-mail-lite/tcl/bounce-procs.tcl 21 Jun 2018 15:21:23 -0000 1.22 @@ -14,26 +14,12 @@ namespace eval acs_mail_lite { - #--------------------------------------- ad_proc -private bounce_prefix {} { @return bounce prefix for x-envelope-from } { return [parameter::get_from_package_key -package_key "acs-mail-lite" -parameter "EnvelopePrefix"] } - #--------------------------------------- - ad_proc -public bouncing_email_p { - -email:required - } { - Checks if email address is bouncing mail - @option email email address to be checked for bouncing - @return boolean 1 if bouncing 0 if ok. - } { - return [bouncing_user_p \ - -user_id [party::get_by_email -email $email]] - } - - #--------------------------------------- ad_proc -public bouncing_user_p { -user_id:required } { @@ -46,80 +32,6 @@ -element email_bouncing_p] } - #--------------------------------------- - ad_proc -public bounce_address { - -user_id:required - -package_id:required - -message_id:required - } { - Composes a bounce address. If parameter FixedSenderEmail empty, - message_id is used. If message_id is empty, the legacy approach - for creating bounce_address is used. - - @option user_id user_id of the mail recipient - @option package_id package_id of the mail sending package - (needed to call package-specific code to deal with bounces) - @option message_id message-id of the mail - @return bounce address - } { - set mail_package_id [apm_package_id_from_key "acs-mail-lite"] - set fixed_sender [parameter::get -parameter "FixedSenderEmail" \ - -package_id $mail_package_id \ - -default "" ] - if { $fixed_sender ne "" } { - set ba $fixed_sender - } else { - if { $message_id ne "" } { - set ba $message_id - } else { - set ba [bounce_prefix] - append ba "-" $user_id "-" [ns_sha1 $message_id] \ - "-" $package_id "@" [address_domain] - ns_log Warning "acs_mail_lite::bounce_address is using \ - deprecated way. Supply message_id. Use acs_mail_lite::unique_id_create" - } - } - return $ba - } - - #--------------------------------------- - ad_proc -public -deprecated parse_bounce_address { - -bounce_address:required - } { - This takes a reply address, checks it for consistency, - and returns a list of user_id, package_id and bounce_signature found - - @option bounce_address bounce address to be checked - @return tcl-list of user_id package_id bounce_signature - @see acs_mail_lite::inbound_email_context - } { - set regexp_str "\[[bounce_prefix]\]-(\[0-9\]+)-(\[^-\]+)-(\[0-9\]*)\@" - if {![regexp $regexp_str $bounce_address all user_id signature package_id]} { - ns_log Debug "acs-mail-lite: bounce address not found for $bounce_address" - return "" - } - return [list $user_id $package_id $signature] - } - - #--------------------------------------- - ad_proc -public scan_replies {} { - Scheduled procedure that will scan for bounced mails - } { - # Make sure that only one thread is processing the queue at a time. - if {[nsv_incr acs_mail_lite check_bounce_p] > 1} { - nsv_incr acs_mail_lite check_bounce_p -1 - return - } - - ad_try { - ns_log Debug "acs-mail-lite: about to load qmail queue for [mail_dir]" - load_mails -queue_dir [mail_dir] - } finally { - nsv_incr acs_mail_lite check_bounce_p -1 - } - } - - #--------------------------------------- ad_proc -private check_bounces {} { Daily proc that sends out warning mail that emails are bouncing and disables emails if necessary @@ -186,27 +98,6 @@ db_dml log_notification_sending {} } } - - ad_proc -public record_bounce { - {-user_id ""} - {-email ""} - } { - Records that an email bounce for this user - } { - if {$user_id eq ""} { - set user_id [party::get_by_email -email $email] - } - if { $user_id ne "" && ![acs_mail_lite::bouncing_user_p -user_id $user_id] } { - ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: Bouncing email from user $user_id" - # record the bounce in the database - db_dml record_bounce {} - - if {![db_resultrows]} { - db_dml insert_bounce {} - } - } - } - } # Local variables: