X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fmail_import.ml;h=9e30fc901adf68922e9606231f824189117b06e1;hb=744ad347df455887349c683dd1c57af2b1ac0d28;hp=1c4f709b293f3c97e052876bb028a0699a0b2539;hpb=0bbc87f2b064e8080f18e77ffcadcd6348ecd9be;p=cocanwiki.git diff --git a/scripts/mail_import.ml b/scripts/mail_import.ml index 1c4f709..9e30fc9 100644 --- a/scripts/mail_import.ml +++ b/scripts/mail_import.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: mail_import.ml,v 1.5 2004/10/14 15:57:15 rich Exp $ + * $Id: mail_import.ml,v 1.6 2004/10/20 15:17:18 rich Exp $ * * 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 @@ -90,6 +90,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user = return () ); + (* Can't handle funny characters in subject lines - remove them. *) + let subject = String.map (fun c -> + if Char.code c < 32 then ' ' else c) subject in + (* Parse the date field. *) let date, time = try @@ -188,7 +192,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user = *) msgid in - (* The message is referred to by a unique title: *) + (* The message is referred to by a unique title. + * NB. Do not change this unique title - it is also used during thread + * indexing. + *) let title = sprintf "Mail/%s (%d)" subject msgid in (* Choose a suitable URL. *) @@ -313,9 +320,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user = loop line links) lines in let lines = List.map trim lines in - let lines = - List.map (fun line -> if line <> "" then line ^ "
" else "") - lines in + let lines = List.map (fun line -> line ^ "
") lines in String.concat "\n" lines in @@ -351,7 +356,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user = (* Rebuild threads? *) if rebuild then - thread_mail dbh hostid date.Dbi.year date.Dbi.month; + thread_mail dbh hostid ~user ~r date.Dbi.year date.Dbi.month; (* Commit to the database. *) dbh#commit ();