Added all config variables into Config class. Added support for Doxygen

This commit is contained in:
Jan Kaluza 2011-02-14 10:27:12 +01:00
parent b440870d9b
commit e494f49684
5 changed files with 1534 additions and 4 deletions

View file

@ -9,6 +9,8 @@ find_package(cppunit)
set(sqlite3_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
find_package(sqlite3)
find_package(Doxygen)
message("Supported features")
message("------------------")
@ -40,11 +42,20 @@ else(CMAKE_BUILD_TYPE MATCHES Debug)
message("Debug : no")
endif(CMAKE_BUILD_TYPE MATCHES Debug)
SET(TRANSPORT_VERSION 2.0)
SET(PROJECT_VERSION 2.0)
include_directories(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(examples)
if(DOXYGEN_FOUND)
message("Docs : yes")
ADD_SUBDIRECTORY(docs)
else(DOXYGEN_FOUND)
message("Docs : no")
endif(DOXYGEN_FOUND)
message("------------------")

2
docs/CMakeLists.txt Normal file
View file

@ -0,0 +1,2 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(docs doxygen ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM)

1510
docs/Doxyfile.in Normal file

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,13 @@ bool Config::load(const std::string &configfile, boost::program_options::options
("service.server", value<std::string>()->default_value(""), "Server to connect to")
("service.password", value<std::string>()->default_value(""), "Password used to auth the server")
("service.port", value<int>()->default_value(0), "Port the server is listening on")
("service.protocol", value<std::string>()->default_value(""), "Protocol")
("service.allowed_servers", value<std::string>()->default_value(""), "Only users from these servers can connect")
("registration.enable_public_registration", value<bool>()->default_value(true), "True if users should be able to register.")
("registration.language", value<std::string>()->default_value("en"), "Default language for registration form")
("registration.instructions", value<std::string>()->default_value(""), "Instructions showed to user in registration form")
("registration.username_field", value<std::string>()->default_value(""), "Label for username field")
("registration.username_mask", value<std::string>()->default_value(""), "Username mask")
("database.database", value<std::string>()->default_value(""), "Database used to store data")
("database.prefix", value<std::string>()->default_value(""), "Prefix of tables in database")
;

View file

@ -129,7 +129,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
// User *user = m_userManager->getUserByJID(barejid);
if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) {
std::list<std::string> const &x = CONFIG_LIST(m_config,"registration.enable_public_registration");
std::list<std::string> const &x = CONFIG_LIST(m_config,"service.allowed_servers");
if (std::find(x.begin(), x.end(), from.getDomain().getUTF8String()) == x.end()) {
// Log("UserRegistration", "This user has no permissions to register an account");
Swift::GetResponder<Swift::InBandRegistrationPayload>::sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify);
@ -144,7 +144,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
UserInfo res;
bool registered = m_storageBackend->getUser(barejid, res);
std::string instructions = CONFIG_STRING(m_config, "registration.reg_instructions");
std::string instructions = CONFIG_STRING(m_config, "registration.instructions");
reg->setInstructions(instructions);
reg->setRegistered(res.id != -1);
@ -152,7 +152,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
if (CONFIG_STRING(m_config, "service.protocol") != "twitter" && CONFIG_STRING(m_config, "service.protocol") != "bonjour")
reg->setPassword(res.password);
std::string usernameField = CONFIG_STRING(m_config, "registration.reg_username_field");
std::string usernameField = CONFIG_STRING(m_config, "registration.username_field");
Form::ref form(new Form(Form::FormType));
form->setTitle(tr(_language, _("Registration")));
@ -225,7 +225,7 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID
// AbstractUser *user = m_component->userManager()->getUserByJID(barejid);
if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) {
std::list<std::string> const &x = CONFIG_LIST(m_config,"registration.enable_public_registration");
std::list<std::string> const &x = CONFIG_LIST(m_config,"service.allowed_servers");
if (std::find(x.begin(), x.end(), from.getDomain().getUTF8String()) == x.end()) {
// Log("UserRegistration", "This user has no permissions to register an account");
Swift::SetResponder<Swift::InBandRegistrationPayload>::sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify);