connwrap - initialize gnutls session in cw_connect
[centerim.git] / src / captcha.h
blob3ad06090ffdc31c4e8c18d18c450998b56f25bea
1 #ifndef __CAPTCHA_H__
2 #define __CAPTCHA_H__
4 #include <time.h>
6 class captcha {
7 private:
8 typedef struct {
9 string question;
10 set<string> answers;
11 } question_t;
13 typedef struct {
14 time_t expiry;
15 set<string> *answers;
16 } captchaasked_t;
18 typedef std::vector<question_t*> questions_t;
19 typedef std::map<imcontact, captchaasked_t> captchas_t;
21 captchas_t captchas;
22 questions_t questions;
23 public:
24 captcha();
25 ~captcha();
27 /* check if we are already testing this contact */
28 bool docaptcha(imcontact c);
29 void donecaptcha(imcontact c);
30 /* check an answer */
31 bool checkcaptcha(imcontact c, string answer);
32 /* get a (new) question for a contact and remeber it */
33 string getcaptchaquestion(imcontact c);
35 bool empty();
36 unsigned int size();
37 void addquestion(string data);
41 #endif