| 1 | structure MailingList = |
| 2 | struct |
| 3 | |
| 4 | structure R = Request(struct |
| 5 | val table = "MailingList" |
| 6 | val adminGroup = "lists" |
| 7 | fun subject list = "Mailman list request: " ^ list |
| 8 | val template = "list" |
| 9 | val descr = "mailing list" |
| 10 | |
| 11 | fun body (mail, lst) = |
| 12 | (Mail.mwrite (mail, "List name: "); |
| 13 | Mail.mwrite (mail, lst); |
| 14 | Mail.mwrite (mail, "\n")) |
| 15 | end) |
| 16 | open R |
| 17 | |
| 18 | fun listWebHost name = |
| 19 | case String.tokens (fn ch => ch = #"@") name of |
| 20 | [user, dom] => |
| 21 | let |
| 22 | val mmf = Util.domainDir dom ^ "/mailman" |
| 23 | in |
| 24 | if Posix.FileSys.access (mmf, []) then |
| 25 | let |
| 26 | val inf = TextIO.openIn mmf |
| 27 | in |
| 28 | (case TextIO.inputLine inf of |
| 29 | NONE => {user = user, dom = dom, vhost = "<<<No darned data in " ^ mmf ^ ">>>"} |
| 30 | | SOME line => |
| 31 | case String.tokens (fn ch => Char.isSpace ch orelse ch = #":" orelse ch = #"'" orelse ch = #",") line of |
| 32 | [vhost, _] => {user = user, dom = dom, vhost = "http://" ^ vhost} |
| 33 | | _ => {user = user, dom = dom, vhost = "<<<Parse failure in " ^ mmf ^ ">>>"}) |
| 34 | before TextIO.closeIn inf |
| 35 | end handle _ => {user = user, dom = dom, vhost = "<<<A darn old exception reading " ^ mmf ^ ">>>"} |
| 36 | else |
| 37 | {user = user, dom = dom, vhost = "https://lists.hcoop.net"} |
| 38 | end |
| 39 | | _ => raise (Fail "Bad mailing list name") |
| 40 | |
| 41 | end |