#include <survey.h>
Public Member Functions | |
Survey (BotKernel *) | |
Constructor. | |
bool | launchSurvey (string, string, unsigned int, vector< string >) |
Launch a survey. | |
bool | stopSurvey (string) |
Stop a survey. | |
bool | vote (string, string, string) |
Vote. | |
vector< string > | finishSurvey (string) |
Finish a survey. | |
vector< plugin_function > | getSurveyFunctions (string) |
Get survey's functions. | |
bool | setSurveyFunctions (string, vector< plugin_function >) |
Set survey's functions. | |
plugin_function | getCountDown (string) |
get countdown pointer | |
bool | setCountDown (string, plugin_function) |
set countdown pointer | |
Private Member Functions | |
int | getAnswerId (vector< string >, string) |
Get an answer's id. | |
bool | surveyRunning (string) |
Test if a survey is running. | |
Private Attributes | |
vector< struct_survey > | surveys |
Surveys storage. |
This plugin manages surveys
Definition at line 55 of file survey.h.
Survey::Survey | ( | BotKernel * | b | ) |
Constructor.
Constructor
Definition at line 34 of file survey.cpp.
References Plugin::addRequirement(), Plugin::author, Plugin::bindFunction(), Plugin::description, IN_COMMAND_HANDLER, Plugin::name, surveys, and Plugin::version.
vector< string > Survey::finishSurvey | ( | string | channel | ) |
Finish a survey.
Finish the survey
channel | Channel where finish the survey |
Definition at line 80 of file survey.cpp.
References Tools::intToStr(), and surveys.
Referenced by endSurvey().
int Survey::getAnswerId | ( | vector< string > | answers, | |
string | answer | |||
) | [private] |
Get an answer's id.
Get an answer's id
answers | Answers list | |
answer | Answer to check |
Definition at line 226 of file survey.cpp.
Referenced by vote().
plugin_function Survey::getCountDown | ( | string | channel | ) |
get countdown pointer
Get survey's countdown
channel | Channel's survey |
Definition at line 193 of file survey.cpp.
References surveys.
Referenced by stopSurvey().
vector< plugin_function > Survey::getSurveyFunctions | ( | string | channel | ) |
Get survey's functions.
Get survey's functions
channel | Channel's survey |
Definition at line 161 of file survey.cpp.
References surveys.
Referenced by endSurvey(), and stopSurvey().
bool Survey::launchSurvey | ( | string | channel, | |
string | question, | |||
unsigned int | time, | |||
vector< string > | answers | |||
) |
Launch a survey.
Launch a survey on a channel
channel | Channel where launch the survey | |
question | Survey's question | |
time | Survey length (in seconds) | |
answers | Possible answers |
Definition at line 54 of file survey.cpp.
References struct_survey::answers, struct_survey::channel, struct_survey::countDown, struct_survey::functions, struct_survey::question, struct_survey::results, surveyRunning(), surveys, struct_survey::time, and struct_survey::voters.
Referenced by launchSurvey().
bool Survey::setCountDown | ( | string | channel, | |
plugin_function | function | |||
) |
set countdown pointer
Set survey's countdown
channel | Channel's survey | |
function | Countdown function |
Definition at line 209 of file survey.cpp.
References surveys.
Referenced by launchSurvey().
bool Survey::setSurveyFunctions | ( | string | channel, | |
vector< plugin_function > | functions | |||
) |
Set survey's functions.
Set survey's functions
channel | Channel's survey | |
functions | A vector functions |
Definition at line 177 of file survey.cpp.
References surveys.
Referenced by launchSurvey().
bool Survey::stopSurvey | ( | string | channel | ) |
Stop a survey.
Stop a survey on a channel
channel | Channel where stop the survey |
Definition at line 129 of file survey.cpp.
References surveys.
Referenced by launchSurvey(), and stopSurvey().
bool Survey::surveyRunning | ( | string | channel | ) | [private] |
Test if a survey is running.
Test if a survey is running on a channel
channel | Channel where test if a survey is running |
Definition at line 147 of file survey.cpp.
References surveys.
Referenced by launchSurvey().
bool Survey::vote | ( | string | channel, | |
string | nick, | |||
string | answer | |||
) |
Vote.
Register a vote for a user
channel | Channel where the user votes | |
nick | User's nick | |
answer | User's answer |
Definition at line 104 of file survey.cpp.
References getAnswerId(), Tools::isInVector(), and surveys.
Referenced by vote().
vector<struct_survey> Survey::surveys [private] |
Surveys storage.
Definition at line 59 of file survey.h.
Referenced by finishSurvey(), getCountDown(), getSurveyFunctions(), launchSurvey(), setCountDown(), setSurveyFunctions(), stopSurvey(), Survey(), surveyRunning(), and vote().