diff options
-rw-r--r-- | include/modules.h | 4 | ||||
-rw-r--r-- | src/modules.cpp | 5 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_cban.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_joinflood.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_knock.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_nonicks.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_override.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_remove.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_safelist.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 104 | ||||
-rw-r--r-- | src/modules/m_timedbans.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_uninvite.cpp | 3 |
14 files changed, 83 insertions, 76 deletions
diff --git a/include/modules.h b/include/modules.h index f3d7ab18e..78994e746 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1325,10 +1325,6 @@ class Server : public Extensible */ userrec* FindDescriptor(int socket); - /** Returns the server name of the server where the module is loaded. - */ - std::string GetServerName(); - bool AddMode(ModeHandler* mh, const unsigned char modechar); bool AddModeWatcher(ModeWatcher* mw); diff --git a/src/modules.cpp b/src/modules.cpp index a367f7b8d..e8590bcc4 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -415,11 +415,6 @@ userrec* Server::FindDescriptor(int socket) return (socket < 65536 ? ServerInstance->fd_ref_table[socket] : NULL); } -std::string Server::GetServerName() -{ - return ServerInstance->Config->ServerName; -} - bool Server::AddMode(ModeHandler* mh, const unsigned char mode) { return ServerInstance->ModeGrok->AddMode(mh,mode); diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 46e3bb308..5fcc30cc4 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -31,6 +31,7 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" +#include "configreader.h" #include "inspircd.h" #include "m_sqlv2.h" @@ -40,6 +41,8 @@ static Module* MyMod; static std::string dbid; extern time_t TIME; +extern InspIRCd* ServerInstance; + enum LogTypes { LT_OPER = 1, LT_KILL, LT_SERVLINK, LT_XLINE, LT_CONNECT, LT_DISCONNECT, LT_FLOOD, LT_LOADMODULE }; enum QueryState { FIND_SOURCE, INSERT_SOURCE, FIND_NICK, INSERT_NICK, FIND_HOST, INSERT_HOST, INSERT_LOGENTRY, DONE }; @@ -394,7 +397,7 @@ class ModuleSQLLog : public Module virtual void OnLoadModule(Module* mod, const std::string &name) { - AddLogEntry(LT_LOADMODULE,name,Srv->GetServerName(),Srv->GetServerName()); + AddLogEntry(LT_LOADMODULE,name,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName); } virtual ~ModuleSQLLog() diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index e4fa5d91b..480d0b9e5 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -24,6 +24,7 @@ #include "modules.h" #include "helperfuncs.h" #include "hashcomp.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */ @@ -154,7 +155,7 @@ class ModuleCBan : public Module for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++) { unsigned long remaining = (iter->set_on + iter->length) - TIME; - results.push_back(Srv->GetServerName()+" 210 "+user->nick+" "+iter->chname.c_str()+" "+iter->set_by+" "+ConvToStr(iter->set_on)+" "+ConvToStr(iter->length)+" "+ConvToStr(remaining)+" :"+iter->reason); + results.push_back(std::string(ServerInstance->Config->ServerName)+" 210 "+user->nick+" "+iter->chname.c_str()+" "+iter->set_by+" "+ConvToStr(iter->set_on)+" "+ConvToStr(iter->length)+" "+ConvToStr(remaining)+" :"+iter->reason); } } diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 8b2ce75f5..e68a3756f 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -106,9 +106,9 @@ class ModuleHttpStats : public Module data << "<head>"; data << "<link rel='stylesheet' href='" << this->stylesheet << "' type='text/css' />"; - data << "<title>InspIRCd server statisitics for " << Srv->GetServerName() << " (" << ServerInstance->Config->ServerDesc << ")</title>"; + data << "<title>InspIRCd server statisitics for " << ServerInstance->Config->ServerName << " (" << ServerInstance->Config->ServerDesc << ")</title>"; data << "</head><body>"; - data << "<h1>InspIRCd server statisitics for " << Srv->GetServerName() << " (" << ServerInstance->Config->ServerDesc << ")</h1>"; + data << "<h1>InspIRCd server statisitics for " << ServerInstance->Config->ServerName << " (" << ServerInstance->Config->ServerDesc << ")</h1>"; data << "<div class='totals'>"; data << "<h2>Totals</h2>"; diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 3f3c44d98..c93286861 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -22,10 +22,13 @@ using namespace std; #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Provides channel mode +j (join flood protection) */ +extern InspIRCd* ServerInstance; + class joinfloodsettings : public classbase { public: @@ -225,7 +228,7 @@ class ModuleJoinFlood : public Module { f->clear(); f->lock(); - channel->WriteChannelWithServ((char*)Srv->GetServerName().c_str(), "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", channel->name, f->joins, f->secs); + channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", channel->name, f->joins, f->secs); } } } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index e681f02d6..9e505b14d 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -22,6 +22,7 @@ using namespace std; #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Provides support for /KNOCK and mode +K */ @@ -64,7 +65,7 @@ class cmd_knock : public command_t if (c->modes[CM_INVITEONLY]) { - c->WriteChannelWithServ((char*)Srv->GetServerName().c_str(), "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str()); + c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str()); user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name); return; } diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 2cf62dd61..9d1ddb0ff 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -23,10 +23,13 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" #include "hashcomp.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */ +extern InspIRCd* ServerInstance; + class NoNicks : public ModeHandler { public: @@ -92,7 +95,7 @@ class ModuleNoNickChange : public Module virtual int OnUserPreNick(userrec* user, const std::string &newnick) { irc::string server = user->server; - irc::string me = Srv->GetServerName().c_str(); + irc::string me = ServerInstance->Config->ServerName; if (server == me) { for (std::vector<ucrec*>::iterator i = user->chans.begin(); i != user->chans.end(); i++) diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index a3bb407ed..a81dfd87e 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -18,6 +18,7 @@ #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Provides support for unreal-style oper-override */ @@ -212,7 +213,7 @@ class ModuleOverride : public Module if (!user->IsInvited(x)) { /* XXX - Ugly cast for a parameter that isn't used? :< - Om */ - chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s invited himself into the channel", cname, user->nick); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s invited himself into the channel", cname, user->nick); } } ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname)); @@ -222,7 +223,7 @@ class ModuleOverride : public Module if ((chan->key[0]) && (CanOverride(user,"KEY"))) { if (NoisyOverride) - chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s bypassed the channel key", cname, user->nick); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s bypassed the channel key", cname, user->nick); ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +k on "+std::string(cname)); return -1; } @@ -230,7 +231,7 @@ class ModuleOverride : public Module if ((chan->limit > 0) && (chan->GetUserCounter() >= chan->limit) && (CanOverride(user,"LIMIT"))) { if (NoisyOverride) - chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s passed through your channel limit", cname, user->nick); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s passed through your channel limit", cname, user->nick); ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +l on "+std::string(cname)); return -1; } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 354fe7a8d..e681d39b6 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -7,6 +7,7 @@ #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel */ @@ -185,7 +186,7 @@ class RemoveBase /* Build up the part reason string. */ reason << "Removed by " << user->nick << reasonparam; - channel->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s removed %s from the channel", channel->name, user->nick, target->nick); + channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name, user->nick, target->nick); target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick, user->nick, channel->name, reasonparam.c_str()); if (!channel->PartUser(target, reason.str().c_str())) diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 2aa5a02f6..091d59d1a 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -22,6 +22,7 @@ using namespace std; #include "helperfuncs.h" #include "message.h" #include <vector> +#include "configreader.h" #include "inspircd.h" extern time_t TIME; @@ -109,7 +110,7 @@ class ListTimer : public InspTimer { int counter = snprintf(buffer,MAXBUF,"322 %s %s %ld :[+%s] %s",u->nick,chan->name,users,chan->ChanModes(has_user),chan->topic); /* Increment total plus linefeed */ - amount_sent += counter + 4 + Srv->GetServerName().length(); + amount_sent += counter + 4 + strlen(ServerInstance->Config->ServerName); log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax); u->WriteServ(std::string(buffer)); } diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index bc8e94b1d..e4fbd4b33 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -614,7 +614,7 @@ class cmd_rconnect : public command_t { user->WriteServ("NOTICE %s :*** RCONNECT: Sending remote connect to \002%s\002 to connect server \002%s\002.",user->nick,parameters[0],parameters[1]); /* Is this aimed at our server? */ - if (Srv->MatchText(Srv->GetServerName(),parameters[0])) + if (Srv->MatchText(ServerInstance->Config->ServerName,parameters[0])) { /* Yes, initiate the given connect */ ServerInstance->WriteOpers("*** Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002",user->nick,parameters[0],parameters[1]); @@ -751,12 +751,12 @@ class TreeSocket : public InspSocket } else { - this->WriteLine("AES "+Srv->GetServerName()); + this->WriteLine(std::string("AES ")+ServerInstance->Config->ServerName); this->InitAES(x->EncryptionKey,x->Name.c_str()); } } /* found who we're supposed to be connecting to, send the neccessary gubbins. */ - this->WriteLine("SERVER "+Srv->GetServerName()+" "+x->SendPass+" 0 :"+ServerInstance->Config->ServerDesc); + this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+x->SendPass+" 0 :"+ServerInstance->Config->ServerDesc); return true; } } @@ -1140,7 +1140,7 @@ class TreeSocket : public InspSocket newparams.push_back(params[0]); newparams.push_back(ConvToStr(ourTS)); newparams.push_back(to_bounce+params_to_bounce); - DoOneToOne(Srv->GetServerName(),"FMODE",newparams,sourceserv); + DoOneToOne(ServerInstance->Config->ServerName,"FMODE",newparams,sourceserv); } if (to_keep.length()) @@ -1280,7 +1280,7 @@ class TreeSocket : public InspSocket /* Update the parameters for FMODE with the new 'bounced' string */ newparams[2] = modebounce; /* Only send it back the way it came, no need to send it anywhere else */ - DoOneToOne(Srv->GetServerName(),"FMODE",newparams,sourceserv); + DoOneToOne(ServerInstance->Config->ServerName,"FMODE",newparams,sourceserv); log(DEBUG,"FMODE bounced intelligently, our TS less than theirs and the other server is NOT a uline."); } else @@ -1462,7 +1462,7 @@ class TreeSocket : public InspSocket } // tell everyone to bounce the modes. bad modes, bad! - DoOneToMany(Srv->GetServerName(),"FMODE",params); + DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params); } strcpy(mode_users[1],"+"); modectr = 2; @@ -1499,7 +1499,7 @@ class TreeSocket : public InspSocket } params.push_back(mode_users[x]); } - DoOneToMany(Srv->GetServerName(),"FMODE",params); + DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params); } } return true; @@ -1521,7 +1521,7 @@ class TreeSocket : public InspSocket } } } - DoOneToAllButSender(Srv->GetServerName(),"SYNCTS",params,source); + DoOneToAllButSender(ServerInstance->Config->ServerName,"SYNCTS",params,source); return true; } @@ -1532,7 +1532,7 @@ class TreeSocket : public InspSocket return true; if (params.size() > 8) { - this->WriteLine(":"+Srv->GetServerName()+" KILL "+params[1]+" :Invalid client introduction ("+params[1]+"?)"); + this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" KILL "+params[1]+" :Invalid client introduction ("+params[1]+"?)"); return true; } // NICK age nick host dhost ident +modes ip :gecos @@ -1553,7 +1553,7 @@ class TreeSocket : public InspSocket { // nick collision log(DEBUG,"Nick collision on %s!%s@%s: %lu %lu",tempnick,params[4].c_str(),params[2].c_str(),(unsigned long)age,(unsigned long)iter->second->age); - this->WriteLine(":"+Srv->GetServerName()+" KILL "+tempnick+" :Nickname collision"); + this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" KILL "+tempnick+" :Nickname collision"); return true; } @@ -1601,10 +1601,10 @@ class TreeSocket : public InspSocket { log(DEBUG,"Sending FJOINs to other server for %s",c->name); char list[MAXBUF]; - std::string individual_halfops = ":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age); + std::string individual_halfops = std::string(":")+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age); size_t dlen, curlen; - dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age); + dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",ServerInstance->Config->ServerName,c->name,(unsigned long)c->age); int numusers = 0; char* ptr = list + dlen; @@ -1650,7 +1650,7 @@ class TreeSocket : public InspSocket if (curlen > (480-NICKMAX)) { this->WriteLine(list); - dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age); + dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",ServerInstance->Config->ServerName,c->name,(unsigned long)c->age); ptr = list + dlen; ptrlen = 0; numusers = 0; @@ -1658,13 +1658,13 @@ class TreeSocket : public InspSocket { modes.append("v"); params.append(specific_voice[y]->nick).append(" "); - //this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age)+" +v "+specific_voice[y]->nick); + //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +v "+specific_voice[y]->nick); } for (unsigned int y = 0; y < specific_halfop.size(); y++) { modes.append("h"); params.append(specific_halfop[y]->nick).append(" "); - //this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age)+" +h "+specific_halfop[y]->nick); + //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +h "+specific_halfop[y]->nick); } } } @@ -1675,13 +1675,13 @@ class TreeSocket : public InspSocket { modes.append("v"); params.append(specific_voice[y]->nick).append(" "); - //this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age)+" +v "+specific_voice[y]->nick); + //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +v "+specific_voice[y]->nick); } for (unsigned int y = 0; y < specific_halfop.size(); y++) { modes.append("h"); params.append(specific_halfop[y]->nick).append(" "); - //this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age)+" +h "+specific_halfop[y]->nick); + //this->WriteLine(":"+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +h "+specific_halfop[y]->nick); } } //std::string modes = ""; @@ -1693,14 +1693,14 @@ class TreeSocket : public InspSocket } /* XXX: Send each channel mode and its params -- we'll need a method for this in ModeHandler? */ //FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(c->second,(Module*)TreeProtocolModule,(void*)this)); - this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age)+" +"+c->ChanModes(true)+modes+" "+params); + this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" +"+c->ChanModes(true)+modes+" "+params); } /* Send G, Q, Z and E lines */ void SendXLines(TreeServer* Current) { char data[MAXBUF]; - std::string n = Srv->GetServerName(); + std::string n = ServerInstance->Config->ServerName; const char* sn = n.c_str(); int iterations = 0; /* Yes, these arent too nice looking, but they get the job done */ @@ -1752,7 +1752,7 @@ class TreeSocket : public InspSocket char data[MAXBUF]; std::deque<std::string> list; int iterations = 0; - std::string n = Srv->GetServerName(); + std::string n = ServerInstance->Config->ServerName; const char* sn = n.c_str(); for (chan_hash::iterator c = this->Instance->chanlist.begin(); c != this->Instance->chanlist.end(); c++, iterations++) { @@ -1817,7 +1817,7 @@ class TreeSocket : public InspSocket ServerInstance->WriteOpers("*** Bursting to \2"+name+"\2."); this->WriteLine(burst); /* send our version string */ - this->WriteLine(":"+Srv->GetServerName()+" VERSION :"+this->Instance->GetVersionString()); + this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" VERSION :"+this->Instance->GetVersionString()); /* Send server tree */ this->SendServers(TreeRoot,s,1); /* Send users and their oper status */ @@ -1935,7 +1935,7 @@ class TreeSocket : public InspSocket */ if (params.size() > 1) { - if (Srv->MatchText(Srv->GetServerName(), params[1])) + if (Srv->MatchText(ServerInstance->Config->ServerName, params[1])) { /* It's for our server */ string_list results; @@ -1949,7 +1949,7 @@ class TreeSocket : public InspSocket for (size_t i = 0; i < results.size(); i++) { par[1] = "::" + results[i]; - DoOneToOne(Srv->GetServerName(), "PUSH",par, source->server); + DoOneToOne(ServerInstance->Config->ServerName, "PUSH",par, source->server); } } } @@ -2039,7 +2039,7 @@ class TreeSocket : public InspSocket std::string servermask = params[0]; - if (Srv->MatchText(Srv->GetServerName(),servermask)) + if (Srv->MatchText(ServerInstance->Config->ServerName,servermask)) { ServerInstance->WriteOpers("*** Remote rehash initiated from server \002"+prefix+"\002."); Srv->RehashServer(); @@ -2095,7 +2095,7 @@ class TreeSocket : public InspSocket else { std::string forwardto = params[1]; - if (forwardto == Srv->GetServerName()) + if (forwardto == ServerInstance->Config->ServerName) { /* * this is a PONG for us @@ -2351,7 +2351,7 @@ class TreeSocket : public InspSocket if (params.size() == 2) { // someone querying our time? - if (Srv->GetServerName() == params[0]) + if (ServerInstance->Config->ServerName == params[0]) { userrec* u = ServerInstance->FindNick(params[1]); if (u) @@ -2360,7 +2360,7 @@ class TreeSocket : public InspSocket snprintf(curtime,256,"%lu",(unsigned long)time(NULL)); params.push_back(curtime); params[0] = prefix; - DoOneToOne(Srv->GetServerName(),"TIME",params,params[0]); + DoOneToOne(ServerInstance->Config->ServerName,"TIME",params,params[0]); } } else @@ -2402,13 +2402,13 @@ class TreeSocket : public InspSocket if (params.size() == 1) { std::string stufftobounce = params[0]; - this->WriteLine(":"+Srv->GetServerName()+" PONG "+stufftobounce); + this->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PONG "+stufftobounce); return true; } else { std::string forwardto = params[1]; - if (forwardto == Srv->GetServerName()) + if (forwardto == ServerInstance->Config->ServerName) { // this is a ping for us, send back PONG to the requesting server params[1] = params[0]; @@ -2548,7 +2548,7 @@ class TreeSocket : public InspSocket this->InboundDescription = description; // this is good. Send our details: Our server name and description and hopcount of 0, // along with the sendpass from this block. - this->WriteLine("SERVER "+Srv->GetServerName()+" "+x->SendPass+" 0 :"+ServerInstance->Config->ServerDesc); + this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+x->SendPass+" 0 :"+ServerInstance->Config->ServerDesc); // move to the next state, we are now waiting for THEM. this->LinkState = WAIT_AUTH_2; return true; @@ -2956,11 +2956,11 @@ class TreeSocket : public InspSocket std::deque<std::string> p; p.push_back(params[0]); p.push_back("Nickname collision ("+prefix+" -> "+params[0]+")"); - DoOneToMany(Srv->GetServerName(),"KILL",p); + DoOneToMany(ServerInstance->Config->ServerName,"KILL",p); p.clear(); p.push_back(prefix); p.push_back("Nickname collision"); - DoOneToMany(Srv->GetServerName(),"KILL",p); + DoOneToMany(ServerInstance->Config->ServerName,"KILL",p); userrec::QuitUser(this->Instance,x,"Nickname collision ("+prefix+" -> "+params[0]+")"); userrec* y = ServerInstance->FindNick(prefix); if (y) @@ -2988,7 +2988,7 @@ class TreeSocket : public InspSocket // its not a user. Its either a server, or somethings screwed up. if (IsServer(prefix)) { - target = Srv->GetServerName(); + target = ServerInstance->Config->ServerName; } else { @@ -3464,7 +3464,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) && (Srv->IsUlined(Current->GetName())) && (!*user->oper)) return; - user->WriteServ("364 %s %s %s :%d %s",user->nick,Current->GetName().c_str(),(FlatLinks && (!*user->oper)) ? Srv->GetServerName().c_str() : Parent.c_str(),(FlatLinks && (!*user->oper)) ? 0 : hops,Current->GetDesc().c_str()); + 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()); } int CountLocalServs() @@ -3696,7 +3696,7 @@ class ModuleSpanningTree : public Module std::deque<std::string> params; params.push_back(found->GetName()); params.push_back(user->nick); - DoOneToOne(Srv->GetServerName(),"TIME",params,found->GetName()); + DoOneToOne(ServerInstance->Config->ServerName,"TIME",params,found->GetName()); } else { @@ -3740,7 +3740,7 @@ class ModuleSpanningTree : public Module { if (serv->AnsweredLastPing()) { - sock->WriteLine(":"+Srv->GetServerName()+" PING "+serv->GetName()); + sock->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PING "+serv->GetName()); serv->SetNextPingTime(curtime + 120); } else @@ -3898,10 +3898,10 @@ class ModuleSpanningTree : public Module { for (unsigned int i = 0; i < LinkBlocks.size(); i++) { - results.push_back(Srv->GetServerName()+" 213 "+user->nick+" C *@"+(LinkBlocks[i].HiddenFromStats ? "<hidden>" : LinkBlocks[i].IPAddr)+" * "+LinkBlocks[i].Name.c_str()+" "+ConvToStr(LinkBlocks[i].Port)+" "+(LinkBlocks[i].EncryptionKey != "" ? 'e' : '-')+(LinkBlocks[i].AutoConnect ? 'a' : '-')+'s'); - results.push_back(Srv->GetServerName()+" 244 "+user->nick+" H * * "+LinkBlocks[i].Name.c_str()); + results.push_back(std::string(ServerInstance->Config->ServerName)+" 213 "+user->nick+" C *@"+(LinkBlocks[i].HiddenFromStats ? "<hidden>" : LinkBlocks[i].IPAddr)+" * "+LinkBlocks[i].Name.c_str()+" "+ConvToStr(LinkBlocks[i].Port)+" "+(LinkBlocks[i].EncryptionKey != "" ? 'e' : '-')+(LinkBlocks[i].AutoConnect ? 'a' : '-')+'s'); + results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+LinkBlocks[i].Name.c_str()); } - results.push_back(Srv->GetServerName()+" 219 "+user->nick+" "+statschar+" :End of /STATS report"); + results.push_back(std::string(ServerInstance->Config->ServerName)+" 219 "+user->nick+" "+statschar+" :End of /STATS report"); ServerInstance->WriteOpers("*** Notice: %s '%c' requested by %s (%s@%s)",(!strcmp(user->server,ServerInstance->Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick,user->ident,user->host); return 1; } @@ -4146,7 +4146,7 @@ class ModuleSpanningTree : public Module params.push_back(channel->name); params.push_back(ts); params.push_back("@"+std::string(user->nick)); - DoOneToMany(Srv->GetServerName(),"FJOIN",params); + DoOneToMany(ServerInstance->Config->ServerName,"FJOIN",params); } } } @@ -4198,7 +4198,7 @@ class ModuleSpanningTree : public Module params.push_back("+"+std::string(user->FormatModes())); params.push_back(user->GetIPString()); params.push_back(":"+std::string(user->fullname)); - DoOneToMany(Srv->GetServerName(),"NICK",params); + DoOneToMany(ServerInstance->Config->ServerName,"NICK",params); // User is Local, change needs to be reflected! TreeServer* SourceServer = FindServer(user->server); @@ -4253,7 +4253,7 @@ class ModuleSpanningTree : public Module params.push_back(chan->name); params.push_back(user->nick); params.push_back(":"+reason); - DoOneToMany(Srv->GetServerName(),"KICK",params); + DoOneToMany(ServerInstance->Config->ServerName,"KICK",params); } } @@ -4271,11 +4271,11 @@ class ModuleSpanningTree : public Module { std::deque<std::string> params; params.push_back(parameter); - DoOneToMany(Srv->GetServerName(),"REHASH",params); + DoOneToMany(ServerInstance->Config->ServerName,"REHASH",params); // check for self - if (Srv->MatchText(Srv->GetServerName(),parameter)) + if (Srv->MatchText(ServerInstance->Config->ServerName,parameter)) { - ServerInstance->WriteOpers("*** Remote rehash initiated from server \002"+Srv->GetServerName()+"\002."); + ServerInstance->WriteOpers("*** Remote rehash initiated from server \002%s\002",ServerInstance->Config->ServerName); Srv->RehashServer(); } } @@ -4412,12 +4412,12 @@ class ModuleSpanningTree : public Module if (target_type == TYPE_USER) { userrec* u = (userrec*)target; - s->WriteLine(":"+Srv->GetServerName()+" FMODE "+u->nick+" "+ConvToStr(u->age)+" "+modeline); + s->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" FMODE "+u->nick+" "+ConvToStr(u->age)+" "+modeline); } else { chanrec* c = (chanrec*)target; - s->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" "+ConvToStr(c->age)+" "+modeline); + s->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age)+" "+modeline); } } } @@ -4430,16 +4430,16 @@ class ModuleSpanningTree : public Module if (target_type == TYPE_USER) { userrec* u = (userrec*)target; - s->WriteLine(":"+Srv->GetServerName()+" METADATA "+u->nick+" "+extname+" :"+extdata); + s->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" METADATA "+u->nick+" "+extname+" :"+extdata); } else if (target_type == TYPE_OTHER) { - s->WriteLine(":"+Srv->GetServerName()+" METADATA * "+extname+" :"+extdata); + s->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" METADATA * "+extname+" :"+extdata); } else if (target_type == TYPE_CHANNEL) { chanrec* c = (chanrec*)target; - s->WriteLine(":"+Srv->GetServerName()+" METADATA "+c->name+" "+extname+" :"+extdata); + s->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" METADATA "+c->name+" "+extname+" :"+extdata); } } } @@ -4452,7 +4452,7 @@ class ModuleSpanningTree : public Module if (params->size() < 3) return; (*params)[2] = ":" + (*params)[2]; - DoOneToMany(Srv->GetServerName(),"METADATA",*params); + DoOneToMany(ServerInstance->Config->ServerName,"METADATA",*params); } else if (event->GetEventID() == "send_mode") { @@ -4475,7 +4475,7 @@ class ModuleSpanningTree : public Module } } params->insert(params->begin() + 1,ConvToStr(ourTS)); - DoOneToMany(Srv->GetServerName(),"FMODE",*params); + DoOneToMany(ServerInstance->Config->ServerName,"FMODE",*params); } } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 076ae09d5..5db5753bd 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -25,6 +25,7 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" #include "hashcomp.h" +#include "configreader.h" #include "inspircd.h" static Server *Srv; @@ -100,7 +101,7 @@ class cmd_tban : public command_t T.mask = mask; T.expire = expire; TimedBanList.push_back(T); - channel->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s added a timed ban on %s lasting for %s seconds.", channel->name, user->nick, mask.c_str(), duration); + channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s added a timed ban on %s lasting for %s seconds.", channel->name, user->nick, mask.c_str(), duration); } return; } @@ -163,7 +164,7 @@ class ModuleTimedBans : public Module again = true; if (cr) { - cr->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :Timed ban on %s expired.", cr->name, i->mask.c_str()); + cr->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :Timed ban on %s expired.", cr->name, i->mask.c_str()); const char *setban[3]; setban[0] = i->channel.c_str(); setban[1] = "-b"; diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 70e73cfad..06f5b1924 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -24,6 +24,7 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" #include "message.h" +#include "configreader.h" #include "inspircd.h" static Server *Srv; @@ -82,7 +83,7 @@ class cmd_uninvite : public command_t u->RemoveInvite(xname); user->WriteServ("494 %s %s %s :Uninvited",user->nick,c->name,u->nick); u->WriteServ("493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick); - c->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick); + c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick); } }; |