f038f26c |
1 | structure MailingList = |
2 | struct |
78304862 |
3 | |
f038f26c |
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 |
22969c7b |
22 | val mmf = Util.domainDir dom ^ "/mailman" |
f038f26c |
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 |
22969c7b |
29 | NONE => {user = user, dom = dom, vhost = "<<<No darned data in " ^ mmf ^ ">>>"} |
f038f26c |
30 | | SOME line => |
22969c7b |
31 | case String.tokens (fn ch => Char.isSpace ch orelse ch = #":" orelse ch = #"'" orelse ch = #",") line of |
863cae1f |
32 | [vhost, _] => {user = user, dom = dom, vhost = "http://" ^ vhost} |
22969c7b |
33 | | _ => {user = user, dom = dom, vhost = "<<<Parse failure in " ^ mmf ^ ">>>"}) |
f038f26c |
34 | before TextIO.closeIn inf |
22969c7b |
35 | end handle _ => {user = user, dom = dom, vhost = "<<<A darn old exception reading " ^ mmf ^ ">>>"} |
f038f26c |
36 | else |
863cae1f |
37 | {user = user, dom = dom, vhost = "https://lists.hcoop.net"} |
f038f26c |
38 | end |
39 | | _ => raise (Fail "Bad mailing list name") |
40 | |
41 | end |