diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-08 20:14:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-08 20:14:57 +0000 |
commit | f88beda4d44fde34a56ce85bb3e9cbc045856dec (patch) | |
tree | fc739d960b82aff00fa5d1d9ef9e8885bfd6d933 /src | |
parent | 8ba0d3ae4088035a604789a86bc9e9123eaed636 (diff) |
Remove Server::AddExtendedMode and Server::AddExtendedListMode, replace with Server::AddMode (makes more sense naming wise too as all modes are modes, all the same now)
NOTE: Modules that implement modes WILL NO LONGER COMPILE NOW UNTIL THEY ARE PORTED TO THE NEW API
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4188 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 129 |
1 files changed, 2 insertions, 127 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 2f236b1c9..e53f0c775 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -59,96 +59,8 @@ extern command_table cmdlist; class Server; -ExtModeList EMode; featurelist Features; -// returns true if an extended mode character is in use -bool ModeDefined(char modechar, int type) -{ - for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) - { - if ((i->modechar == modechar) && (i->type == type)) - { - return true; - } - } - return false; -} - -bool ModeIsListMode(char modechar, int type) -{ - for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) - { - if ((i->modechar == modechar) && (i->type == type) && (i->list == true)) - { - return true; - } - } - return false; -} - -bool ModeDefinedOper(char modechar, int type) -{ - for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) - { - if ((i->modechar == modechar) && (i->type == type) && (i->needsoper == true)) - { - return true; - } - } - return false; -} - -// returns number of parameters for a custom mode when it is switched on -int ModeDefinedOn(char modechar, int type) -{ - for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) - { - if ((i->modechar == modechar) && (i->type == type)) - { - return i->params_when_on; - } - } - return 0; -} - -// returns number of parameters for a custom mode when it is switched on -int ModeDefinedOff(char modechar, int type) -{ - for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) - { - if ((i->modechar == modechar) && (i->type == type)) - { - return i->params_when_off; - } - } - return 0; -} - -// returns true if an extended mode character is in use -bool DoAddExtendedMode(char modechar, int type, bool requires_oper, int params_on, int params_off) -{ - if (ModeDefined(modechar,type)) { - return false; - } - EMode.push_back(ExtMode(modechar,type,requires_oper,params_on,params_off)); - return true; -} - -// turns a mode into a listmode -void ModeMakeList(char modechar) -{ - for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) - { - if ((i->modechar == modechar) && (i->type == MT_CHANNEL)) - { - i->list = true; - return; - } - } - return; -} - // version is a simple class for holding a modules version number Version::Version(int major, int minor, int revision, int build, int flags) : Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags) { }; @@ -668,45 +580,9 @@ Admin Server::GetAdmin() } - -bool Server::AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off) -{ - if (((modechar >= 'A') && (modechar <= 'Z')) || ((modechar >= 'a') && (modechar <= 'z'))) - { - if (type == MT_SERVER) - { - ModuleException e("Modes of type MT_SERVER are reserved for future expansion"); - throw(e); - return false; - } - if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT)) - { - ModuleException e("Parameters on MT_CLIENT modes are not supported"); - throw(e); - return false; - } - if ((params_when_on>1) || (params_when_off>1)) - { - ModuleException e("More than one parameter for an MT_CHANNEL mode is not yet supported"); - throw(e); - return false; - } - return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off); - } - else - { - ModuleException e("Muppet modechar detected."); - throw(e); - } - return false; -} - -bool Server::AddExtendedListMode(char modechar) +bool Server::AddMode(ModeHandler* mh, const unsigned char mode) { - bool res = DoAddExtendedMode(modechar,MT_CHANNEL,false,1,1); - if (res) - ModeMakeList(modechar); - return res; + return ServerInstance->ModeGrok->AddMode(mh,mode); } int Server::CountUsers(chanrec* c) @@ -714,7 +590,6 @@ int Server::CountUsers(chanrec* c) return usercount(c); } - bool Server::UserToPseudo(userrec* user, const std::string &message) { unsigned int old_fd = user->fd; |