(* HCoop Domtool (http://hcoop.sourceforge.net/) * Copyright (c) 2006, Adam Chlipala * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *) (* Mailman mailing list handling *) structure Mailman :> MAILMAN = struct val files = ref ([] : TextIO.outstream list) val write = ref (fn _ : string => ()) val () = Env.action_one "mailmanWebHost" ("hostname", Env.string) (fn host => let val outf = Domain.domainFile {node = Config.Mailman.node, name = "mailman"} in TextIO.output (outf, "\t'"); TextIO.output (outf, host); TextIO.output (outf, "' : '"); TextIO.output (outf, Domain.currentDomain ()); TextIO.output (outf, "',\n"); TextIO.closeOut outf end) val mailmanChanged = ref false val () = Slave.registerPreHandler (fn () => mailmanChanged := false) val () = Slave.registerFileHandler (fn fs => let val spl = OS.Path.splitDirFile (#file fs) in case #file spl of "mailman" => mailmanChanged := true | _ => () end) val () = Slave.registerPostHandler (fn () => if !mailmanChanged then (Slave.concatTo (fn s => s = "mailman") Config.Mailman.mapFile; Slave.enumerateTo (fn s => s = "mailman") ":" Config.Mailman.handleDomains; Slave.shellF ([Config.Mailman.reload], fn cl => "Error reloading Mailman with " ^ cl)) else ()) end