This is the main script; it runs as a daemon and does the message/command processing. It uses these functions: DoFile(), DoMessage(), DoCommand(), DoSendMessage(), DoForward(), SendDigest(), CleanSpool(), sigterm(), sighup().
Concerning reports about message distribution, function List::send_file() (or List::send_global_file()) is called with mail template message_report. Concerning reports about commands, it is the mail template command_report.
Handles a received file: function called by the sympa.pl main loop in order to process files contained in the queue spool. The file is encapsulated in a Message object not to alter it. Then the file is read, the header and the body of the message are separated. Then the adequate function is called whether a command has been received or a message has to be redistributed to a list.
So this function can call various functions:
About command process a report can be sent by calling List::send_global_file() with template command_report. For message report it is the template message_report.
IN: file(+): the file to handle
OUT: $status - result of the called function undef
Handles a message sent to a list (those that can make loop and those containing a command are rejected). This function can call various functions:
)
)
).
).IN:
which(+): 'list_name@domain_name - the concerned listmessage(+): ref(Message) - sent messagerobot(+): robotOUT: 1 if everything went fine in order to remove the file from the queue undef
Handles a command sent to sympa. The command is parse by calling Commands::parse() (see commands-parse, page
).
IN:
rcpt: recepient <listname>-<subscribeunsubscribe>robot(+): robotmsg(+): ref(MIME::Entity) - message containing the commandfile(+): file containing the messageOUT: $success - result of Command::parse() function undef.
Sends a message pushed in spool by another process (ex: wwsympa.fcgi) by calling function mail::mail_forward() (see mail-mail-forward, page
).
IN:
msg(+): ref(MIME::Entity)robot(+): robotOUT: 1 undef
Handles a message sent to <listname>-editor: the list editor, <list>-request: the list owner or the listmaster. The message is forwarded according to $function by calling function mail::mail_forward() (see mail-mail-forward, page
).
IN:
name(+): list name if ($function != 'listmaster')function(+): 'listmaster' 'request' 'editor'robot(+): robotmsg(+): ref(MIME::Entity)OUT: 1 undef
Reads the queuedigest spool and send old digests to the subscribers with the digest option by calling List::send_msg_digest() function mail::mail_forward() (see list-send-msg-digest, page
).
IN: - OUT: - undef
Cleans old files from spool $spool_dir older than $clean_delay.
IN:
spool_dir(+): the spool directoryclean_delay(+): the delay in daysOUT: 1
This function is called when a signal -TERM is received by sympa.pl. It just changes the value of $signal loop variable in order to stop sympa.pl after endding its message distribution if in progress. (see stop-signals, page
)
IN: - OUT: -
This function is called when a signal -HUP is received by sympa.pl. It changes the value of $signal loop variable and switchs of the -mail (see stop-signals, page
) logging option and continues current task.
IN: - OUT: -