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 (* Exim MTA handling
*)
21 structure Exim
:> EXIM
= struct
23 val aliasesChanged
= ref
false
24 val aliasesDefaultChanged
= ref
false
26 val () = Slave
.registerPreHandler
27 (fn () => (aliasesChanged
:= false;
28 aliasesDefaultChanged
:= false))
30 val () = Slave
.registerFileHandler (fn fs
=>
32 val spl
= OS
.Path
.splitDirFile (#file fs
)
34 if #file spl
= "aliases" then
35 aliasesChanged
:= true
36 else if #file spl
= "aliases.default" then
37 aliasesDefaultChanged
:= true
42 val () = Slave
.registerPostHandler
44 (if !aliasesChanged
then
45 Slave
.concatTo (fn s
=> s
= "aliases") Config
.Exim
.aliases
48 if !aliasesDefaultChanged
then
49 Slave
.concatTo (fn s
=> s
= "aliases.default") Config
.Exim
.aliasesDefault
52 if !aliasesChanged
orelse !aliasesDefaultChanged
then
53 Slave
.shellF ([Config
.Exim
.reload
],
54 fn cl
=> "Error reloading exim with " ^ cl
)