More thorough inclusion of the page bug. This should mean the page bug appears just...
[cocanwiki.git] / scripts / mail_import.ml
index 008d991..9e24bfb 100644 (file)
@@ -1,7 +1,7 @@
 (* 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.8 2005/11/17 10:14:42 rich Exp $
+ * $Id: mail_import.ml,v 1.9 2005/11/24 14:54:12 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
@@ -59,7 +59,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user =
     with
        Not_found ->
          error ~back_button:true ~title:"No message"
-           q "No message was uploaded.";
+           dbh hostid q "No message was uploaded.";
          return () in
 
   (* Parse the message. *)
@@ -86,7 +86,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user =
    *)
   if date = "" || inet_message_id = "" then (
     error ~back_button:true ~title:"Headers missing"
-      q "Date or Message-ID header missing.  Cannot handle this message. ";
+      dbh hostid q
+      "Date or Message-ID header missing.  Cannot handle this message. ";
     return ()
   );
 
@@ -155,7 +156,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user =
       let id = sth#fetch1int () in
       if not overwrite then (
        ok ~title:"Message exists"
-          q "Message already imported";
+          dbh hostid q "Message already imported";
        return ()
       );
       Some id
@@ -363,7 +364,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ user =
 
   (* Finish off. *)
   ok ~title:"Imported"
-    q ("Message " ^ inet_message_id ^ " was imported.")
+    dbh hostid q ("Message " ^ inet_message_id ^ " was imported.")
 
 let () =
   register_script ~restrict:[CanImportMail] run