/* * UserBackendMysql.cpp * * Copyright (C) 2008 Matthias Schiffer * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #include "UserBackendMysql.h" #include #define init UserBackendMysql_LTX_init #define deinit UserBackendMysql_LTX_deinit namespace Mad { namespace Modules { UserBackendMysql *UserBackendMysql::backend; bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) { if(handled) return false; if(entry[0].getKey().matches("UserBackendMysql")) { if(entry[1].getKey().matches("Host")) { if(entry[2].empty()) host = entry[1][0]; } else if(entry[1].getKey().matches("Username")) { if(entry[2].empty()) username = entry[1][0]; } else if(entry[1].getKey().matches("Password")) { if(entry[2].empty()) password = entry[1][0]; } else if(entry[1].getKey().matches("Database")) { if(entry[2].empty()) db = entry[1][0]; } else if(entry[1].getKey().matches("Queries")) { if(entry[2].getKey().matches("ListUsers")) { if(entry[3].empty()) queryListUsers = entry[2][0]; } else if(entry[2].getKey().matches("ListGroups")) { if(entry[3].empty()) queryListGroups = entry[2][0]; } else if(entry[2].getKey().matches("ListUserGroups")) { if(entry[3].empty()) queryListUserGroups = entry[2][0]; } else if(entry[2].getKey().matches("ListGroupUsers")) { if(entry[3].empty()) queryListGroupUsers = entry[2][0]; } else if(entry[2].getKey().matches("UserById")) { if(entry[3].empty()) queryUserById = entry[2][0]; } else if(entry[2].getKey().matches("UserByName")) { if(entry[3].empty()) queryUserByName = entry[2][0]; } else if(entry[2].getKey().matches("GroupById")) { if(entry[3].empty()) queryGroupById = entry[2][0]; } else if(entry[2].getKey().matches("GroupByName")) { if(entry[3].empty()) queryGroupByName = entry[2][0]; } } } } void UserBackendMysql::configFinished() { UserBackend::registerBackend(backend); } } } extern "C" { void init() { Mad::Modules::UserBackendMysql::registerBackend(); } void deinit() { Mad::Modules::UserBackendMysql::unregisterBackend(); } }