(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: mail_import.ml,v 1.4 2004/10/12 10:00:38 rich Exp $
+ * $Id: mail_import.ml,v 1.7 2004/12/01 13:55:55 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
open Cocanwiki_date
open Cocanwiki_strings
open Cocanwiki_pages
+open Cocanwiki_mail
let irt_re = Pcre.regexp "<.*?>"
let ws_re = Pcre.regexp "\\s+"
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
*)
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. *)
try
String.find (String.lowercase str) sub_lc
with
- String.Invalid_string -> -1
+ Invalid_string -> -1
in
let rec loop line = function
[] -> line
loop line links) lines in
let lines = List.map trim lines in
- let lines =
- List.map (fun line -> if line <> "" then line ^ " <br>" else "")
- lines in
+ let lines = List.map (fun line -> line ^ "<br>") lines in
String.concat "\n" lines
in
*)
save_page dbh hostid ~user ~r model;
+ (* Rebuild threads? *)
+ if rebuild then
+ thread_mail dbh hostid ~user ~r date.Dbi.year date.Dbi.month;
+
(* Commit to the database. *)
dbh#commit ();