X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Finvite_user.ml;h=2895d78598e23f24cca4b3c21754d0958db154b0;hb=9aed7151b50ec06b0728568e0016f1eb4eb4da4a;hp=bca130fff63b792a2f69ca7bc7ec8b04cb892843;hpb=529b55fe61e017417faae092fe221bbd41368aa5;p=cocanwiki.git diff --git a/scripts/invite_user.ml b/scripts/invite_user.ml index bca130f..2895d78 100644 --- a/scripts/invite_user.ml +++ b/scripts/invite_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: invite_user.ml,v 1.2 2004/10/23 15:00:15 rich Exp $ + * $Id: invite_user.ml,v 1.3 2004/10/30 10:16:10 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 @@ -44,24 +44,17 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = return () ); - let userid, username = match user with - User (userid, username, _) -> userid, username + let userid, username, email = match user with + User (userid, username, _, prefs) -> userid, username, prefs.email | _ -> assert false in let subject = username ^ " has invited you to join " ^ hostname in - (* Get user's own email address, which will be the return address - * for the email. - *) - let sth = dbh#prepare_cached "select email from users - where hostid = ? and id = ?" in - sth#execute [`Int hostid; `Int userid]; - + (* Get a suitable return address for the email. *) let from = - match sth#fetch1 () with - [ `String email ] -> email - | [ `Null ] -> "service@merjis.com" - | _ -> assert false in + match email with + | Some email -> email + | None -> "service@merjis.com" in (* Add user accounts for these new users. For users who are already * registered, we'll send reminder emails.