1 (* HCoop
Domtool (http
://hcoop
.sourceforge
.net
/)
2 * Copyright (c
) 2006, Adam Chlipala
4 * This program is free software
; you can redistribute it
and/or
5 * modify it under the terms
of the GNU General Public License
6 * as published by the Free Software Foundation
; either version
2
7 * of the License
, or (at your option
) any later version
.
9 * This program is distributed
in the hope that it will be useful
,
10 * but WITHOUT ANY WARRANTY
; without even the implied warranty
of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
. See the
12 * GNU General Public License for more details
.
14 * You should have received a copy
of the GNU General Public License
15 * along
with this program
; if not
, write to the Free Software
16 * Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
19 (* Mailman mailing list handling
*)
21 structure Mailman
:> MAILMAN
= struct
23 val files
= ref ([] : TextIO.outstream list
)
24 val write
= ref (fn _
: string => ())
26 val () = Env
.action_one
"mailmanWebHost"
27 ("hostname", Env
.string)
30 val outf
= Domain
.domainFile
{node
= Config
.Mailman
.node
,
33 TextIO.output (outf
, "\t'");
34 TextIO.output (outf
, host
);
35 TextIO.output (outf
, "' : '");
36 TextIO.output (outf
, Domain
.currentDomain ());
37 TextIO.output (outf
, "',\n");
41 val mailmanChanged
= ref
false
43 val () = Slave
.registerPreHandler (fn () => mailmanChanged
:= false)
45 val () = Slave
.registerFileHandler (fn fs
=>
47 val spl
= OS
.Path
.splitDirFile (#file fs
)
50 "mailman" => mailmanChanged
:= true
54 val () = Slave
.registerPostHandler (fn () =>
55 if !mailmanChanged
then
56 (Slave
.concatTo (fn s
=> s
= "mailman")
57 Config
.Mailman
.mapFile
;
58 Slave
.enumerateTo (fn s
=> s
= "mailman") ":"
59 Config
.Mailman
.handleDomains
;
60 Slave
.shellF ([Config
.Mailman
.reload
],
61 fn cl
=> "Error reloading Mailman with " ^ cl
))