summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-09 13:06:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-09 13:06:57 +0000
commit3973b83ca279b9c45467afdf0ebf6091d04e4086 (patch)
treeb33257b436cd55e69ccf04cf0ae69bf943fff978 /src
parent6637802f216f3687cd5b0f42dcf6fc553299fdb9 (diff)
*TEST* Oper-Only-Stats (not yet tested)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2749 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_stats.cpp11
-rw-r--r--src/inspircd_io.cpp3
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_spanningtree.cpp14
4 files changed, 18 insertions, 12 deletions
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index 2d45aa873..53c371816 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -84,8 +84,17 @@ void cmd_stats::Handle (char **parameters, int pcnt, userrec *user)
parameters[0][1] = '\0';
}
+ if ((strchr(Config->OperOnlyStats,*parameters[0])) && (!*user->oper))
+ {
+ WriteServ(user->fd,"481 %s :Permission denied - This stats character is set as oper-only");
+ return;
+ }
- FOREACH_MOD(I_OnStats,OnStats(*parameters[0]));
+
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(I_OnStats,OnStats(*parameters[0],user));
+ if (MOD_RESULT)
+ return;
if (*parameters[0] == 'c')
{
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index 42ae122e8..d685faf4e 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -43,7 +43,7 @@ ServerConfig::ServerConfig()
*ServerName = *Network = *ServerDesc = *AdminName = '\0';
*AdminEmail = *AdminNick = *diepass = *restartpass = '\0';
*motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
- *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
+ *OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
log_file = NULL;
nofork = false;
unlimitcore = false;
@@ -157,6 +157,7 @@ void ServerConfig::Read(bool bail, userrec* user)
ConfValue("disabled","commands",0,Config->DisabledCommands,&Config->config_f);
ConfValue("options","somaxconn",0,MCON,&Config->config_f);
ConfValue("options","softlimit",0,SLIMT,&Config->config_f);
+ ConfValue("options","operonlystats",0,Config->OperOnlyStats,&Config->config_f);
Config->SoftLimit = atoi(SLIMT);
if ((Config->SoftLimit < 1) || (Config->SoftLimit > MAXCLIENTS))
diff --git a/src/modules.cpp b/src/modules.cpp
index b3b2daab3..8f328e205 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -255,7 +255,7 @@ int Module::OnCheckInvite(userrec* user, chanrec* chan) { return 0; };
int Module::OnCheckKey(userrec* user, chanrec* chan, std::string keygiven) { return 0; };
int Module::OnCheckLimit(userrec* user, chanrec* chan) { return 0; };
int Module::OnCheckBan(userrec* user, chanrec* chan) { return 0; };
-void Module::OnStats(char symbol) { };
+int Module::OnStats(char symbol, userrec* user) { };
int Module::OnChangeLocalUserHost(userrec* user, std::string newhost) { return 0; };
int Module::OnChangeLocalUserGECOS(userrec* user, std::string newhost) { return 0; };
int Module::OnLocalTopicChange(userrec* user, chanrec* chan, std::string topic) { return 0; };
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 1e597c910..369bda8ef 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -2715,9 +2715,9 @@ class ModuleSpanningTree : public Module
return 1;
}
- virtual bool HandleStats(char ** parameters, int pcnt, userrec* user)
+ virtual int OnStats(char statschar, userrec* user)
{
- if (*parameters[0] == 'c')
+ if (statschar == 'c')
{
for (unsigned int i = 0; i < LinkBlocks.size(); i++)
{
@@ -2726,9 +2726,9 @@ class ModuleSpanningTree : public Module
}
WriteServ(user->fd,"219 %s %s :End of /STATS report",user->nick,parameters[0]);
WriteOpers("*** Notice: Stats '%s' requested by %s (%s@%s)",parameters[0],user->nick,user->ident,user->host);
- return true;
+ return 1;
}
- return false;
+ return 0;
}
virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user, bool validated)
@@ -2745,10 +2745,6 @@ class ModuleSpanningTree : public Module
{
return this->HandleSquit(parameters,pcnt,user);
}
- else if (command == "STATS")
- {
- return this->HandleStats(parameters,pcnt,user);
- }
else if (command == "MAP")
{
this->HandleMap(parameters,pcnt,user);
@@ -3219,7 +3215,7 @@ class ModuleSpanningTree : public Module
List[I_OnUserQuit] = List[I_OnUserPostNick] = List[I_OnUserKick] = List[I_OnRemoteKill] = List[I_OnRehash] = 1;
List[I_OnOper] = List[I_OnAddGLine] = List[I_OnAddZLine] = List[I_OnAddQLine] = List[I_OnAddELine] = 1;
List[I_OnDelGLine] = List[I_OnDelZLine] = List[I_OnDelQLine] = List[I_OnDelELine] = List[I_ProtoSendMode] = List[I_OnMode] = 1;
- List[I_ProtoSendMetaData] = 1;
+ List[I_OnStats] = List[I_ProtoSendMetaData] = 1;
}
};