Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl,v diff -u -r1.66 -r1.67 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 10 Jan 2007 21:22:05 -0000 1.66 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 29 Jan 2007 17:16:50 -0000 1.67 @@ -438,131 +438,6 @@ } #--------------------------------------- - ad_proc -private -deprecated load_mail_dir { - -queue_dir:required - } { - Scans qmail incoming email queue for bounced mail and processes - these bounced mails. - - @author ben@openforce.net - @author dan.wickstrom@openforce.net - @creation-date 22 Sept, 2001 - - @option queue_dir The location of the qmail mail queue in the file-system. - } { - if {[catch { - # get list of all incoming mail - set messages [glob "$queue_dir/new/*"] - } errmsg]} { - ns_log Debug "queue dir = $queue_dir/new/*, no messages" - return [list] - } - - set list_of_bounce_ids [list] - set new_messages_p 0 - - # loop over every incoming mail - foreach msg $messages { - ns_log Debug "opening file: $msg" - if [catch {set f [open $msg r]}] { - continue - } - set file [read $f] - close $f - set file [split $file "\n"] - - set new_messages 1 - set end_of_headers_p 0 - set i 0 - set line [lindex $file $i] - set headers [list] - - # walk through the headers and extract each one - while {$line ne ""} { - set next_line [lindex $file [expr {$i + 1}]] - if {[regexp {^[ ]*$} $next_line match] && $i > 0} { - set end_of_headers_p 1 - } - if {[regexp {^([^:]+):[ ]+(.+)$} $line match name value]} { - # join headers that span more than one line (e.g. Received) - if { ![regexp {^([^:]+):[ ]+(.+)$} $next_line match] && !$end_of_headers_p} { - append line $next_line - incr i - } - lappend headers [string tolower $name] $value - - if {$end_of_headers_p} { - incr i - break - } - } else { - # The headers and the body are delimited by a null line as specified by RFC822 - if {[regexp {^[ ]*$} $line match]} { - incr i - break - } - } - incr i - set line [lindex $file $i] - } - set body "\n[join [lrange $file $i end] "\n"]" - - # okay now we have a list of headers and the body, let's - # put it into notifications stuff - array set email_headers $headers - - if {[catch {set from $email_headers(from)}]} { - set from "" - } - if {[catch {set to $email_headers(to)}]} { - set to "" - } - - set to [parse_email_address -email $to] - ns_log Debug "acs-mail-lite: To: $to" - util_unlist [parse_bounce_address -bounce_address $to] user_id package_id signature - - # If no user_id found or signature invalid, ignore message - if {$user_id eq "" || ![valid_signature -signature $signature -msg $body]} { - if {$user_id eq ""} { - ns_log Notice "acs-mail-lite: No user id $user_id found" - } else { - ns_log Notice "acs-mail-lite: Invalid mail signature" - } - if {[catch {ns_unlink $msg} errmsg]} { - ns_log Notice "acs-mail-lite: couldn't remove message" - } - continue - } - - # Try to invoke package-specific procedure for special treatment - # of mail bounces - if {$package_id ne ""} { - catch {acs_sc::invoke -contract AcsMailLite -operation MailBounce -impl [string map {- _} [apm_package_key_from_id $package_id]] -call_args [list [array get email_headers] $body]} - } - - # Okay, we have a bounce for a system user - # Check if the user has been marked as bouncing mail - # if the user is bouncing mail, we simply disgard the - # bounce since it was sent before the user's email was - # disabled. - - ns_log Debug "Bounce checking: $to, $user_id" - - if { ![bouncing_user_p -user_id $user_id] } { - ns_log Notice "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 {} - } - } - catch {ns_unlink $msg} - } - } - - #--------------------------------------- ad_proc -public scan_replies {} { Scheduled procedure that will scan for bounced mails } {