Hi all,
I have tried to exec procs manually to test email features in the system (openacs-5-4).
But i am lost at how to pull the trigger to start the whole sequences of tcl code from the first ad_proc.
I will try to explain a scenario:
the whole (end-to-end) process, in a few words,
stands for:
send email from client -> server maildir -> tcl procs -> new bug-tracker ticket created
The process is automatic. It is scheduled in the acs-mail-lite parameters to exec in 2 minutes. (If you know acs-mail-lite package you will clearly understand)
So, i debugged tcl procs related and i verified that:
1. everything starts at file: acs-mail-lite-init.tcl line 12
ad_schedule_proc runs every two minutes and calls acs_mail_lite::load_mails
I wonder if the lines commented out do not affect the process.
#############################
set queue_dir [parameter::get_from_package_key -parameter
"BounceMailDir" -package_key "acs-mail-lite"]
if {$queue_dir ne ""} {
# if BounceMailDir is set then handle incoming mail
ad_schedule_proc -thread t 120 acs_mail_lite::load_mails -queue_dir
$queue_dir
}
# check every few minutes for bounces
#ad_schedule_proc -thread t [acs_mail_lite::get_parameter -name BounceScanQueue -default 120] acs_mail_lite::scan_replies
nsv_set acs_mail_lite send_mails_p 0
nsv_set acs_mail_lite check_bounce_p 0
#ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 0 25] acs_mail_lite::check_bounces
#############################
2. Then we have the file:
packages/acs-mail-lite/tcl/incoming-mail-procs.tcl line 29
This proc will prepare the var $email to be used at callbacks later at line 107
ad_proc -private load_mails {
.
.
.
#line 107
if {!$callback_executed_p} {
# We execute all callbacks now
callback acs_mail_lite::incoming_email -array email
}
...}
3. line 107 takes to file
acs-mail-lite-callback-procs.tcl line 127
ad_proc -public -callback acs_mail_lite::incoming_email -impl acs-mail-lite {
-array:required
-package_id:required
} {
upvar $array email
set to [acs_mail_lite::parse_email_address -email $email(to)]
ns_log Debug "acs_mail_lite::incoming_email -impl acs-mail-lite called. Recepient $to"
util_unlist [acs_mail_lite::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 ""} {
ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: No equivalent user found for $to"
} else {
ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: Bounce checking $to, $user_id"
acs_mail_lite::record_bounce -user_id $user_id
}
}
#####################################
This proc alerts if there's a message bounced to a user.
I believe inside the else block, it would be the place to call the bugtracker procedure to create new tickets on bug-tracker aplication.
However i am blind how to call the bugtracker callback to create the tickets, because it doesn't have a name such as in ad_proc ... ::load_mail or ... ::incoming_email
The header of the proc is:
packages/bug-tracker/tcl/bug-tracker-callback-procs.tcl line 11
ad_proc -public -callback acs_mail_lite::incoming_email -impl
bug-tracker { ... }
Everything seems to be correct in place. Parameters and variables properly set, however the tickets has not been created.
I put some ns_log in the procs to try to debug it and nothing was wrong.
How do I exec bugtracker proc?