summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 15:14:39 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 15:14:39 +0000
commit7775a195d9c417e52eaaf912ec51d62bf0fd9a54 (patch)
tree7ebb40e491e247a94be9c463fb3f656cdc43a136 /src
parent12e17fdf4755beca6def415f39d25722b9fe310f (diff)
Move remaining functions:
operstrcmp* commands.cpp InspIRCd::operstrcmp() duration* commands.cpp InspIRCd::duration() host_matches_everyone* commands.cpp InspIRCd::host_matches_everyone() ip_matches_everyone* commands.cpp InspIRCd::ip_matches_everyone() nick_matches_everyone* commands.cpp InspIRCd::nick_matches_everyone() git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4888 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp10
-rw-r--r--src/cmd_eline.cpp10
-rw-r--r--src/cmd_gline.cpp10
-rw-r--r--src/cmd_kick.cpp2
-rw-r--r--src/cmd_kline.cpp10
-rw-r--r--src/cmd_notice.cpp2
-rw-r--r--src/cmd_oper.cpp2
-rw-r--r--src/cmd_privmsg.cpp2
-rw-r--r--src/cmd_qline.cpp10
-rw-r--r--src/cmd_zline.cpp10
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/commands.cpp58
-rw-r--r--src/inspircd.cpp5
-rw-r--r--src/mode.cpp2
-rw-r--r--src/modes/cmode_h.cpp4
-rw-r--r--src/modes/cmode_o.cpp4
-rw-r--r--src/modes/cmode_v.cpp4
-rw-r--r--src/modules.cpp10
-rw-r--r--src/modules/m_alias.cpp2
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_chanprotect.cpp6
-rw-r--r--src/modules/m_chghost.cpp2
-rw-r--r--src/modules/m_nokicks.cpp2
-rw-r--r--src/modules/m_nonotice.cpp2
-rw-r--r--src/modules/m_remove.cpp4
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_sanick.cpp2
-rw-r--r--src/modules/m_sapart.cpp2
-rw-r--r--src/modules/m_saquit.cpp2
-rw-r--r--src/modules/m_services.cpp10
-rw-r--r--src/modules/m_services_account.cpp6
-rw-r--r--src/modules/m_spanningtree.cpp12
-rw-r--r--src/modules/m_swhois.cpp4
-rw-r--r--src/modules/m_timedbans.cpp6
34 files changed, 103 insertions, 120 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 513e77607..8011a1ff4 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -558,14 +558,14 @@ long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
src->WriteServ("441 %s %s %s :They are not on that channel",src->nick, user->nick, this->name);
return this->GetUserCounter();
}
- if ((is_uline(user->server)) && (!is_uline(src->server)))
+ if ((ServerInstance->is_uline(user->server)) && (!ServerInstance->is_uline(src->server)))
{
src->WriteServ("482 %s %s :Only a u-line may kick a u-line from a channel.",src->nick, this->name);
return this->GetUserCounter();
}
int MOD_RESULT = 0;
- if (!is_uline(src->server))
+ if (!ServerInstance->is_uline(src->server))
{
MOD_RESULT = 0;
FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,this,reason));
@@ -576,10 +576,10 @@ long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
if (MOD_RESULT != -1)
{
FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,this,AC_KICK));
- if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
+ if ((MOD_RESULT == ACR_DENY) && (!ServerInstance->is_uline(src->server)))
return this->GetUserCounter();
- if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server)))
+ if ((MOD_RESULT == ACR_DEFAULT) || (!ServerInstance->is_uline(src->server)))
{
int them = this->GetStatus(src);
int us = this->GetStatus(user);
@@ -919,7 +919,7 @@ int chanrec::GetStatusFlags(userrec *user)
int chanrec::GetStatus(userrec *user)
{
- if (is_uline(user->server))
+ if (ServerInstance->is_uline(user->server))
return STATUS_OP;
for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index 67874b5d7..e25fb37e3 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -30,19 +30,19 @@ void cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
- if (host_matches_everyone(parameters[0],user))
+ if (ServerInstance->host_matches_everyone(parameters[0],user))
return;
- ServerInstance->XLines->add_eline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD(I_OnAddELine,OnAddELine(duration(parameters[1]), user, parameters[2], parameters[0]));
+ ServerInstance->XLines->add_eline(ServerInstance->duration(parameters[1]),user->nick,parameters[2],parameters[0]);
+ FOREACH_MOD(I_OnAddELine,OnAddELine(ServerInstance->duration(parameters[1]), user, parameters[2], parameters[0]));
- if (!duration(parameters[1]))
+ if (!ServerInstance->duration(parameters[1]))
{
ServerInstance->WriteOpers("*** %s added permanent E-line for %s.",user->nick,parameters[0]);
}
else
{
- ServerInstance->WriteOpers("*** %s added timed E-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
+ ServerInstance->WriteOpers("*** %s added timed E-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->duration(parameters[1]));
}
}
else
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 91f2e6b1c..69d8b51ca 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -30,19 +30,19 @@ void cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
- if (host_matches_everyone(parameters[0],user))
+ if (ServerInstance->host_matches_everyone(parameters[0],user))
return;
- ServerInstance->XLines->add_gline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD(I_OnAddGLine,OnAddGLine(duration(parameters[1]), user, parameters[2], parameters[0]));
+ ServerInstance->XLines->add_gline(ServerInstance->duration(parameters[1]),user->nick,parameters[2],parameters[0]);
+ FOREACH_MOD(I_OnAddGLine,OnAddGLine(ServerInstance->duration(parameters[1]), user, parameters[2], parameters[0]));
- if (!duration(parameters[1]))
+ if (!ServerInstance->duration(parameters[1]))
{
ServerInstance->WriteOpers("*** %s added permanent G-line for %s.",user->nick,parameters[0]);
}
else
{
- ServerInstance->WriteOpers("*** %s added timed G-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
+ ServerInstance->WriteOpers("*** %s added timed G-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->duration(parameters[1]));
}
ServerInstance->XLines->apply_lines(APPLY_GLINES);
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index 9c517ee9e..6a37052db 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -35,7 +35,7 @@ void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
return;
}
- if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!is_uline(user->server)))
+ if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->is_uline(user->server)))
{
user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
return;
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index 3ed25602c..7e9555956 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -35,19 +35,19 @@ void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
- if (host_matches_everyone(parameters[0],user))
+ if (ServerInstance->host_matches_everyone(parameters[0],user))
return;
- ServerInstance->XLines->add_kline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD(I_OnAddKLine,OnAddKLine(duration(parameters[1]), user, parameters[2], parameters[0]));
+ ServerInstance->XLines->add_kline(ServerInstance->duration(parameters[1]),user->nick,parameters[2],parameters[0]);
+ FOREACH_MOD(I_OnAddKLine,OnAddKLine(ServerInstance->duration(parameters[1]), user, parameters[2], parameters[0]));
- if (!duration(parameters[1]))
+ if (!ServerInstance->duration(parameters[1]))
{
ServerInstance->WriteOpers("*** %s added permanent K-line for %s.",user->nick,parameters[0]);
}
else
{
- ServerInstance->WriteOpers("*** %s added timed K-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
+ ServerInstance->WriteOpers("*** %s added timed K-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->duration(parameters[1]));
}
ServerInstance->XLines->apply_lines(APPLY_KLINES);
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index 6882c8d35..257fd7495 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -37,7 +37,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
return;
- if ((parameters[0][0] == '$') && ((*user->oper) || (is_uline(user->server))))
+ if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->is_uline(user->server))))
{
int MOD_RESULT = 0;
std::string temp = parameters[1];
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 7f81da59e..67ce00c19 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -73,7 +73,7 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "type", i, OperType, MAXBUF);
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "host", i, HostName, MAXBUF);
- if ((!strcmp(LoginName,parameters[0])) && (!operstrcmp(Password,parameters[1])) && (OneOfMatches(TheHost,TheIP,HostName)))
+ if ((!strcmp(LoginName,parameters[0])) && (!ServerInstance->operstrcmp(Password,parameters[1])) && (OneOfMatches(TheHost,TheIP,HostName)))
{
fail2 = true;
for (j =0; j < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "type"); j++)
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 955bb9af3..9ee335234 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -35,7 +35,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
return;
- if ((parameters[0][0] == '$') && ((*user->oper) || (is_uline(user->server))))
+ if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->is_uline(user->server))))
{
int MOD_RESULT = 0;
std::string temp = parameters[1];
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index c82b5f53c..1e2b7cbd0 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -27,17 +27,17 @@ void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
- if (nick_matches_everyone(parameters[0],user))
+ if (ServerInstance->nick_matches_everyone(parameters[0],user))
return;
- ServerInstance->XLines->add_qline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD(I_OnAddQLine,OnAddQLine(duration(parameters[1]), user, parameters[2], parameters[0]));
- if (!duration(parameters[1]))
+ ServerInstance->XLines->add_qline(ServerInstance->duration(parameters[1]),user->nick,parameters[2],parameters[0]);
+ FOREACH_MOD(I_OnAddQLine,OnAddQLine(ServerInstance->duration(parameters[1]), user, parameters[2], parameters[0]));
+ if (!ServerInstance->duration(parameters[1]))
{
ServerInstance->WriteOpers("*** %s added permanent Q-line for %s.",user->nick,parameters[0]);
}
else
{
- ServerInstance->WriteOpers("*** %s added timed Q-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
+ ServerInstance->WriteOpers("*** %s added timed Q-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->duration(parameters[1]));
}
ServerInstance->XLines->apply_lines(APPLY_QLINES);
}
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 61615da46..772bac84f 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -35,17 +35,17 @@ void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("NOTICE %s :*** You cannot include a username in a zline, a zline must ban only an IP mask",user->nick);
return;
}
- if (ip_matches_everyone(parameters[0],user))
+ if (ServerInstance->ip_matches_everyone(parameters[0],user))
return;
- ServerInstance->XLines->add_zline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD(I_OnAddZLine,OnAddZLine(duration(parameters[1]), user, parameters[2], parameters[0]));
- if (!duration(parameters[1]))
+ ServerInstance->XLines->add_zline(ServerInstance->duration(parameters[1]),user->nick,parameters[2],parameters[0]);
+ FOREACH_MOD(I_OnAddZLine,OnAddZLine(ServerInstance->duration(parameters[1]), user, parameters[2], parameters[0]));
+ if (!ServerInstance->duration(parameters[1]))
{
ServerInstance->WriteOpers("*** %s added permanent Z-line for %s.",user->nick,parameters[0]);
}
else
{
- ServerInstance->WriteOpers("*** %s added timed Z-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
+ ServerInstance->WriteOpers("*** %s added timed Z-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->duration(parameters[1]));
}
ServerInstance->XLines->apply_lines(APPLY_ZLINES);
}
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 2424b1844..2c3a482cb 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -134,7 +134,7 @@ bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, use
{
if (n->second->flags_needed)
{
- return ((user->HasPermission(commandname)) || (is_uline(user->server)));
+ return ((user->HasPermission(commandname)) || (ServerInstance->is_uline(user->server)));
}
return true;
}
diff --git a/src/commands.cpp b/src/commands.cpp
index 6bb169f0a..ca31c86d8 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -49,39 +49,31 @@
#include "typedefs.h"
#include "command_parse.h"
-extern InspIRCd* ServerInstance;
-
-const long duration_m = 60;
-const long duration_h = duration_m * 60;
-const long duration_d = duration_h * 24;
-const long duration_w = duration_d * 7;
-const long duration_y = duration_w * 52;
-
/* XXX - these really belong in helperfuncs perhaps -- w00t */
-bool is_uline(const char* server)
+bool InspIRCd::is_uline(const char* server)
{
if (!server)
return false;
if (!*server)
return true;
- return (find(ServerInstance->Config->ulines.begin(),ServerInstance->Config->ulines.end(),server) != ServerInstance->Config->ulines.end());
+ return (find(Config->ulines.begin(),Config->ulines.end(),server) != Config->ulines.end());
}
-int operstrcmp(const char* data,const char* input)
+int InspIRCd::operstrcmp(const char* data,const char* input)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnOperCompare,OnOperCompare(data,input))
- ServerInstance->Log(DEBUG,"operstrcmp: %d",MOD_RESULT);
+ FOREACH_RESULT_I(this,I_OnOperCompare,OnOperCompare(data,input))
+ Log(DEBUG,"operstrcmp: %d",MOD_RESULT);
if (MOD_RESULT == 1)
return 0;
if (MOD_RESULT == -1)
return 1;
- ServerInstance->Log(DEBUG,"strcmp fallback: '%s' '%s' %d",data,input,strcmp(data,input));
+ Log(DEBUG,"strcmp fallback: '%s' '%s' %d",data,input,strcmp(data,input));
return strcmp(data,input);
}
-long duration(const char* str)
+long InspIRCd::duration(const char* str)
{
char n_field[MAXBUF];
long total = 0;
@@ -142,19 +134,19 @@ long duration(const char* str)
/* All other ircds when doing this check usually just look for a string of *@* or *. We're smarter than that, though. */
-bool host_matches_everyone(const std::string &mask, userrec* user)
+bool InspIRCd::host_matches_everyone(const std::string &mask, userrec* user)
{
char buffer[MAXBUF];
char itrigger[MAXBUF];
long matches = 0;
- if (!ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "insane","trigger", 0, itrigger, MAXBUF))
+ if (!Config->ConfValue(Config->config_data, "insane","trigger", 0, itrigger, MAXBUF))
strlcpy(itrigger,"95.5",MAXBUF);
- if (ServerInstance->Config->ConfValueBool(ServerInstance->Config->config_data, "insane","hostmasks", 0))
+ if (Config->ConfValueBool(Config->config_data, "insane","hostmasks", 0))
return false;
- for (user_hash::iterator u = ServerInstance->clientlist.begin(); u != ServerInstance->clientlist.end(); u++)
+ for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
strlcpy(buffer,u->second->ident,MAXBUF);
charlcat(buffer,'@',MAXBUF);
@@ -162,62 +154,62 @@ bool host_matches_everyone(const std::string &mask, userrec* user)
if (match(buffer,mask.c_str()))
matches++;
}
- float percent = ((float)matches / (float)ServerInstance->clientlist.size()) * 100;
+ float percent = ((float)matches / (float)clientlist.size()) * 100;
if (percent > (float)atof(itrigger))
{
- ServerInstance->WriteOpers("*** \2WARNING\2: %s tried to set a G/K/E line mask of %s, which covers %.2f%% of the network!",user->nick,mask.c_str(),percent);
+ WriteOpers("*** \2WARNING\2: %s tried to set a G/K/E line mask of %s, which covers %.2f%% of the network!",user->nick,mask.c_str(),percent);
return true;
}
return false;
}
-bool ip_matches_everyone(const std::string &ip, userrec* user)
+bool InspIRCd::ip_matches_everyone(const std::string &ip, userrec* user)
{
char itrigger[MAXBUF];
long matches = 0;
- if (!ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
+ if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
strlcpy(itrigger,"95.5",MAXBUF);
- if (ServerInstance->Config->ConfValueBool(ServerInstance->Config->config_data, "insane","ipmasks",0))
+ if (Config->ConfValueBool(Config->config_data, "insane","ipmasks",0))
return false;
- for (user_hash::iterator u = ServerInstance->clientlist.begin(); u != ServerInstance->clientlist.end(); u++)
+ for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
if (match(u->second->GetIPString(),ip.c_str(),true))
matches++;
}
- float percent = ((float)matches / (float)ServerInstance->clientlist.size()) * 100;
+ float percent = ((float)matches / (float)clientlist.size()) * 100;
if (percent > (float)atof(itrigger))
{
- ServerInstance->WriteOpers("*** \2WARNING\2: %s tried to set a Z line mask of %s, which covers %.2f%% of the network!",user->nick,ip.c_str(),percent);
+ WriteOpers("*** \2WARNING\2: %s tried to set a Z line mask of %s, which covers %.2f%% of the network!",user->nick,ip.c_str(),percent);
return true;
}
return false;
}
-bool nick_matches_everyone(const std::string &nick, userrec* user)
+bool InspIRCd::nick_matches_everyone(const std::string &nick, userrec* user)
{
char itrigger[MAXBUF];
long matches = 0;
- if (!ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
+ if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
strlcpy(itrigger,"95.5",MAXBUF);
- if (ServerInstance->Config->ConfValueBool(ServerInstance->Config->config_data, "insane","nickmasks",0))
+ if (Config->ConfValueBool(Config->config_data, "insane","nickmasks",0))
return false;
- for (user_hash::iterator u = ServerInstance->clientlist.begin(); u != ServerInstance->clientlist.end(); u++)
+ for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
if (match(u->second->nick,nick.c_str()))
matches++;
}
- float percent = ((float)matches / (float)ServerInstance->clientlist.size()) * 100;
+ float percent = ((float)matches / (float)clientlist.size()) * 100;
if (percent > (float)atof(itrigger))
{
- ServerInstance->WriteOpers("*** \2WARNING\2: %s tried to set a Q line mask of %s, which covers %.2f%% of the network!",user->nick,nick.c_str(),percent);
+ WriteOpers("*** \2WARNING\2: %s tried to set a Q line mask of %s, which covers %.2f%% of the network!",user->nick,nick.c_str(),percent);
return true;
}
return false;
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 29148defe..8680c4197 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -190,14 +190,15 @@ std::string InspIRCd::GetRevision()
return REVISION;
}
-InspIRCd::InspIRCd(int argc, char** argv) : ModCount(-1)
+InspIRCd::InspIRCd(int argc, char** argv)
+ : duration_m(60), duration_h(60*60), duration_d(60*60*24), duration_w(60*60*24*7), duration_y(60*60*24*365), ModCount(-1)
{
bool SEGVHandler = false;
ServerInstance = this;
modules.resize(255);
factory.resize(255);
-
+
this->Config = new ServerConfig(this);
this->Start();
this->module_sockets.clear();
diff --git a/src/mode.cpp b/src/mode.cpp
index 44117ac77..ae18959d7 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -306,7 +306,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
ServerInstance->Log(DEBUG,"The user is not a halfop or above, checking other reasons for being able to set the modes");
/* Are we a uline or is it a servermode? */
- if ((!is_uline(user->server)) && (!servermode))
+ if ((!ServerInstance->is_uline(user->server)) && (!servermode))
{
/* Not enough permission:
* NOT a uline and NOT a servermode,
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 4b4730d52..da810a4d2 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -80,7 +80,7 @@ std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec
return "";
if (MOD_RESULT == ACR_DEFAULT)
{
- if ((status < STATUS_OP) && (!is_uline(user->server)))
+ if ((status < STATUS_OP) && (!ServerInstance->is_uline(user->server)))
{
user->WriteServ("482 %s %s :You're not a channel operator",user->nick, chan->name);
return "";
@@ -108,7 +108,7 @@ std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec
return "";
if (MOD_RESULT == ACR_DEFAULT)
{
- if ((user != d) && ((status < STATUS_OP) && (!is_uline(user->server))))
+ if ((user != d) && ((status < STATUS_OP) && (!ServerInstance->is_uline(user->server))))
{
user->WriteServ("482 %s %s :You are not a channel operator",user->nick, chan->name);
return "";
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 6aa36cc79..c8a969b9c 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -71,7 +71,7 @@ std::string ModeChannelOp::AddOp(userrec *user,const char* dest,chanrec *chan,in
return "";
if (MOD_RESULT == ACR_DEFAULT)
{
- if ((status < STATUS_OP) && (!is_uline(user->server)))
+ if ((status < STATUS_OP) && (!ServerInstance->is_uline(user->server)))
{
user->WriteServ("482 %s %s :You're not a channel operator",user->nick, chan->name);
return "";
@@ -102,7 +102,7 @@ std::string ModeChannelOp::DelOp(userrec *user,const char *dest,chanrec *chan,in
return "";
if (MOD_RESULT == ACR_DEFAULT)
{
- if ((status < STATUS_OP) && (!is_uline(user->server)) && (IS_LOCAL(user)))
+ if ((status < STATUS_OP) && (!ServerInstance->is_uline(user->server)) && (IS_LOCAL(user)))
{
user->WriteServ("482 %s %s :You are not a channel operator",user->nick, chan->name);
return "";
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 26e176bc5..3f2910e1d 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -71,7 +71,7 @@ std::string ModeChannelVoice::AddVoice(userrec *user,const char* dest,chanrec *c
return "";
if (MOD_RESULT == ACR_DEFAULT)
{
- if ((status < STATUS_HOP) && (!is_uline(user->server)))
+ if ((status < STATUS_HOP) && (!ServerInstance->is_uline(user->server)))
{
user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick, chan->name);
return "";
@@ -99,7 +99,7 @@ std::string ModeChannelVoice::DelVoice(userrec *user,const char *dest,chanrec *c
return "";
if (MOD_RESULT == ACR_DEFAULT)
{
- if ((status < STATUS_HOP) && (!is_uline(user->server)))
+ if ((status < STATUS_HOP) && (!ServerInstance->is_uline(user->server)))
{
user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick, chan->name);
return "";
diff --git a/src/modules.cpp b/src/modules.cpp
index fd5672cd3..94ba661e0 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -338,11 +338,6 @@ bool InspIRCd::MatchText(const std::string &sliteral, const std::string &spatter
return match(sliteral.c_str(),spattern.c_str());
}
-bool InspIRCd::IsUlined(const std::string &server)
-{
- return is_uline(server.c_str());
-}
-
bool InspIRCd::CallCommandHandler(const std::string &commandname, const char** parameters, int pcnt, userrec* user)
{
return this->Parser->CallHandler(commandname,parameters,pcnt,user);
@@ -521,11 +516,6 @@ bool InspIRCd::DelELine(const std::string &hostmask)
return XLines->del_eline(hostmask.c_str());
}
-long InspIRCd::CalcDuration(const std::string &delta)
-{
- return duration(delta.c_str());
-}
-
/*
* XXX why on *earth* is this in modules.cpp...? I think
* perhaps we need a server.cpp for InspIRCd:: stuff where possible. -- w00t
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index f3e2ed3f8..7b29cc9f9 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -116,7 +116,7 @@ class ModuleAlias : public Module
}
if ((u != NULL) && (Aliases[i].requires != "") && (Aliases[i].uline))
{
- if (!is_uline(u->server))
+ if (!ServerInstance->is_uline(u->server))
{
ServerInstance->WriteOpers("*** NOTICE -- Service "+Aliases[i].requires+" required by alias "+std::string(Aliases[i].text.c_str())+" is not on a u-lined server, possibly underhanded antics detected!");
user->WriteServ("401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible.");
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index cf46b2af9..cf2be71d1 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -92,7 +92,7 @@ class cmd_cban : public command_t
// parameters[0] = #channel
// parameters[1] = 1h3m2s
// parameters[2] = Tortoise abuser
- long length = duration(parameters[1]);
+ long length = ServerInstance->duration(parameters[1]);
std::string reason = (pcnt > 2) ? parameters[2] : "No reason supplied";
cbans.push_back(CBan(parameters[0], user->nick, ServerInstance->Time(), length, reason));
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 6310e6607..68a4afb9f 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -85,7 +85,7 @@ class ChanFounder : public ModeHandler
std::string founder = "cm_founder_"+std::string(channel->name);
// source is a server, or ulined, we'll let them +-q the user.
- if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server) || (!IS_LOCAL(source)))
+ if ((ServerInstance->is_uline(source->nick)) || (ServerInstance->is_uline(source->server)) || (!*source->server) || (!IS_LOCAL(source)))
{
ServerInstance->Log(DEBUG,"Allowing remote mode change in ChanFounder");
if (adding)
@@ -194,7 +194,7 @@ class ChanProtect : public ModeHandler
std::string founder = "cm_founder_"+std::string(channel->name);
// source has +q, is a server, or ulined, we'll let them +-a the user.
- if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server) || (source->GetExt(founder,dummyptr)) || (!IS_LOCAL(source)))
+ if ((ServerInstance->is_uline(source->nick)) || (ServerInstance->is_uline(source->server)) || (!*source->server) || (source->GetExt(founder,dummyptr)) || (!IS_LOCAL(source)))
{
if (adding)
{
@@ -343,7 +343,7 @@ class ModuleChanProtect : public Module
// firstly, if a ulined nick, or a server, is setting the mode, then allow them to set the mode
// without any access checks, we're not worthy :p
- if ((ServerInstance->IsUlined(source->nick)) || (ServerInstance->IsUlined(source->server)) || (!strcmp(source->server,"")))
+ if ((ServerInstance->is_uline(source->nick)) || (ServerInstance->is_uline(source->server)) || (!*source->server))
{
return ACR_ALLOW;
}
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index 378c05ece..ac16f137e 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -60,7 +60,7 @@ class cmd_chghost : public command_t
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
{
- if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->IsUlined(user->server)))
+ if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->is_uline(user->server)))
{
// fix by brain - ulines set hosts silently
ServerInstance->WriteOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+parameters[1]);
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 654d40be8..656e5d0a8 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -86,7 +86,7 @@ class ModuleNoKicks : public Module
{
if (channel->IsModeSet('Q'))
{
- if ((ServerInstance->IsUlined(source->nick)) || (ServerInstance->IsUlined(source->server)) || (!strcmp(source->server,"")))
+ if ((ServerInstance->is_uline(source->nick)) || (ServerInstance->is_uline(source->server)) || (!*source->server))
{
// ulines can still kick with +Q in place
return ACR_ALLOW;
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 1dcd34826..6f37640c2 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -81,7 +81,7 @@ class ModuleNoNotice : public Module
chanrec* c = (chanrec*)dest;
if (c->IsModeSet('T'))
{
- if ((ServerInstance->IsUlined(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
+ if ((ServerInstance->is_uline(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
{
// ops and halfops can still /NOTICE the channel
return 0;
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 492cd5bd0..18bddd015 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -109,7 +109,7 @@ class RemoveBase
protectkey = "cm_protect_" + std::string(channel->name);
founderkey = "cm_founder_" + std::string(channel->name);
- if (is_uline(user->server) || is_uline(user->nick))
+ if (ServerInstance->is_uline(user->server) || ServerInstance->is_uline(user->nick))
{
ServerInstance->Log(DEBUG, "Setting ulevel to U");
ulevel = chartolevel("U");
@@ -131,7 +131,7 @@ class RemoveBase
}
/* Now it's the same idea, except for the target. If they're ulined make sure they get a higher level than the sender can */
- if (is_uline(target->server) || is_uline(target->nick))
+ if (ServerInstance->is_uline(target->server) || ServerInstance->is_uline(target->nick))
{
ServerInstance->Log(DEBUG, "Setting tlevel to U");
tlevel = chartolevel("U");
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index c1112cab8..0d998abd9 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -43,7 +43,7 @@ class cmd_sajoin : public command_t
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
{
- if (ServerInstance->IsUlined(dest->server))
+ if (ServerInstance->is_uline(dest->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 0d9167c26..5758bac64 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -42,7 +42,7 @@ class cmd_sanick : public command_t
userrec* source = ServerInstance->FindNick(parameters[0]);
if (source)
{
- if (ServerInstance->IsUlined(source->server))
+ if (ServerInstance->is_uline(source->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 43ab4b578..9d20ed638 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -44,7 +44,7 @@ class cmd_sapart : public command_t
chanrec* channel = ServerInstance->FindChan(parameters[1]);
if (dest && channel)
{
- if (ServerInstance->IsUlined(dest->server))
+ if (ServerInstance->is_uline(dest->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 395776230..0a6155b27 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -52,7 +52,7 @@ class cmd_saquit : public command_t
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
{
- if (ServerInstance->IsUlined(dest->server))
+ if (ServerInstance->is_uline(dest->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index 4500ecbfc..40e160a6c 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -41,7 +41,7 @@ class Channel_r : public ModeHandler
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
// only a u-lined server may add or remove the +r mode.
- if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.'))))
+ if ((ServerInstance->is_uline(source->nick)) || (ServerInstance->is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.'))))
{
ServerInstance->Log(DEBUG,"Allowing cmode +r, server and nick are: '%s','%s'",source->nick,source->server);
channel->SetMode('r',adding);
@@ -64,7 +64,7 @@ class User_r : public ModeHandler
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
- if ((kludgeme) || (is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.'))))
+ if ((kludgeme) || (ServerInstance->is_uline(source->nick)) || (ServerInstance->is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.'))))
{
ServerInstance->Log(DEBUG,"Allowing umode +r, server and nick are: '%s','%s'",source->nick,source->server);
dest->SetMode('r',adding);
@@ -230,7 +230,7 @@ class ModuleServices : public Module
chanrec* c = (chanrec*)dest;
if ((c->IsModeSet('M')) && (!user->IsModeSet('r')))
{
- if ((is_uline(user->nick)) || (is_uline(user->server)) || (!strcmp(user->server,"")))
+ if ((ServerInstance->is_uline(user->nick)) || (ServerInstance->is_uline(user->server)) || (!strcmp(user->server,"")))
{
// user is ulined, can speak regardless
return 0;
@@ -245,7 +245,7 @@ class ModuleServices : public Module
userrec* u = (userrec*)dest;
if ((u->IsModeSet('R')) && (user->IsModeSet('r')))
{
- if ((is_uline(user->nick)) || (is_uline(user->server)))
+ if ((ServerInstance->is_uline(user->nick)) || (ServerInstance->is_uline(user->server)))
{
// user is ulined, can speak regardless
return 0;
@@ -271,7 +271,7 @@ class ModuleServices : public Module
{
if (user->IsModeSet('r'))
{
- if ((is_uline(user->nick)) || (is_uline(user->server)))
+ if ((ServerInstance->is_uline(user->nick)) || (ServerInstance->is_uline(user->server)))
{
// user is ulined, won't be stopped from joining
return 0;
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index efcf7629a..0d7ff4339 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -165,7 +165,7 @@ class ModuleServicesAccount : public Module
if ((c->IsModeSet('M')) && (!account))
{
- if ((ServerInstance->IsUlined(user->nick)) || (ServerInstance->IsUlined(user->server)) || (!strcmp(user->server,"")))
+ if ((ServerInstance->is_uline(user->nick)) || (ServerInstance->is_uline(user->server)) || (!strcmp(user->server,"")))
{
// user is ulined, can speak regardless
return 0;
@@ -182,7 +182,7 @@ class ModuleServicesAccount : public Module
if ((u->modes['R'-65]) && (!account))
{
- if ((ServerInstance->IsUlined(user->nick)) || (ServerInstance->IsUlined(user->server)))
+ if ((ServerInstance->is_uline(user->nick)) || (ServerInstance->is_uline(user->server)))
{
// user is ulined, can speak regardless
return 0;
@@ -212,7 +212,7 @@ class ModuleServicesAccount : public Module
{
if (!account)
{
- if ((ServerInstance->IsUlined(user->nick)) || (ServerInstance->IsUlined(user->server)))
+ if ((ServerInstance->is_uline(user->nick)) || (ServerInstance->is_uline(user->server)))
{
// user is ulined, won't be stopped from joining
return 0;
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index c94f43ed0..b9e15143d 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1159,7 +1159,7 @@ class TreeSocket : public InspSocket
}
else
/* U-lined servers always win regardless of their TS */
- if ((TS > ourTS) && (!this->Instance->IsUlined(source)))
+ if ((TS > ourTS) && (!this->Instance->is_uline(source.c_str())))
{
/* Bounce the mode back to its sender.* We use our lower TS, so the other end
* SHOULD accept it, if its clock is right.
@@ -1272,7 +1272,7 @@ class TreeSocket : public InspSocket
/* The server was ulined, but something iffy is up with the TS.
* Sound the alarm bells!
*/
- if ((this->Instance->IsUlined(sourceserv)) && (TS > ourTS))
+ if ((this->Instance->is_uline(sourceserv.c_str())) && (TS > ourTS))
{
this->Instance->WriteOpers("\2WARNING!\2 U-Lined server '%s' has bad TS for '%s' (accepted change): \2SYNC YOUR CLOCKS\2 to avoid this notice",sourceserv.c_str(),params[0].c_str());
}
@@ -1416,7 +1416,7 @@ class TreeSocket : public InspSocket
/* theres a mode for this user. push them onto the mode queue, and flush it
* if there are more than MAXMODES to go.
*/
- if ((ourTS >= TS) || (this->Instance->IsUlined(who->server)))
+ if ((ourTS >= TS) || (this->Instance->is_uline(who->server)))
{
/* We also always let u-lined clients win, no matter what the TS value */
ServerInstance->Log(DEBUG,"Our our channel newer than theirs, accepting their modes");
@@ -3427,7 +3427,7 @@ class ModuleSpanningTree : public Module
}
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
- if ((HideULines) && (ServerInstance->IsUlined(Current->GetChild(q)->GetName())))
+ if ((HideULines) && (ServerInstance->is_uline(Current->GetChild(q)->GetName().c_str())))
{
if (*user->oper)
{
@@ -3440,7 +3440,7 @@ class ModuleSpanningTree : public Module
}
}
/* Don't display the line if its a uline, hide ulines is on, and the user isnt an oper */
- if ((HideULines) && (ServerInstance->IsUlined(Current->GetName())) && (!*user->oper))
+ if ((HideULines) && (ServerInstance->is_uline(Current->GetName().c_str())) && (!*user->oper))
return;
user->WriteServ("364 %s %s %s :%d %s",user->nick,Current->GetName().c_str(),(FlatLinks && (!*user->oper)) ? ServerInstance->Config->ServerName : Parent.c_str(),(FlatLinks && (!*user->oper)) ? 0 : hops,Current->GetDesc().c_str());
}
@@ -3526,7 +3526,7 @@ class ModuleSpanningTree : public Module
line++;
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
- if ((HideULines) && (ServerInstance->IsUlined(Current->GetChild(q)->GetName())))
+ if ((HideULines) && (ServerInstance->is_uline(Current->GetChild(q)->GetName().c_str())))
{
if (*user->oper)
{
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 741031561..f06a41194 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -55,14 +55,14 @@ class cmd_swhois : public command_t
{
// We already had it set...
- if (!ServerInstance->IsUlined(user->server))
+ if (!ServerInstance->is_uline(user->server))
// Ulines set SWHOISes silently
ServerInstance->WriteOpers("*** %s used SWHOIS to set %s's extra whois from '%s' to '%s'", user->nick, dest->nick, text->c_str(), line.c_str());
dest->Shrink("swhois");
DELETE(text);
}
- else if(!ServerInstance->IsUlined(user->server))
+ else if(!ServerInstance->is_uline(user->server))
{
// Ulines set SWHOISes silently
ServerInstance->WriteOpers("*** %s used SWHOIS to set %s's extra whois to '%s'", user->nick, dest->nick, line.c_str());
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index a063ce12d..dc5f8f977 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -74,14 +74,14 @@ class cmd_tban : public command_t
}
TimedBan T;
std::string channelname = parameters[0];
- unsigned long expire = ServerInstance->CalcDuration(parameters[1]) + time(NULL);
- if (ServerInstance->CalcDuration(parameters[1]) < 1)
+ unsigned long expire = ServerInstance->duration(parameters[1]) + time(NULL);
+ if (ServerInstance->duration(parameters[1]) < 1)
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time");
return;
}
char duration[MAXBUF];
- snprintf(duration,MAXBUF,"%lu",ServerInstance->CalcDuration(parameters[1]));
+ snprintf(duration,MAXBUF,"%lu",ServerInstance->duration(parameters[1]));
std::string mask = parameters[2];
const char *setban[32];
setban[0] = parameters[0];