#include <admin.h>
Public Member Functions | |
Admin (BotKernel *) | |
Constructor. | |
bool | addChannel (string) |
Add a channel managed by the bot. | |
bool | delChannel (string) |
Remove a channel managed by the bot. | |
bool | channelExists (string) |
Tell if a channel is registred. | |
vector< string > | getChannelsList () |
Return channel list. | |
bool | addSuperAdmin (string) |
Add a super admin. | |
bool | addTempSuperAdmin (string, unsigned int) |
Add a temporary super admin. | |
void | clearTempAdmins () |
Clear timed out temporary super admins. | |
bool | delSuperAdmin (unsigned int) |
Del a super admin. | |
bool | isSuperAdmin (string) |
Tell if a user is a super admin. | |
bool | maskIsSuperAdmin (string) |
Tell if a mask is super admin. | |
vector< string > | superAdminList () |
Give the super admin hosts list. | |
bool | addUser (string, string, unsigned int) |
Add a user to a channel. | |
bool | delUser (string, string) |
Del a user from a channel. | |
bool | userExists (string, string) |
Tell if a user exists for a channel. | |
bool | updateUserLevel (string, string, unsigned int) |
Update a user level. | |
unsigned int | getUserLevel (string, string) |
Get a user level for a channel. | |
unsigned int | getMaskLevel (string, string) |
Get mask level for a channel. | |
vector< string > | chanLevels (string) |
Give all the access for a channel. | |
void | enableCommand (string, string) |
Enable a command on a channel. | |
void | disableCommand (string, string) |
Disable a command on a channel. | |
void | addOnlyonCommand (string, string) |
Allow a command on a specific channel (disable for others). | |
void | delOnlyonCommand (string, string) |
Remove a Onlyon command. | |
bool | commandOK (string, string) |
Tell if a command is can be executed on a channel. | |
vector< string > | commandsStatus () |
Give commands status (onlyon or disabled). | |
Private Member Functions | |
void | initFile () |
Initialize the XML file. | |
Private Attributes | |
TiXmlDocument * | doc |
Represent the xml document. | |
TiXmlNode * | root |
Represent documents's root. |
This plugin stores (with an xml file) bot accounts (by host) and provides stuff for administration
Definition at line 50 of file admin.h.
Admin::Admin | ( | BotKernel * | b | ) |
Constructor.
Constructor
Definition at line 34 of file admin.cpp.
References Plugin::author, Plugin::bindFunction(), Plugin::description, doc, BotKernel::getDatasDir(), IN_BEFORE_TREATMENT, IN_COMMAND_HANDLER, IN_FIRST_WORD, IN_LOOP, IN_TYPE_HANDLER, initFile(), Plugin::name, root, and Plugin::version.
bool Admin::addChannel | ( | string | channel | ) |
Add a channel managed by the bot.
Add a channel managed by the bot
channel | Channel name that you want to add |
Definition at line 111 of file admin.cpp.
References channelExists(), doc, root, and Tools::to_lower().
Referenced by addUser().
void Admin::addOnlyonCommand | ( | string | command, | |
string | channel | |||
) |
Allow a command on a specific channel (disable for others).
Allow a command on a specific channel (disable for others)
command | Onlyon command | |
channel | Channel where to enable only the command |
Definition at line 625 of file admin.cpp.
References doc, root, and Tools::to_lower().
Referenced by addOnlyon().
bool Admin::addSuperAdmin | ( | string | mask | ) |
Add a super admin.
Add a super admin for the bot
mask | Super admin's mask |
Definition at line 171 of file admin.cpp.
References doc, isSuperAdmin(), root, and Tools::to_lower().
Referenced by addsuperadmin().
bool Admin::addTempSuperAdmin | ( | string | mask, | |
unsigned int | duration | |||
) |
Add a temporary super admin.
Add a temporary super admin for the bot
mask | Super admin's mask | |
duration | Super admin time (in seconds) |
Definition at line 192 of file admin.cpp.
References doc, isSuperAdmin(), root, and Tools::to_lower().
Referenced by addtempsuperadmin().
bool Admin::addUser | ( | string | channel, | |
string | mask, | |||
unsigned int | level | |||
) |
Add a user to a channel.
Add a user to a channel
channel | Channel where to add the user | |
mask | User's mask | |
level | User's level |
Definition at line 333 of file admin.cpp.
References addChannel(), channelExists(), doc, root, Tools::to_lower(), and userExists().
Referenced by updateUserLevel().
vector< string > Admin::chanLevels | ( | string | channel | ) |
bool Admin::channelExists | ( | string | channel | ) |
Tell if a channel is registred.
Tell if a channel is registred
channel | Channel name that you want to test existance |
Definition at line 153 of file admin.cpp.
References root, and Tools::to_lower().
Referenced by addChannel(), and addUser().
void Admin::clearTempAdmins | ( | ) |
Clear timed out temporary super admins.
Return Clear outdated temporary super admins
Definition at line 308 of file admin.cpp.
References doc, and Tools::strToInt().
bool Admin::commandOK | ( | string | command, | |
string | channel | |||
) |
Tell if a command is can be executed on a channel.
Tell if a command can be executed on a channel Check if the command is disabled or is not a "only on" one.
command | Command to check | |
channel | Channel to check |
Definition at line 695 of file admin.cpp.
References Tools::isInVector(), root, and Tools::to_lower().
Referenced by allowedCommandCheck().
vector< string > Admin::commandsStatus | ( | ) |
Give commands status (onlyon or disabled).
Give commands status (onlyon or disabled)
Definition at line 725 of file admin.cpp.
References root.
Referenced by commandsStatus().
bool Admin::delChannel | ( | string | channel | ) |
void Admin::delOnlyonCommand | ( | string | command, | |
string | channel | |||
) |
Remove a Onlyon command.
Remove a Onlyon command
command | Command on unonlyon | |
channel | Channel where the command is no more onlyon |
Definition at line 639 of file admin.cpp.
References doc, root, and Tools::to_lower().
Referenced by delOnlyon().
bool Admin::delSuperAdmin | ( | unsigned int | index | ) |
Del a super admin.
Del a super admin
index | Super admin index |
Definition at line 215 of file admin.cpp.
References doc.
Referenced by delsuperadmin().
bool Admin::delUser | ( | string | channel, | |
string | mask | |||
) |
Del a user from a channel.
Del a user from a channel
channel | Channel where to del the user | |
mask | User's mask to delete |
Definition at line 405 of file admin.cpp.
References delChannel(), doc, root, and Tools::to_lower().
Referenced by updateUserLevel().
void Admin::disableCommand | ( | string | command, | |
string | channel | |||
) |
void Admin::enableCommand | ( | string | command, | |
string | channel | |||
) |
vector< string > Admin::getChannelsList | ( | ) |
unsigned int Admin::getMaskLevel | ( | string | channel, | |
string | mask | |||
) |
Get mask level for a channel.
Get mask level for a channel 0 for nothing 1 for voice 2 for op 3 for master 4 for owner
channel | User's channel | |
mask | User's mask |
Definition at line 536 of file admin.cpp.
References Tools::masksMatch(), root, Tools::strToInt(), and Tools::to_lower().
Referenced by modeHandler().
unsigned int Admin::getUserLevel | ( | string | channel, | |
string | mask | |||
) |
Get a user level for a channel.
Get a user level for a channel 0 for nothing 1 for voice 2 for op 3 for master 4 for owner
channel | User's channel | |
mask | User's mask |
Definition at line 499 of file admin.cpp.
References Tools::ircMaskMatch(), root, Tools::strToInt(), and Tools::to_lower().
Referenced by chanlev(), Moderation::checkAccess(), Moderation::hasOpPrivileges(), invite(), joinHandler(), kickHandler(), modeHandler(), and whoami().
void Admin::initFile | ( | ) | [private] |
bool Admin::isSuperAdmin | ( | string | mask | ) |
Tell if a user is a super admin.
Tell if a user is a super admin
mask | mask for witch you want to check the access |
Definition at line 235 of file admin.cpp.
References Tools::ircMaskMatch(), root, and Tools::to_lower().
Referenced by addad(), addIgnore(), addOnlyon(), addSuperAdmin(), addTempSuperAdmin(), adinfos(), chanlev(), clearCountDowns(), commandsStatus(), cycleChannel(), delad(), deletekey(), deleteplayer(), delIgnore(), delOnlyon(), delQuote(), disable(), disconnect(), enable(), flushconffile(), getconfvalue(), getnbcountdowns(), Moderation::hasOpPrivileges(), ignoreList(), increase(), invite(), isIgnored(), joinChannel(), kickHandler(), leaveChannel(), listads(), listlibs(), listmodules(), load(), loadconffile(), loadnocheck(), modeHandler(), modeHandlerProtect(), moduleinfos(), nextscore(), notice(), onInvite(), protectmodes(), protecttopic(), quoteInfos(), raw(), reauth(), reloadfas(), reset(), setconfvalue(), setlogkeepfiles(), setloglevel(), setlogperiod(), setNick(), stopSurvey(), superadminlist(), tell(), testMsgTimestamp(), topicHandler(), unload(), unloadnocheck(), unprotectmodes(), unprotecttopic(), and whoami().
bool Admin::maskIsSuperAdmin | ( | string | mask | ) |
Tell if a mask is super admin.
Tell is a mask is a super admin
mask | Mask to test |
Definition at line 253 of file admin.cpp.
References Tools::masksMatch(), root, and Tools::to_lower().
Referenced by modeHandler().
vector< string > Admin::superAdminList | ( | ) |
Give the super admin hosts list.
Return the list of the super admins
Definition at line 280 of file admin.cpp.
References doc, Tools::intToStr(), and Tools::strToInt().
Referenced by superadminlist().
bool Admin::updateUserLevel | ( | string | channel, | |
string | mask, | |||
unsigned int | level | |||
) |
Update a user level.
Update a User's level
channel | user's channel | |
mask | user's mask | |
level | New user's level |
Definition at line 444 of file admin.cpp.
References addUser(), delUser(), doc, root, Tools::to_lower(), and userExists().
Referenced by chanlev().
bool Admin::userExists | ( | string | channel, | |
string | mask | |||
) |
Tell if a user exists for a channel.
Tell if a user exists for a channel The user is recognized by a host
channel | Channel where we want to make the test | |
mask | User's mask |
Definition at line 373 of file admin.cpp.
References root, and Tools::to_lower().
Referenced by addUser(), and updateUserLevel().
TiXmlDocument* Admin::doc [private] |
Represent the xml document.
Definition at line 54 of file admin.h.
Referenced by addChannel(), addOnlyonCommand(), addSuperAdmin(), addTempSuperAdmin(), addUser(), Admin(), clearTempAdmins(), delChannel(), delOnlyonCommand(), delSuperAdmin(), delUser(), disableCommand(), enableCommand(), initFile(), superAdminList(), and updateUserLevel().
TiXmlNode* Admin::root [private] |
Represent documents's root.
Definition at line 56 of file admin.h.
Referenced by addChannel(), addOnlyonCommand(), addSuperAdmin(), addTempSuperAdmin(), addUser(), Admin(), chanLevels(), channelExists(), commandOK(), commandsStatus(), delChannel(), delOnlyonCommand(), delUser(), disableCommand(), enableCommand(), getChannelsList(), getMaskLevel(), getUserLevel(), initFile(), isSuperAdmin(), maskIsSuperAdmin(), updateUserLevel(), and userExists().