Author: xor Date: 2008-11-16 04:42:50 +0000 (Sun, 16 Nov 2008) New Revision: 23635
Added: trunk/plugins/WoT/introduction/captcha/ReCaptchaFactory.java Log: I suggest we should ask the user on first run whether they want to contribute to the ReCaptcha project by inserting captchas from them: http://recaptcha.net/ Added: trunk/plugins/WoT/introduction/captcha/ReCaptchaFactory.java =================================================================== --- trunk/plugins/WoT/introduction/captcha/ReCaptchaFactory.java (rev 0) +++ trunk/plugins/WoT/introduction/captcha/ReCaptchaFactory.java 2008-11-16 04:42:50 UTC (rev 23635) @@ -0,0 +1,40 @@ +package plugins.WoT.introduction.captcha; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import plugins.WoT.OwnIdentity; +import plugins.WoT.introduction.IntroductionPuzzle; +import plugins.WoT.introduction.IntroductionPuzzleFactory; + +import com.db4o.ObjectContainer; + +/** + * Suggested captcha factory based on http://recaptcha.net/ + * + * + * @author xor + * + */ +public class ReCaptchaFactory implements IntroductionPuzzleFactory { + + /* FIXME: Ask the recaptcha guys to modify their java library so that it is able to just return a JPEG instead of inlining their HTML */ + // recaptcha.ReCaptchaFactory mFactory = new recaptcha.ReCaptchaFactory(); + + public IntroductionPuzzle generatePuzzle(ObjectContainer db, OwnIdentity inserter) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(10 * 1024); /* TODO: find out the maximum size of the captchas and put it here */ + try { + /* + BufferedImage img = captcha.createImage(text); + ImageIO.write(img, "jpg", out); + + Date dateOfInsertion = new Date(); + return new IntroductionPuzzle(inserter, PuzzleType.Captcha, "image/jpeg", out.toByteArray(), text, dateOfInsertion, IntroductionPuzzle.getFreeIndex(db, inserter, dateOfInsertion)); + */ + return null; + } + finally { + out.close(); + } + } +} _______________________________________________ cvs mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
