projects
/
fms.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
version 0.3.16
[fms.git]
/
src
/
freenet
/
introductionpuzzleinserter.cpp
diff --git
a/src/freenet/introductionpuzzleinserter.cpp
b/src/freenet/introductionpuzzleinserter.cpp
index
ba0ffab
..
60f7bb6
100644
(file)
--- a/
src/freenet/introductionpuzzleinserter.cpp
+++ b/
src/freenet/introductionpuzzleinserter.cpp
@@
-5,6
+5,7
@@
#include "../../include/freenet/captcha/simplecaptcha.h"
\r
#ifdef ALTERNATE_CAPTCHA
\r
#include "../../include/freenet/captcha/alternatecaptcha1.h"
\r
#include "../../include/freenet/captcha/simplecaptcha.h"
\r
#ifdef ALTERNATE_CAPTCHA
\r
#include "../../include/freenet/captcha/alternatecaptcha1.h"
\r
+#include "../../include/freenet/captcha/alternatecaptcha2.h"
\r
#endif
\r
#include "../../include/base64.h"
\r
\r
#endif
\r
#include "../../include/base64.h"
\r
\r
@@
-74,18
+75,27
@@
void IntroductionPuzzleInserter::CheckForNeededInsert()
\r
void IntroductionPuzzleInserter::GenerateCaptcha(std::string &encodeddata, std::string &solution)
\r
{
\r
\r
void IntroductionPuzzleInserter::GenerateCaptcha(std::string &encodeddata, std::string &solution)
\r
{
\r
+ ICaptcha *cap=0;
\r
#ifdef ALTERNATE_CAPTCHA
\r
#ifdef ALTERNATE_CAPTCHA
\r
- AlternateCaptcha1 captcha;
\r
+ if(rand()%2==0)
\r
+ {
\r
+ cap=new AlternateCaptcha1();
\r
+ }
\r
+ else
\r
+ {
\r
+ cap=new AlternateCaptcha2();
\r
+ }
\r
m_log->trace("IntroductionPuzzleInserter::GenerateCaptcha using alternate captcha generator");
\r
#else
\r
SimpleCaptcha captcha;
\r
m_log->trace("IntroductionPuzzleInserter::GenerateCaptcha using alternate captcha generator");
\r
#else
\r
SimpleCaptcha captcha;
\r
+ cap=&captcha;
\r
#endif
\r
std::vector<unsigned char> puzzle;
\r
std::vector<unsigned char> puzzlesolution;
\r
\r
#endif
\r
std::vector<unsigned char> puzzle;
\r
std::vector<unsigned char> puzzlesolution;
\r
\r
- cap
tcha.
Generate();
\r
- cap
tcha.
GetPuzzle(puzzle);
\r
- cap
tcha.
GetSolution(puzzlesolution);
\r
+ cap
->
Generate();
\r
+ cap
->
GetPuzzle(puzzle);
\r
+ cap
->
GetSolution(puzzlesolution);
\r
\r
encodeddata.clear();
\r
solution.clear();
\r
\r
encodeddata.clear();
\r
solution.clear();
\r
@@
-93,6
+103,8
@@
void IntroductionPuzzleInserter::GenerateCaptcha(std::string &encodeddata, std::
Base64::Encode(puzzle,encodeddata);
\r
solution.insert(solution.begin(),puzzlesolution.begin(),puzzlesolution.end());
\r
\r
Base64::Encode(puzzle,encodeddata);
\r
solution.insert(solution.begin(),puzzlesolution.begin(),puzzlesolution.end());
\r
\r
+ delete cap;
\r
+
\r
}
\r
\r
const bool IntroductionPuzzleInserter::HandlePutFailed(FCPMessage &message)
\r
}
\r
\r
const bool IntroductionPuzzleInserter::HandlePutFailed(FCPMessage &message)
\r