summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-04 21:30:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-04 21:30:41 +0000
commitdae8024a466a0a90f03222d31e34555b9b612509 (patch)
tree3aef57f6c15c7fba0d574b3cc9041cab2143e026 /src/modules.cpp
parent9ed9068cc693fe0e39e2d2e0848a212254609ae4 (diff)
Completed support for module-handled umodes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@377 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 8e591ba0c..59834eefc 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -19,10 +19,10 @@ class ExtMode
public:
char modechar;
int type;
- bool default_on;
int params_when_on;
int params_when_off;
- ExtMode(char mc, int ty, bool d_on, int p_on, int p_off) : modechar(mc), type(ty), default_on(d_on), params_when_on(p_on), params_when_off(p_off) { };
+ bool needsoper;
+ ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { };
};
typedef std::vector<ExtMode> ExtModeList;
@@ -45,6 +45,20 @@ bool ModeDefined(char modechar, int type)
return false;
}
+bool ModeDefinedOper(char modechar, int type)
+{
+ log(DEBUG,"Size of extmodes vector is %d",EMode.size());
+ for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
+ {
+ log(DEBUG,"i->modechar==%c, modechar=%c, i->type=%d, type=%d",i->modechar,modechar,i->type,type);
+ 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)
{
@@ -72,12 +86,12 @@ int ModeDefinedOff(char modechar, int type)
}
// returns true if an extended mode character is in use
-bool DoAddExtendedMode(char modechar, int type, bool default_on, int params_on, int params_off)
+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,default_on,params_on,params_off));
+ EMode.push_back(ExtMode(modechar,type,requires_oper,params_on,params_off));
return true;
}
@@ -227,7 +241,7 @@ Admin Server::GetAdmin()
-bool Server::AddExtendedMode(char modechar, int type, bool default_on, int params_when_on, int params_when_off)
+bool Server::AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off)
{
if (type == MT_SERVER)
{
@@ -244,7 +258,7 @@ bool Server::AddExtendedMode(char modechar, int type, bool default_on, int param
log(DEBUG,"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported");
return false;
}
- return DoAddExtendedMode(modechar,type,default_on,params_when_on,params_when_off);
+ return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off);
}