+csv dep for PG'OCaml.
[cocanwiki.git] / scripts / mailing_list_confirm.ml
index d7b7316..1a4f64a 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: mailing_list_confirm.ml,v 1.6 2006/03/28 13:20:00 rich Exp $
+ * $Id: mailing_list_confirm.ml,v 1.8 2006/12/06 09:46:57 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
@@ -34,15 +34,15 @@ let run r (q : cgi) dbh hostid _ _ =
   let rows = PGSQL(dbh) "select email from mailing_lists
                           where hostid = $hostid and pending = $pending" in
 
-  let email =
-    match rows with
-    | [email] -> email
-    | [] ->
-       error ~close_button:true ~title:"Email already confirmed"
-         dbh hostid q
-         "It looks like that email address has already been confirmed.";
-       return ()
-    | _ -> assert false in
+  (* Already confirmed? *)
+  (match rows with
+   | [_] -> ()
+   | [] ->
+       error ~close_button:true ~title:"Email already confirmed"
+        r dbh hostid q
+        "It looks like that email address has already been confirmed.";
+       return ()
+   | _ -> assert false);
 
   (* Update the database. *)
   PGSQL(dbh) "update mailing_lists set pending = null
@@ -53,8 +53,8 @@ let run r (q : cgi) dbh hostid _ _ =
   (* Confirmed. *)
   let buttons = [ ok_button "/" ] in
   ok ~buttons ~title:"Confirmed"
-    dbh hostid q ("Your email address has been confirmed.  " ^
-                 "You are now on our mailing list.")
+    dbh hostid q ("Your email address has been confirmed.  " ^
+                     "You are now on our mailing list.")
 
 let () =
   register_script ~restrict:[CanView] run