diff options
Diffstat (limited to 'src/modules')
37 files changed, 288 insertions, 288 deletions
diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index d52744fe4..5e7662588 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -46,10 +46,10 @@ class QueryThread : public Thread { private: ModuleMsSQL* Parent; - InspIRCd* Instance; + InspIRCd* ServerInstance; public: QueryThread(InspIRCd* si, ModuleMsSQL* mod) - : Thread(), Parent(mod), Instance(si) + : Thread(), Parent(mod), ServerInstance(si) { } ~QueryThread() { } @@ -68,7 +68,7 @@ class ResultNotifier : public BufferedSocket virtual bool OnDataReady() { char data = 0; - if (Instance->SE->Recv(this, &data, 1, 0) > 0) + if (ServerInstance->SE->Recv(this, &data, 1, 0) > 0) { Dispatch(); return true; @@ -285,7 +285,7 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* Instance; + InspIRCd* ServerInstance; Module* mod; SQLhost host; TDSLOGIN* login; @@ -296,7 +296,7 @@ class SQLConn : public classbase QueryQueue queue; SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : Instance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL) + : ServerInstance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL) { if (OpenDB()) { @@ -306,7 +306,7 @@ class SQLConn : public classbase if (tds_process_simple_query(sock) != TDS_SUCCEED) { LoggingMutex->Lock(); - Instance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); + ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); LoggingMutex->Unlock(); CloseDB(); } @@ -314,7 +314,7 @@ class SQLConn : public classbase else { LoggingMutex->Lock(); - Instance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); + ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); LoggingMutex->Unlock(); CloseDB(); } @@ -322,7 +322,7 @@ class SQLConn : public classbase else { LoggingMutex->Lock(); - Instance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not connect to DB with id: " + host.id); + ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not connect to DB with id: " + host.id); LoggingMutex->Unlock(); CloseDB(); } @@ -414,7 +414,7 @@ class SQLConn : public classbase char* msquery = strdup(req.query.q.data()); LoggingMutex->Lock(); - Instance->Logs->Log("m_mssql",DEBUG,"doing Query: %s",msquery); + ServerInstance->Logs->Log("m_mssql",DEBUG,"doing Query: %s",msquery); LoggingMutex->Unlock(); if (tds_submit_query(sock, msquery) != TDS_SUCCEED) { @@ -430,8 +430,8 @@ class SQLConn : public classbase int tds_res; while (tds_process_tokens(sock, &tds_res, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCEED) { - //Instance->Logs->Log("m_mssql",DEBUG,"<******> result type: %d", tds_res); - //Instance->Logs->Log("m_mssql",DEBUG,"AFFECTED ROWS: %d", sock->rows_affected); + //ServerInstance->Logs->Log("m_mssql",DEBUG,"<******> result type: %d", tds_res); + //ServerInstance->Logs->Log("m_mssql",DEBUG,"AFFECTED ROWS: %d", sock->rows_affected); switch (tds_res) { case TDS_ROWFMT_RESULT: @@ -494,7 +494,7 @@ class SQLConn : public classbase { SQLConn* sc = (SQLConn*)pContext->parent; LoggingMutex->Lock(); - sc->Instance->Logs->Log("m_mssql", DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); + sc->ServerInstance->Logs->Log("m_mssql", DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); LoggingMutex->Unlock(); return 0; } @@ -503,7 +503,7 @@ class SQLConn : public classbase { SQLConn* sc = (SQLConn*)pContext->parent; LoggingMutex->Lock(); - sc->Instance->Logs->Log("m_mssql", DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); + sc->ServerInstance->Logs->Log("m_mssql", DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); LoggingMutex->Unlock(); return 0; } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index be8598e02..2b8c218e8 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -315,7 +315,7 @@ public: class SQLConn : public EventHandler { private: - InspIRCd* Instance; + InspIRCd* ServerInstance; SQLhost confhost; /* The <database> entry */ Module* us; /* Pointer to the SQL provider itself */ PGconn* sql; /* PgSQL database connection handle */ @@ -326,12 +326,12 @@ class SQLConn : public EventHandler public: SQLConn(InspIRCd* SI, Module* self, const SQLhost& hi) - : EventHandler(), Instance(SI), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) + : EventHandler(), ServerInstance(SI), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) { - idle = this->Instance->Time(); + idle = this->ServerInstance->Time(); if(!DoConnect()) { - Instance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database with id: " + ConvToStr(hi.id)); + ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database with id: " + ConvToStr(hi.id)); DelayReconnect(); } } @@ -381,9 +381,9 @@ class SQLConn : public EventHandler if(this->fd <= -1) return false; - if (!this->Instance->SE->AddFd(this)) + if (!this->ServerInstance->SE->AddFd(this)) { - Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); + ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); return false; } @@ -396,7 +396,7 @@ class SQLConn : public EventHandler switch(PQconnectPoll(sql)) { case PGRES_POLLING_WRITING: - Instance->SE->WantWrite(this); + ServerInstance->SE->WantWrite(this); status = CWRITE; return true; case PGRES_POLLING_READING: @@ -426,7 +426,7 @@ class SQLConn : public EventHandler /* We just read stuff from the server, that counts as it being alive * so update the idle-since time :p */ - idle = this->Instance->Time(); + idle = this->ServerInstance->Time(); if (PQisBusy(sql)) { @@ -509,7 +509,7 @@ class SQLConn : public EventHandler switch(PQresetPoll(sql)) { case PGRES_POLLING_WRITING: - Instance->SE->WantWrite(this); + ServerInstance->SE->WantWrite(this); status = CWRITE; return DoPoll(); case PGRES_POLLING_READING: @@ -621,7 +621,7 @@ class SQLConn : public EventHandler #endif if(error) { - Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do..."); + ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do..."); } /* Incremenet queryend to the end of the newly escaped parameter */ @@ -632,7 +632,7 @@ class SQLConn : public EventHandler } else { - Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Found a substitution location but no parameter to substitute :|"); + ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: Found a substitution location but no parameter to substitute :|"); break; } } @@ -690,15 +690,15 @@ class SQLConn : public EventHandler } void Close() { - if (!this->Instance->SE->DelFd(this)) + if (!this->ServerInstance->SE->DelFd(this)) { if (sql && PQstatus(sql) == CONNECTION_BAD) { - this->Instance->SE->DelFd(this, true); + this->ServerInstance->SE->DelFd(this, true); } else { - Instance->Logs->Log("m_pgsql",DEBUG, "BUG: PQsocket cant be removed from socket engine!"); + ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: PQsocket cant be removed from socket engine!"); } } diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 5adb9ee93..d76bc97fe 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -50,7 +50,7 @@ class ResultNotifier : public BufferedSocket virtual bool OnDataReady() { char data = 0; - if (Instance->SE->Recv(this, &data, 1, 0) > 0) + if (ServerInstance->SE->Recv(this, &data, 1, 0) > 0) { Dispatch(); return true; @@ -266,18 +266,18 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* Instance; + InspIRCd* ServerInstance; Module* mod; SQLhost host; sqlite3* conn; public: SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : Instance(SI), mod(m), host(hi) + : ServerInstance(SI), mod(m), host(hi) { if (OpenDB() != SQLITE_OK) { - Instance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + host.id); + ServerInstance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + host.id); CloseDB(); } } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index eaf671267..f85046fd7 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -172,7 +172,7 @@ class HttpServerSocket : public BufferedSocket this->Write(http_version + " "+ConvToStr(response)+" "+Response(response)+"\r\n"); - time_t local = this->Instance->Time(); + time_t local = this->ServerInstance->Time(); struct tm *timeinfo = gmtime(&local); char *date = asctime(timeinfo); date[strlen(date) - 1] = '\0'; @@ -215,7 +215,7 @@ class HttpServerSocket : public BufferedSocket if (reqbuffer.length() >= 8192) { - Instance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer"); + ServerInstance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer"); reqbuffer.clear(); return false; } @@ -321,11 +321,11 @@ class HttpServerSocket : public BufferedSocket claimed = false; HTTPRequest httpr(request_type,uri,&headers,this,this->GetIP(),postdata); Event acl((char*)&httpr, (Module*)HttpModule, "httpd_acl"); - acl.Send(this->Instance); + acl.Send(this->ServerInstance); if (!claimed) { Event e((char*)&httpr, (Module*)HttpModule, "httpd_url"); - e.Send(this->Instance); + e.Send(this->ServerInstance); if (!claimed) { SendHTTPError(404); diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index dde9f45d3..08f885797 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -24,14 +24,14 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par { if (params.size() < 6) { - this->Instance->SNO->WriteToSnoMask('x',"%s sent me a malformed ADDLINE of type %s.",prefix.c_str(),params[0].c_str()); + this->ServerInstance->SNO->WriteToSnoMask('x',"%s sent me a malformed ADDLINE of type %s.",prefix.c_str(),params[0].c_str()); return true; } - XLineFactory* xlf = Instance->XLines->GetFactory(params[0]); + XLineFactory* xlf = ServerInstance->XLines->GetFactory(params[0]); std::string setter = "<unknown>"; - User* usr = Instance->FindNick(prefix); + User* usr = ServerInstance->FindNick(prefix); if (usr) setter = usr->nick; else @@ -43,42 +43,42 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par if (!xlf) { - this->Instance->SNO->WriteToSnoMask('x',"%s sent me an unknown ADDLINE type (%s).",setter.c_str(),params[0].c_str()); + this->ServerInstance->SNO->WriteToSnoMask('x',"%s sent me an unknown ADDLINE type (%s).",setter.c_str(),params[0].c_str()); return true; } XLine* xl = NULL; try { - xl = xlf->Generate(Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str()); + xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str()); } catch (ModuleException &e) { - this->Instance->SNO->WriteToSnoMask('x',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason()); + this->ServerInstance->SNO->WriteToSnoMask('x',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason()); return true; } xl->SetCreateTime(atoi(params[3].c_str())); - if (Instance->XLines->AddLine(xl,NULL)) + if (ServerInstance->XLines->AddLine(xl,NULL)) { if (xl->duration) { - this->Instance->SNO->WriteToSnoMask('x',"%s added %s%s on %s to expire on %s (%s).",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", - params[1].c_str(),Instance->TimeString(xl->expiry).c_str(),params[5].c_str()); + this->ServerInstance->SNO->WriteToSnoMask('x',"%s added %s%s on %s to expire on %s (%s).",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", + params[1].c_str(),ServerInstance->TimeString(xl->expiry).c_str(),params[5].c_str()); } else { - this->Instance->SNO->WriteToSnoMask('x',"%s added permanent %s%s on %s (%s).",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", + this->ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent %s%s on %s (%s).",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", params[1].c_str(),params[5].c_str()); } params[5] = ":" + params[5]; - User* u = Instance->FindNick(prefix); + User* u = ServerInstance->FindNick(prefix); Utils->DoOneToAllButSender(prefix, "ADDLINE", params, u ? u->server : prefix); TreeServer *remoteserver = Utils->FindServer(u ? u->server : prefix); if (!remoteserver->bursting) { - Instance->XLines->ApplyLines(); + ServerInstance->XLines->ApplyLines(); } } else diff --git a/src/modules/m_spanningtree/admin.cpp b/src/modules/m_spanningtree/admin.cpp index a034d7f52..85b527180 100644 --- a/src/modules/m_spanningtree/admin.cpp +++ b/src/modules/m_spanningtree/admin.cpp @@ -25,30 +25,30 @@ bool TreeSocket::Admin(const std::string &prefix, std::deque<std::string> ¶m { if (params.size() > 0) { - if (InspIRCd::Match(this->Instance->Config->ServerName, params[0])) + if (InspIRCd::Match(this->ServerInstance->Config->ServerName, params[0])) { /* It's for our server */ string_list results; - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (source) { std::deque<std::string> par; par.push_back(prefix); par.push_back(""); - par[1] = std::string("::")+Instance->Config->ServerName+" 256 "+source->nick+" :Administrative info for "+Instance->Config->ServerName; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); - par[1] = std::string("::")+Instance->Config->ServerName+" 257 "+source->nick+" :Name - "+Instance->Config->AdminName; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); - par[1] = std::string("::")+Instance->Config->ServerName+" 258 "+source->nick+" :Nickname - "+Instance->Config->AdminNick; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); - par[1] = std::string("::")+Instance->Config->ServerName+" 258 "+source->nick+" :E-Mail - "+Instance->Config->AdminEmail; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 256 "+source->nick+" :Administrative info for "+ServerInstance->Config->ServerName; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 257 "+source->nick+" :Name - "+ServerInstance->Config->AdminName; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 258 "+source->nick+" :Nickname - "+ServerInstance->Config->AdminNick; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 258 "+source->nick+" :E-Mail - "+ServerInstance->Config->AdminEmail; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); } } else { /* Pass it on */ - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (source) Utils->DoOneToOne(prefix, "ADMIN", params, params[0]); } diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 8037907d0..8b02b9545 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -24,7 +24,7 @@ std::string TreeSocket::MyCapabilities() { - std::vector<std::string> modlist = this->Instance->Modules->GetAllModuleNames(VF_COMMON); + std::vector<std::string> modlist = this->ServerInstance->Modules->GetAllModuleNames(VF_COMMON); std::string capabilities; sort(modlist.begin(),modlist.end()); for (unsigned int i = 0; i < modlist.size(); i++) @@ -74,28 +74,28 @@ void TreeSocket::SendCapabilities() #endif std::string extra; /* Do we have sha256 available? If so, we send a challenge */ - if (Utils->ChallengeResponse && (Instance->Modules->Find("m_sha256.so"))) + if (Utils->ChallengeResponse && (ServerInstance->Modules->Find("m_sha256.so"))) { this->SetOurChallenge(RandString(20)); extra = " CHALLENGE=" + this->GetOurChallenge(); } this->WriteLine("CAPAB CAPABILITIES " /* Preprocessor does this one. */ - ":NICKMAX="+ConvToStr(Instance->Config->Limits.NickMax)+ - " HALFOP="+ConvToStr(Instance->Config->AllowHalfop)+ - " CHANMAX="+ConvToStr(Instance->Config->Limits.ChanMax)+ - " MAXMODES="+ConvToStr(Instance->Config->Limits.MaxModes)+ - " IDENTMAX="+ConvToStr(Instance->Config->Limits.IdentMax)+ - " MAXQUIT="+ConvToStr(Instance->Config->Limits.MaxQuit)+ - " MAXTOPIC="+ConvToStr(Instance->Config->Limits.MaxTopic)+ - " MAXKICK="+ConvToStr(Instance->Config->Limits.MaxKick)+ - " MAXGECOS="+ConvToStr(Instance->Config->Limits.MaxGecos)+ - " MAXAWAY="+ConvToStr(Instance->Config->Limits.MaxAway)+ + ":NICKMAX="+ConvToStr(ServerInstance->Config->Limits.NickMax)+ + " HALFOP="+ConvToStr(ServerInstance->Config->AllowHalfop)+ + " CHANMAX="+ConvToStr(ServerInstance->Config->Limits.ChanMax)+ + " MAXMODES="+ConvToStr(ServerInstance->Config->Limits.MaxModes)+ + " IDENTMAX="+ConvToStr(ServerInstance->Config->Limits.IdentMax)+ + " MAXQUIT="+ConvToStr(ServerInstance->Config->Limits.MaxQuit)+ + " MAXTOPIC="+ConvToStr(ServerInstance->Config->Limits.MaxTopic)+ + " MAXKICK="+ConvToStr(ServerInstance->Config->Limits.MaxKick)+ + " MAXGECOS="+ConvToStr(ServerInstance->Config->Limits.MaxGecos)+ + " MAXAWAY="+ConvToStr(ServerInstance->Config->Limits.MaxAway)+ " IP6NATIVE="+ConvToStr(ip6)+ " IP6SUPPORT="+ConvToStr(ip6support)+ " PROTOCOL="+ConvToStr(ProtocolVersion)+extra+ - " PREFIX="+Instance->Modes->BuildPrefixes()+ - " CHANMODES="+Instance->Modes->ChanModes()+ + " PREFIX="+ServerInstance->Modes->BuildPrefixes()+ + " CHANMODES="+ServerInstance->Modes->ChanModes()+ " SVSPART=1"); this->WriteLine("CAPAB END"); @@ -183,23 +183,23 @@ bool TreeSocket::Capab(const std::deque<std::string> ¶ms) reason = "Protocol version not specified"; } - if(this->CapKeys.find("PREFIX") != this->CapKeys.end() && this->CapKeys.find("PREFIX")->second != this->Instance->Modes->BuildPrefixes()) + if(this->CapKeys.find("PREFIX") != this->CapKeys.end() && this->CapKeys.find("PREFIX")->second != this->ServerInstance->Modes->BuildPrefixes()) reason = "One or more of the prefixes on the remote server are invalid on this server."; - if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (Instance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(Instance->Config->AllowHalfop)))) + if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (ServerInstance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(ServerInstance->Config->AllowHalfop)))) reason = "We don't both have halfop support enabled/disabled identically"; /* Challenge response, store their challenge for our password */ std::map<std::string,std::string>::iterator n = this->CapKeys.find("CHALLENGE"); - if (Utils->ChallengeResponse && (n != this->CapKeys.end()) && (Instance->Modules->Find("m_sha256.so"))) + if (Utils->ChallengeResponse && (n != this->CapKeys.end()) && (ServerInstance->Modules->Find("m_sha256.so"))) { /* Challenge-response is on now */ this->SetTheirChallenge(n->second); if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING)) { this->SendCapabilities(); - this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 "+ - Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc); + this->WriteLine(std::string("SERVER ")+this->ServerInstance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 "+ + ServerInstance->Config->GetSID()+" :"+this->ServerInstance->Config->ServerDesc); } } else @@ -208,7 +208,7 @@ bool TreeSocket::Capab(const std::deque<std::string> ¶ms) if (this->LinkState == CONNECTING) { this->SendCapabilities(); - this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 "+Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc); + this->WriteLine(std::string("SERVER ")+this->ServerInstance->Config->ServerName+" "+OutboundPass+" 0 "+ServerInstance->Config->GetSID()+" :"+this->ServerInstance->Config->ServerDesc); } } diff --git a/src/modules/m_spanningtree/delline.cpp b/src/modules/m_spanningtree/delline.cpp index e8c398f6b..980573df4 100644 --- a/src/modules/m_spanningtree/delline.cpp +++ b/src/modules/m_spanningtree/delline.cpp @@ -28,7 +28,7 @@ bool TreeSocket::DelLine(const std::string &prefix, std::deque<std::string> &par std::string setter = "<unknown>"; - User* user = Instance->FindNick(prefix); + User* user = ServerInstance->FindNick(prefix); if (user) setter = user->nick; else @@ -40,9 +40,9 @@ bool TreeSocket::DelLine(const std::string &prefix, std::deque<std::string> &par /* NOTE: No check needed on 'user', this function safely handles NULL */ - if (Instance->XLines->DelLine(params[1].c_str(), params[0], user)) + if (ServerInstance->XLines->DelLine(params[1].c_str(), params[0], user)) { - this->Instance->SNO->WriteToSnoMask('x',"%s removed %s%s on %s.", setter.c_str(), + this->ServerInstance->SNO->WriteToSnoMask('x',"%s removed %s%s on %s.", setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "LINE" : "", params[1].c_str()); Utils->DoOneToAllButSender(prefix,"DELLINE", params, prefix); } diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp index 02233e916..3bafe5b2f 100644 --- a/src/modules/m_spanningtree/encap.cpp +++ b/src/modules/m_spanningtree/encap.cpp @@ -27,10 +27,10 @@ bool TreeSocket::Encap(const std::string &prefix, std::deque<std::string> ¶m { if (params.size() > 1) { - if (InspIRCd::Match(Instance->Config->GetSID(), params[0])) + if (InspIRCd::Match(ServerInstance->Config->GetSID(), params[0])) { Event event((char*) ¶ms, (Module*)this->Utils->Creator, "encap_received"); - event.Send(Instance); + event.Send(ServerInstance); } if (params[0].find('*') != std::string::npos) diff --git a/src/modules/m_spanningtree/fhost.cpp b/src/modules/m_spanningtree/fhost.cpp index 09b660ac8..a4aa5abd6 100644 --- a/src/modules/m_spanningtree/fhost.cpp +++ b/src/modules/m_spanningtree/fhost.cpp @@ -25,7 +25,7 @@ bool TreeSocket::ChangeHost(const std::string &prefix, std::deque<std::string> & { if (params.size() < 1) return true; - User* u = this->Instance->FindNick(prefix); + User* u = this->ServerInstance->FindNick(prefix); if (u) { diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index b891443ea..fa61cea4a 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -60,14 +60,14 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p if (params.size() < 3) return true; - irc::modestacker modestack(Instance, true); /* Modes to apply from the users in the user list */ + irc::modestacker modestack(ServerInstance, true); /* Modes to apply from the users in the user list */ User* who = NULL; /* User we are currently checking */ std::string channel = params[0]; /* Channel name, as a string */ time_t TS = atoi(params[1].c_str()); /* Timestamp given to us for remote side */ irc::tokenstream users((params.size() > 3) ? params[params.size() - 1] : ""); /* users from the user list */ bool apply_other_sides_modes = true; /* True if we are accepting the other side's modes */ - Channel* chan = this->Instance->FindChan(channel); /* The channel we're sending joins to */ - time_t ourTS = chan ? chan->age : Instance->Time()+600; /* The TS of our side of the link */ + Channel* chan = this->ServerInstance->FindChan(channel); /* The channel we're sending joins to */ + time_t ourTS = chan ? chan->age : ServerInstance->Time()+600; /* The TS of our side of the link */ bool created = !chan; /* True if the channel doesnt exist here yet */ std::string item; /* One item in the list of nicks */ @@ -78,13 +78,13 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p if (!TS) { - Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped."); - Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", source.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped."); + ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", source.c_str()); return true; } if (created) - chan = new Channel(Instance, channel, ourTS); + chan = new Channel(ServerInstance, channel, ourTS); /* If our TS is less than theirs, we dont accept their modes */ if (ourTS < TS) @@ -95,13 +95,13 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p { std::deque<std::string> param_list; if (Utils->AnnounceTSChange && chan) - chan->WriteChannelWithServ(Instance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), chan->name.c_str(), (unsigned long) ourTS, (unsigned long) TS); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), chan->name.c_str(), (unsigned long) ourTS, (unsigned long) TS); ourTS = TS; if (!created) { chan->age = TS; param_list.push_back(channel); - this->RemoveStatus(Instance->Config->GetSID(), param_list); + this->RemoveStatus(ServerInstance->Config->GetSID(), param_list); } } @@ -120,7 +120,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p modelist.push_back(params[idx]); } - this->Instance->SendMode(modelist, this->Instance->FakeClient); + this->ServerInstance->SendMode(modelist, this->ServerInstance->FakeClient); } /* Now, process every 'modes,nick' pair */ @@ -136,7 +136,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p /* Iterate through all modes for this user and check they are valid. */ while ((*unparsedmodes) && (*unparsedmodes != ',')) { - ModeHandler *mh = Instance->Modes->FindMode(*unparsedmodes, MODETYPE_CHANNEL); + ModeHandler *mh = ServerInstance->Modes->FindMode(*unparsedmodes, MODETYPE_CHANNEL); if (mh) modes += *unparsedmodes; else @@ -153,7 +153,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p usr++; /* Check the user actually exists */ - who = this->Instance->FindUUID(usr); + who = this->ServerInstance->FindUUID(usr); if (who) { /* Check that the user's 'direction' is correct */ @@ -165,11 +165,11 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p for (std::string::iterator x = modes.begin(); x != modes.end(); ++x) modestack.Push(*x, who->nick); - Channel::JoinUser(this->Instance, who, channel.c_str(), true, "", true, TS); + Channel::JoinUser(this->ServerInstance, who, channel.c_str(), true, "", true, TS); } else { - Instance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", usr, channel.c_str()); + ServerInstance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", usr, channel.c_str()); continue; } } @@ -188,7 +188,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p { mode_junk.push_back(stackresult[j]); } - Instance->SendMode(mode_junk, Instance->FakeClient); + ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient); } } @@ -202,18 +202,18 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string> if (params.size() < 1) return true; - Channel* c = Instance->FindChan(params[0]); + Channel* c = ServerInstance->FindChan(params[0]); if (c) { - irc::modestacker stack(Instance, false); + irc::modestacker stack(ServerInstance, false); std::deque<std::string> stackresult; std::vector<std::string> mode_junk; mode_junk.push_back(c->name); for (char modeletter = 'A'; modeletter <= 'z'; ++modeletter) { - ModeHandler* mh = Instance->Modes->FindMode(modeletter, MODETYPE_CHANNEL); + ModeHandler* mh = ServerInstance->Modes->FindMode(modeletter, MODETYPE_CHANNEL); /* Passing a pointer to a modestacker here causes the mode to be put onto the mode stack, * rather than applied immediately. Module unloads require this to be done immediately, @@ -228,7 +228,7 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string> for (size_t j = 0; j < stackresult.size(); j++) mode_junk.push_back(stackresult[j]); - Instance->SendMode(mode_junk, Instance->FakeClient); + ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient); } } return true; diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index 2ab370170..d8e2342d5 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -35,7 +35,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p std::string sourceserv; /* Are we dealing with an FMODE from a user, or from a server? */ - User* who = this->Instance->FindNick(source); + User* who = this->ServerInstance->FindNick(source); if (who) { /* FMODE from a user, set sourceserv to the users server name */ @@ -44,7 +44,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p else { /* FMODE from a server, use a fake user to receive mode feedback */ - who = this->Instance->FakeClient; + who = this->ServerInstance->FakeClient; smode = true; /* Setting this flag tells us it is a server mode*/ sourceserv = source; /* Set sourceserv to the actual source string */ } @@ -68,7 +68,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p } /* Extract the TS value of the object, either User or Channel */ - User* dst = this->Instance->FindNick(params[0]); + User* dst = this->ServerInstance->FindNick(params[0]); Channel* chan = NULL; time_t ourTS = 0; @@ -78,7 +78,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p } else { - chan = this->Instance->FindChan(params[0]); + chan = this->ServerInstance->FindChan(params[0]); if (chan) { ourTS = chan->age; @@ -90,8 +90,8 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p if (!TS) { - Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped."); - Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq. Mode was dropped.", sourceserv.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped."); + ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq. Mode was dropped.", sourceserv.c_str()); return true; } @@ -101,11 +101,11 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p { if (smode) { - this->Instance->SendMode(modelist, who); + this->ServerInstance->SendMode(modelist, who); } else { - this->Instance->CallCommandHandler("MODE", modelist, who); + this->ServerInstance->CallCommandHandler("MODE", modelist, who); } /* HOT POTATO! PASS IT ON! */ Utils->DoOneToAllButSender(source,"FMODE",params,sourceserv); diff --git a/src/modules/m_spanningtree/fname.cpp b/src/modules/m_spanningtree/fname.cpp index 8d2f137a5..ddbc79660 100644 --- a/src/modules/m_spanningtree/fname.cpp +++ b/src/modules/m_spanningtree/fname.cpp @@ -25,7 +25,7 @@ bool TreeSocket::ChangeName(const std::string &prefix, std::deque<std::string> & { if (params.size() < 1) return true; - User* u = this->Instance->FindNick(prefix); + User* u = this->ServerInstance->FindNick(prefix); if (u) { u->ChangeName(params[0].c_str()); diff --git a/src/modules/m_spanningtree/ftopic.cpp b/src/modules/m_spanningtree/ftopic.cpp index 2ed813b0f..351c4327a 100644 --- a/src/modules/m_spanningtree/ftopic.cpp +++ b/src/modules/m_spanningtree/ftopic.cpp @@ -27,19 +27,19 @@ bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> & if (params.size() != 4) return true; time_t ts = atoi(params[1].c_str()); - Channel* c = this->Instance->FindChan(params[0]); + Channel* c = this->ServerInstance->FindChan(params[0]); if (c) { if ((ts >= c->topicset) || (c->topic.empty())) { if (c->topic != params[3]) { - User* user = this->Instance->FindNick(source); + User* user = this->ServerInstance->FindNick(source); // Update topic only when it differs from current topic - c->topic.assign(params[3], 0, Instance->Config->Limits.MaxTopic); + c->topic.assign(params[3], 0, ServerInstance->Config->Limits.MaxTopic); if (!user) { - c->WriteChannelWithServ(Instance->Config->ServerName, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str()); + c->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str()); } else { diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 418a64724..2e81dcc54 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -58,7 +58,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string * Note: If m_sha256.so is not loaded, we MUST fall back to plaintext with no * HMAC challenge/response. */ - Module* sha256 = Instance->Modules->Find("m_sha256.so"); + Module* sha256 = ServerInstance->Modules->Find("m_sha256.so"); if (Utils->ChallengeResponse && sha256 && !challenge.empty()) { /* XXX: This is how HMAC is supposed to be done: @@ -89,7 +89,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string return "HMAC-SHA256:"+ hmac; } else if (!challenge.empty() && !sha256) - Instance->Logs->Log("m_spanningtree",DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!"); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!"); return password; } @@ -108,7 +108,7 @@ std::string TreeSocket::RandString(unsigned int ilength) { #ifndef WINDOWS if (read(f, randombuf, ilength) < 1) - Instance->Logs->Log("m_spanningtree", DEFAULT, "There are crack smoking monkeys in your kernel (in other words, nonblocking /dev/urandom blocked.)"); + ServerInstance->Logs->Log("m_spanningtree", DEFAULT, "There are crack smoking monkeys in your kernel (in other words, nonblocking /dev/urandom blocked.)"); close(f); #endif } @@ -135,7 +135,7 @@ bool TreeSocket::ComparePass(const std::string &ours, const std::string &theirs) /* One or both of us specified hmac sha256, but we don't have sha256 module loaded! * We can't allow this password as valid. */ - if (!Instance->Modules->Find("m_sha256.so") || !Utils->ChallengeResponse) + if (!ServerInstance->Modules->Find("m_sha256.so") || !Utils->ChallengeResponse) return false; else /* Straight string compare of hashes */ diff --git a/src/modules/m_spanningtree/kill.cpp b/src/modules/m_spanningtree/kill.cpp index 93bed9bbe..c70ce27cb 100644 --- a/src/modules/m_spanningtree/kill.cpp +++ b/src/modules/m_spanningtree/kill.cpp @@ -28,7 +28,7 @@ bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> & if (params.size() != 2) return true; - User* who = this->Instance->FindNick(params[0]); + User* who = this->ServerInstance->FindNick(params[0]); if (who) { @@ -44,7 +44,7 @@ bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> & // NOTE: This is safe with kill hiding on, as RemoteKill is only reached if we have a server prefix. // in short this is not executed for USERS. who->Write(":%s KILL %s :%s (%s)", prefix.c_str(), who->nick.c_str(), prefix.c_str(), reason.c_str()); - this->Instance->Users->QuitUser(who, reason); + this->ServerInstance->Users->QuitUser(who, reason); } return true; } diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 5c64d257c..9cdce5eb7 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -32,22 +32,22 @@ bool TreeSocket::MetaData(const std::string &prefix, std::deque<std::string> &pa { if (params[0] == "*") { - FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_OTHER,NULL,params[1],params[2])); + FOREACH_MOD_I(this->ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_OTHER,NULL,params[1],params[2])); } else if (*(params[0].c_str()) == '#') { - Channel* c = this->Instance->FindChan(params[0]); + Channel* c = this->ServerInstance->FindChan(params[0]); if (c) { - FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_CHANNEL,c,params[1],params[2])); + FOREACH_MOD_I(this->ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_CHANNEL,c,params[1],params[2])); } } else if (*(params[0].c_str()) != '#') { - User* u = this->Instance->FindNick(params[0]); + User* u = this->ServerInstance->FindNick(params[0]); if (u) { - FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_USER,u,params[1],params[2])); + FOREACH_MOD_I(this->ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_USER,u,params[1],params[2])); } } } diff --git a/src/modules/m_spanningtree/modules.cpp b/src/modules/m_spanningtree/modules.cpp index fe6ca8434..a785a3f51 100644 --- a/src/modules/m_spanningtree/modules.cpp +++ b/src/modules/m_spanningtree/modules.cpp @@ -26,7 +26,7 @@ bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &par if (params.empty()) return true; - if (!InspIRCd::Match(this->Instance->Config->ServerName, params[0])) + if (!InspIRCd::Match(this->ServerInstance->Config->ServerName, params[0])) { /* Pass it on, not for us */ Utils->DoOneToOne(prefix, "MODULES", params, params[0]); @@ -38,15 +38,15 @@ bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &par par.push_back(prefix); par.push_back(""); - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (!source) return true; - std::vector<std::string> module_names = Instance->Modules->GetAllModuleNames(0); + std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0); for (unsigned int i = 0; i < module_names.size(); i++) { - Module* m = Instance->Modules->Find(module_names[i]); + Module* m = ServerInstance->Modules->Find(module_names[i]); Version V = m->GetVersion(); if (IS_OPER(source)) @@ -57,18 +57,18 @@ bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &par if (!(V.Flags & mult)) flags[pos] = '-'; - snprintf(strbuf, MAXBUF, "::%s 702 %s :0x%08lx %s %s :%s", Instance->Config->ServerName, source->nick.c_str(),(unsigned long)m, module_names[i].c_str(), flags.c_str(), V.version.c_str()); + snprintf(strbuf, MAXBUF, "::%s 702 %s :0x%08lx %s %s :%s", ServerInstance->Config->ServerName, source->nick.c_str(),(unsigned long)m, module_names[i].c_str(), flags.c_str(), V.version.c_str()); } else { - snprintf(strbuf, MAXBUF, "::%s 702 %s :%s", Instance->Config->ServerName, source->nick.c_str(), module_names[i].c_str()); + snprintf(strbuf, MAXBUF, "::%s 702 %s :%s", ServerInstance->Config->ServerName, source->nick.c_str(), module_names[i].c_str()); } par[1] = strbuf; - Utils->DoOneToOne(Instance->Config->GetSID(), "PUSH", par, source->server); + Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", par, source->server); } - snprintf(strbuf, MAXBUF, "::%s 703 %s :End of MODULES list", Instance->Config->ServerName, source->nick.c_str()); + snprintf(strbuf, MAXBUF, "::%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName, source->nick.c_str()); par[1] = strbuf; - Utils->DoOneToOne(Instance->Config->GetSID(), "PUSH", par, source->server); + Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", par, source->server); return true; } diff --git a/src/modules/m_spanningtree/motd.cpp b/src/modules/m_spanningtree/motd.cpp index 6ec09c5fd..f16e3c29e 100644 --- a/src/modules/m_spanningtree/motd.cpp +++ b/src/modules/m_spanningtree/motd.cpp @@ -27,11 +27,11 @@ bool TreeSocket::Motd(const std::string &prefix, std::deque<std::string> ¶ms { if (params.size() > 0) { - if (InspIRCd::Match(this->Instance->Config->ServerName, params[0])) + if (InspIRCd::Match(this->ServerInstance->Config->ServerName, params[0])) { /* It's for our server */ string_list results; - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (source) { @@ -39,30 +39,30 @@ bool TreeSocket::Motd(const std::string &prefix, std::deque<std::string> ¶ms par.push_back(prefix); par.push_back(""); - if (!Instance->Config->MOTD.size()) + if (!ServerInstance->Config->MOTD.size()) { - par[1] = std::string("::")+Instance->Config->ServerName+" 422 "+source->nick+" :Message of the day file is missing."; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 422 "+source->nick+" :Message of the day file is missing."; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); return true; } - par[1] = std::string("::")+Instance->Config->ServerName+" 375 "+source->nick+" :"+Instance->Config->ServerName+" message of the day"; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 375 "+source->nick+" :"+ServerInstance->Config->ServerName+" message of the day"; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); - for (unsigned int i = 0; i < Instance->Config->MOTD.size(); i++) + for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++) { - par[1] = std::string("::")+Instance->Config->ServerName+" 372 "+source->nick+" :- "+Instance->Config->MOTD[i]; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 372 "+source->nick+" :- "+ServerInstance->Config->MOTD[i]; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); } - par[1] = std::string("::")+Instance->Config->ServerName+" 376 "+source->nick+" :End of message of the day."; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); + par[1] = std::string("::")+ServerInstance->Config->ServerName+" 376 "+source->nick+" :End of message of the day."; + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); } } else { /* Pass it on */ - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (source) Utils->DoOneToOne(prefix, "MOTD", params, params[0]); } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 6d068c5e2..b97c582d0 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -29,12 +29,12 @@ void TreeSocket::DoBurst(TreeServer* s) { std::string name = s->GetName(); - std::string burst = ":" + this->Instance->Config->GetSID() + " BURST " +ConvToStr(Instance->Time()); - std::string endburst = ":" + this->Instance->Config->GetSID() + " ENDBURST"; - this->Instance->SNO->WriteToSnoMask('l',"Bursting to \2%s\2 (Authentication: %s).", name.c_str(), this->GetTheirChallenge().empty() ? "plaintext password" : "SHA256-HMAC challenge-response"); + std::string burst = ":" + this->ServerInstance->Config->GetSID() + " BURST " +ConvToStr(ServerInstance->Time()); + std::string endburst = ":" + this->ServerInstance->Config->GetSID() + " ENDBURST"; + this->ServerInstance->SNO->WriteToSnoMask('l',"Bursting to \2%s\2 (Authentication: %s).", name.c_str(), this->GetTheirChallenge().empty() ? "plaintext password" : "SHA256-HMAC challenge-response"); this->WriteLine(burst); /* send our version string */ - this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" VERSION :"+this->Instance->GetVersionString()); + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" VERSION :"+this->ServerInstance->GetVersionString()); /* Send server tree */ this->SendServers(Utils->TreeRoot,s,1); /* Send users and their oper status */ @@ -42,9 +42,9 @@ void TreeSocket::DoBurst(TreeServer* s) /* Send everything else (channel modes, xlines etc) */ this->SendChannelModes(s); this->SendXLines(s); - FOREACH_MOD_I(this->Instance,I_OnSyncOtherMetaData,OnSyncOtherMetaData((Module*)Utils->Creator,(void*)this)); + FOREACH_MOD_I(this->ServerInstance,I_OnSyncOtherMetaData,OnSyncOtherMetaData((Module*)Utils->Creator,(void*)this)); this->WriteLine(endburst); - this->Instance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+name+"\2."); + this->ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+name+"\2."); } /** Recursively send the server tree with distances as hops. @@ -85,7 +85,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) char list[MAXBUF]; size_t dlen, curlen; - dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(),(unsigned long)c->age, c->ChanModes(true)); + dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->ServerInstance->Config->GetSID().c_str(), c->name.c_str(),(unsigned long)c->age, c->ChanModes(true)); int numusers = 0; char* ptr = list + dlen; bool looped_once = false; @@ -97,12 +97,12 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { size_t ptrlen = 0; - std::string modestr = this->Instance->Modes->ModeString(i->first, c, false); + std::string modestr = this->ServerInstance->Modes->ModeString(i->first, c, false); if ((curlen + modestr.length() + i->first->uuid.length() + 4) > 480) { buffer.append(list).append("\r\n"); - dlen = curlen = snprintf(list, MAXBUF, ":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true)); + dlen = curlen = snprintf(list, MAXBUF, ":%s FJOIN %s %lu +%s", this->ServerInstance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true)); ptr = list + dlen; numusers = 0; } @@ -134,10 +134,10 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) params.append(" ").append(b->data); linesize += size; } - if ((params.length() >= Instance->Config->Limits.MaxModes) || (currsize > 350)) + if ((params.length() >= ServerInstance->Config->Limits.MaxModes) || (currsize > 350)) { /* Wrap at MAXMODES */ - buffer.append(":").append(this->Instance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n"); + buffer.append(":").append(this->ServerInstance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n"); modes.clear(); params.clear(); linesize = 1; @@ -146,7 +146,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) /* Only send these if there are any */ if (!modes.empty()) - buffer.append(":").append(this->Instance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params); + buffer.append(":").append(this->ServerInstance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params); this->WriteLine(buffer); } @@ -155,14 +155,14 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) void TreeSocket::SendXLines(TreeServer* Current) { char data[MAXBUF]; - std::string n = this->Instance->Config->GetSID(); + std::string n = this->ServerInstance->Config->GetSID(); const char* sn = n.c_str(); - std::vector<std::string> types = Instance->XLines->GetAllTypes(); + std::vector<std::string> types = ServerInstance->XLines->GetAllTypes(); for (std::vector<std::string>::iterator it = types.begin(); it != types.end(); ++it) { - XLineLookup* lookup = Instance->XLines->GetAll(*it); + XLineLookup* lookup = ServerInstance->XLines->GetAll(*it); if (lookup) { @@ -190,9 +190,9 @@ void TreeSocket::SendChannelModes(TreeServer* Current) { char data[MAXBUF]; std::deque<std::string> list; - std::string n = this->Instance->Config->GetSID(); + std::string n = this->ServerInstance->Config->GetSID(); const char* sn = n.c_str(); - for (chan_hash::iterator c = this->Instance->chanlist->begin(); c != this->Instance->chanlist->end(); c++) + for (chan_hash::iterator c = this->ServerInstance->chanlist->begin(); c != this->ServerInstance->chanlist->end(); c++) { SendFJoins(Current, c->second); if (!c->second->topic.empty()) @@ -200,12 +200,12 @@ void TreeSocket::SendChannelModes(TreeServer* Current) snprintf(data,MAXBUF,":%s FTOPIC %s %lu %s :%s", sn, c->second->name.c_str(), (unsigned long)c->second->topicset, c->second->setby.c_str(), c->second->topic.c_str()); this->WriteLine(data); } - FOREACH_MOD_I(this->Instance,I_OnSyncChannel,OnSyncChannel(c->second,(Module*)Utils->Creator,(void*)this)); + FOREACH_MOD_I(this->ServerInstance,I_OnSyncChannel,OnSyncChannel(c->second,(Module*)Utils->Creator,(void*)this)); list.clear(); c->second->GetExtList(list); for (unsigned int j = 0; j < list.size(); j++) { - FOREACH_MOD_I(this->Instance,I_OnSyncChannelMetaData,OnSyncChannelMetaData(c->second,(Module*)Utils->Creator,(void*)this,list[j])); + FOREACH_MOD_I(this->ServerInstance,I_OnSyncChannelMetaData,OnSyncChannelMetaData(c->second,(Module*)Utils->Creator,(void*)this,list[j])); } } } @@ -216,7 +216,7 @@ void TreeSocket::SendUsers(TreeServer* Current) char data[MAXBUF]; std::deque<std::string> list; std::string dataline; - for (user_hash::iterator u = this->Instance->Users->clientlist->begin(); u != this->Instance->Users->clientlist->end(); u++) + for (user_hash::iterator u = this->ServerInstance->Users->clientlist->begin(); u != this->ServerInstance->Users->clientlist->end(); u++) { if (u->second->registered == REG_ALL) { @@ -248,12 +248,12 @@ void TreeSocket::SendUsers(TreeServer* Current) } } - FOREACH_MOD_I(this->Instance,I_OnSyncUser,OnSyncUser(u->second,(Module*)Utils->Creator,(void*)this)); + FOREACH_MOD_I(this->ServerInstance,I_OnSyncUser,OnSyncUser(u->second,(Module*)Utils->Creator,(void*)this)); list.clear(); u->second->GetExtList(list); for (unsigned int j = 0; j < list.size(); j++) { - FOREACH_MOD_I(this->Instance,I_OnSyncUserMetaData,OnSyncUserMetaData(u->second,(Module*)Utils->Creator,(void*)this,list[j])); + FOREACH_MOD_I(this->ServerInstance,I_OnSyncUserMetaData,OnSyncUserMetaData(u->second,(Module*)Utils->Creator,(void*)this,list[j])); } } } diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index 5531f9c0e..6df07b9cd 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -105,7 +105,7 @@ int TreeSocket::DoCollision(User *u, time_t remotets, const std::string &remotei * have 928AAAB's nick set to that. * -- w00t */ - User *remote = this->Instance->FindUUID(remoteuid); + User *remote = this->ServerInstance->FindUUID(remoteuid); if (remote) { @@ -115,7 +115,7 @@ int TreeSocket::DoCollision(User *u, time_t remotets, const std::string &remotei else { /* user has not been introduced yet, just inform their server */ - this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" SVSNICK "+remoteuid+" " + remoteuid + " " + ConvToStr(remotets)); + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" SVSNICK "+remoteuid+" " + remoteuid + " " + ConvToStr(remotets)); } if (!bChangeLocal) diff --git a/src/modules/m_spanningtree/operquit.cpp b/src/modules/m_spanningtree/operquit.cpp index 77886c26a..f7390a630 100644 --- a/src/modules/m_spanningtree/operquit.cpp +++ b/src/modules/m_spanningtree/operquit.cpp @@ -26,7 +26,7 @@ bool TreeSocket::OperQuit(const std::string &prefix, std::deque<std::string> &pa if (params.size() < 1) return true; - User* u = this->Instance->FindNick(prefix); + User* u = this->ServerInstance->FindNick(prefix); if (u) { diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index c52cca60a..77afbc057 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -29,11 +29,11 @@ bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &pa if (params.size() != 1) return true; std::string opertype = params[0]; - User* u = this->Instance->FindNick(prefix); + User* u = this->ServerInstance->FindNick(prefix); if (u) { if (!u->IsModeSet('o')) - this->Instance->Users->all_opers.push_back(u); + this->ServerInstance->Users->all_opers.push_back(u); u->modes[UM_OPERATOR] = 1; u->oper.assign(opertype, 0, 512); Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server); @@ -49,7 +49,7 @@ bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &pa */ if ( remoteserver->bursting || - this->Instance->SilentULine(this->Instance->FindServerNamePtr(u->server)) + this->ServerInstance->SilentULine(this->ServerInstance->FindServerNamePtr(u->server)) ) { dosend = false; @@ -57,7 +57,7 @@ bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &pa } if (dosend) - this->Instance->SNO->WriteToSnoMask('o',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str())); + this->ServerInstance->SNO->WriteToSnoMask('o',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str())); } return true; } diff --git a/src/modules/m_spanningtree/ping.cpp b/src/modules/m_spanningtree/ping.cpp index b884305b2..3a2e9d375 100644 --- a/src/modules/m_spanningtree/ping.cpp +++ b/src/modules/m_spanningtree/ping.cpp @@ -33,13 +33,13 @@ bool TreeSocket::LocalPing(const std::string &prefix, std::deque<std::string> &p if (params.size() == 1) { std::string stufftobounce = params[0]; - this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" PONG "+stufftobounce); + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" PONG "+stufftobounce); return true; } else { std::string forwardto = params[1]; - if (forwardto == this->Instance->Config->ServerName || forwardto == this->Instance->Config->GetSID()) + if (forwardto == this->ServerInstance->Config->ServerName || forwardto == this->ServerInstance->Config->GetSID()) { // this is a ping for us, send back PONG to the requesting server params[1] = params[0]; diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp index 8e21f5a3e..e14d62cb5 100644 --- a/src/modules/m_spanningtree/pong.cpp +++ b/src/modules/m_spanningtree/pong.cpp @@ -46,7 +46,7 @@ bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> &p else { std::string forwardto = params[1]; - if (forwardto == Instance->Config->GetSID() || forwardto == Instance->Config->ServerName) + if (forwardto == ServerInstance->Config->GetSID() || forwardto == ServerInstance->Config->ServerName) { /* * this is a PONG for us @@ -54,7 +54,7 @@ bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> &p * dump the PONG reply back to their fd. If its a server, do nowt. * Services might want to send these s->s, but we dont need to yet. */ - User* u = this->Instance->FindNick(prefix); + User* u = this->ServerInstance->FindNick(prefix); if (u) { u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str()); diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp index a68590048..da3756309 100644 --- a/src/modules/m_spanningtree/privmsg.cpp +++ b/src/modules/m_spanningtree/privmsg.cpp @@ -32,49 +32,49 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string const char* target = params[0].c_str(); std::string text = params[1].c_str(); - if (Instance->Modes->FindPrefix(*target)) + if (ServerInstance->Modes->FindPrefix(*target)) { status = *target; target++; } - Channel* channel = Instance->FindChan(target); + Channel* channel = ServerInstance->FindChan(target); if (channel) { if (messagetype == "PRIVMSG") { - FOREACH_MOD_I(Instance, I_OnUserMessage, OnUserMessage(NULL, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD_I(ServerInstance, I_OnUserMessage, OnUserMessage(NULL, channel, TYPE_CHANNEL, text, status, except_list)); } else { - FOREACH_MOD_I(Instance, I_OnUserNotice, OnUserNotice(NULL, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD_I(ServerInstance, I_OnUserNotice, OnUserNotice(NULL, channel, TYPE_CHANNEL, text, status, except_list)); } TreeServer* s = Utils->FindServer(prefix); if (s) { - FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD_I(ServerInstance, I_OnText, OnText(NULL, channel, TYPE_CHANNEL, text, status, except_list)); channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str()); } } else { - User* user = Instance->FindNick(target); + User* user = ServerInstance->FindNick(target); if (user) { if (messagetype == "PRIVMSG") { - FOREACH_MOD_I(Instance, I_OnUserMessage, OnUserMessage(NULL, user, TYPE_USER, text, 0, except_list)); + FOREACH_MOD_I(ServerInstance, I_OnUserMessage, OnUserMessage(NULL, user, TYPE_USER, text, 0, except_list)); } else { - FOREACH_MOD_I(Instance, I_OnUserNotice, OnUserNotice(NULL, user, TYPE_USER, text, 0, except_list)); + FOREACH_MOD_I(ServerInstance, I_OnUserNotice, OnUserNotice(NULL, user, TYPE_USER, text, 0, except_list)); } TreeServer* s = Utils->FindServer(prefix); if (s) { - FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, user, TYPE_USER, text, status, except_list)); + FOREACH_MOD_I(ServerInstance, I_OnText, OnText(NULL, user, TYPE_USER, text, status, except_list)); user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick.c_str(), text.c_str()); } diff --git a/src/modules/m_spanningtree/push.cpp b/src/modules/m_spanningtree/push.cpp index b2fc045f0..e17c83499 100644 --- a/src/modules/m_spanningtree/push.cpp +++ b/src/modules/m_spanningtree/push.cpp @@ -30,7 +30,7 @@ bool TreeSocket::Push(const std::string &prefix, std::deque<std::string> ¶ms { if (params.size() < 2) return true; - User* u = this->Instance->FindNick(params[0]); + User* u = this->ServerInstance->FindNick(params[0]); if (!u) return true; if (IS_LOCAL(u)) diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 0ff0e30f6..1254d14d4 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -51,7 +51,7 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> this->SendError("Protocol error - Introduced remote server from unknown server "+ParentOfThis->GetName()); return false; } - if (!this->Instance->IsSID(sid)) + if (!this->ServerInstance->IsSID(sid)) { this->SendError("Invalid format server ID: "+sid+"!"); return false; @@ -60,25 +60,25 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> if (CheckDupe) { this->SendError("Server "+CheckDupe->GetName()+" already exists!"); - this->Instance->SNO->WriteToSnoMask('l',"Server \2"+CheckDupe->GetName()+"\2 being introduced from \2" + ParentOfThis->GetName() + "\2 denied, already exists. Closing link with " + ParentOfThis->GetName()); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \2"+CheckDupe->GetName()+"\2 being introduced from \2" + ParentOfThis->GetName() + "\2 denied, already exists. Closing link with " + ParentOfThis->GetName()); return false; } Link* lnk = Utils->FindLink(servername); - TreeServer *Node = new TreeServer(this->Utils, this->Instance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); + TreeServer *Node = new TreeServer(this->Utils, this->ServerInstance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); if (Node->DuplicateID()) { this->SendError("Server ID "+servername+" already exists on the network!"); - this->Instance->SNO->WriteToSnoMask('l',"Server \2"+servername+"\2 being introduced from \2" + ParentOfThis->GetName() + "\2 denied, server ID already exists on the network. Closing link with " + ParentOfThis->GetName()); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \2"+servername+"\2 being introduced from \2" + ParentOfThis->GetName() + "\2 denied, server ID already exists on the network. Closing link with " + ParentOfThis->GetName()); return false; } ParentOfThis->AddChild(Node); params[4] = ":" + params[4]; Utils->DoOneToAllButSender(prefix,"SERVER",params,prefix); - this->Instance->SNO->WriteToSnoMask('l',"Server \002"+ParentOfThis->GetName()+"\002 introduced server \002"+servername+"\002 ("+description+")"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \002"+ParentOfThis->GetName()+"\002 introduced server \002"+servername+"\002 ("+description+")"); return true; } @@ -112,11 +112,11 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) if (hops) { this->SendError("Server too far away for authentication"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server is too far away for authentication"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server is too far away for authentication"); return false; } - if (!this->Instance->IsSID(sid)) + if (!this->ServerInstance->IsSID(sid)) { this->SendError("Invalid format server ID: "+sid+"!"); return false; @@ -130,7 +130,7 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) if (!ComparePass(this->MakePass(x->RecvPass, this->GetOurChallenge()), password) && (x->RecvPass != password && this->GetTheirChallenge().empty())) { - this->Instance->SNO->WriteToSnoMask('l',"Invalid password on link: %s", x->Name.c_str()); + this->ServerInstance->SNO->WriteToSnoMask('l',"Invalid password on link: %s", x->Name.c_str()); continue; } @@ -138,7 +138,7 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) if (CheckDupe) { this->SendError("Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName()); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName()); return false; } @@ -152,12 +152,12 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) */ this->LinkState = CONNECTED; - TreeServer *Node = new TreeServer(this->Utils, this->Instance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); + TreeServer *Node = new TreeServer(this->Utils, this->ServerInstance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); if (Node->DuplicateID()) { this->SendError("Server ID "+sid+" already exists on the network!"); - this->Instance->SNO->WriteToSnoMask('l',"Server \2"+assign(servername)+"\2 being introduced denied, server ID already exists on the network. Closing link."); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \2"+assign(servername)+"\2 being introduced denied, server ID already exists on the network. Closing link."); return false; } @@ -167,7 +167,7 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) /* IMPORTANT: Take password/hmac hash OUT of here before we broadcast the introduction! */ params[1] = "*"; - Utils->DoOneToAllButSender(Instance->Config->GetSID(),"SERVER",params,sname); + Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname); Node->bursting = true; this->DoBurst(Node); @@ -175,7 +175,7 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) } this->SendError("Invalid credentials (check the other server's linking snomask for more information)"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, invalid link credentials"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, invalid link credentials"); return false; } @@ -208,11 +208,11 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms) if (hops) { this->SendError("Server too far away for authentication"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server is too far away for authentication"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server is too far away for authentication"); return false; } - if (!this->Instance->IsSID(sid)) + if (!this->ServerInstance->IsSID(sid)) { this->SendError("Invalid format server ID: "+sid+"!"); return false; @@ -226,49 +226,49 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms) if (!ComparePass(this->MakePass(x->RecvPass, this->GetOurChallenge()), password) && (x->RecvPass != password && this->GetTheirChallenge().empty())) { - this->Instance->SNO->WriteToSnoMask('l',"Invalid password on link: %s", x->Name.c_str()); + this->ServerInstance->SNO->WriteToSnoMask('l',"Invalid password on link: %s", x->Name.c_str()); continue; } /* Check for fully initialized instances of the server by id */ - Instance->Logs->Log("m_spanningtree",DEBUG,"Looking for dupe SID %s", sid.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Looking for dupe SID %s", sid.c_str()); TreeServer* CheckDupeSID = Utils->FindServerID(sid); if (CheckDupeSID) { this->SendError("Server ID "+CheckDupeSID->GetID()+" already exists on server "+CheckDupeSID->GetName()+"!"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server ID '"+CheckDupeSID->GetID()+ + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server ID '"+CheckDupeSID->GetID()+ "' already exists on server "+CheckDupeSID->GetName()); return false; } - /* Now check for fully initialized instances of the server by name */ + /* Now check for fully initialized ServerInstances of the server by name */ TreeServer* CheckDupe = Utils->FindServer(sname); if (CheckDupe) { this->SendError("Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName()); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName()); return false; } - this->Instance->SNO->WriteToSnoMask('l',"Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] ("+description+")"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] ("+description+")"); if (this->Hook) { std::string name = BufferedSocketNameRequest((Module*)Utils->Creator, this->Hook).Send(); - this->Instance->SNO->WriteToSnoMask('l',"Connection from \2"+sname+"\2["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] using transport \2"+name+"\2"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Connection from \2"+sname+"\2["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] using transport \2"+name+"\2"); } // this is good. Send our details: Our server name and description and hopcount of 0, // along with the sendpass from this block. this->SendCapabilities(); - this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc); + this->WriteLine(std::string("SERVER ")+this->ServerInstance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+ServerInstance->Config->GetSID()+" :"+this->ServerInstance->Config->ServerDesc); // move to the next state, we are now waiting for THEM. this->LinkState = WAIT_AUTH_2; return true; } this->SendError("Invalid credentials"); - this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, invalid link credentials"); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, invalid link credentials"); return false; } diff --git a/src/modules/m_spanningtree/stats.cpp b/src/modules/m_spanningtree/stats.cpp index 8d74a8bbf..759255a6b 100644 --- a/src/modules/m_spanningtree/stats.cpp +++ b/src/modules/m_spanningtree/stats.cpp @@ -34,28 +34,28 @@ bool TreeSocket::Stats(const std::string &prefix, std::deque<std::string> ¶m */ if (params.size() > 1) { - if (InspIRCd::Match(this->Instance->Config->ServerName, params[1])) + if (InspIRCd::Match(this->ServerInstance->Config->ServerName, params[1])) { /* It's for our server */ string_list results; - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (source) { std::deque<std::string> par; par.push_back(prefix); par.push_back(""); - DoStats(this->Instance, *(params[0].c_str()), source, results); + DoStats(this->ServerInstance, *(params[0].c_str()), source, results); for (size_t i = 0; i < results.size(); i++) { par[1] = "::" + results[i]; - Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server); + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server); } } } else { /* Pass it on */ - User* source = this->Instance->FindNick(prefix); + User* source = this->ServerInstance->FindNick(prefix); if (source) Utils->DoOneToOne(source->uuid, "STATS", params, params[1]); } diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index d3c47f47b..92fe0ac22 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -31,13 +31,13 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string> if (params.size() < 2) return true; - User* u = this->Instance->FindNick(params[0]); + User* u = this->ServerInstance->FindNick(params[0]); if (u) { /* only join if it's local, otherwise just pass it on! */ if (IS_LOCAL(u)) - Channel::JoinUser(this->Instance, u, params[1].c_str(), false, "", false, Instance->Time()); + Channel::JoinUser(this->ServerInstance, u, params[1].c_str(), false, "", false, ServerInstance->Time()); Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix); } return true; diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp index ef57f6dbb..95b49e0c7 100644 --- a/src/modules/m_spanningtree/svsnick.cpp +++ b/src/modules/m_spanningtree/svsnick.cpp @@ -34,7 +34,7 @@ bool TreeSocket::ForceNick(const std::string &prefix, std::deque<std::string> &p if (params.size() < 3) return true; - User* u = this->Instance->FindNick(params[0]); + User* u = this->ServerInstance->FindNick(params[0]); if (u) { @@ -50,7 +50,7 @@ bool TreeSocket::ForceNick(const std::string &prefix, std::deque<std::string> &p /* buh. UID them */ if (!u->ForceNickChange(u->uuid.c_str())) { - this->Instance->Users->QuitUser(u, "Nickname collision"); + this->ServerInstance->Users->QuitUser(u, "Nickname collision"); return true; } } diff --git a/src/modules/m_spanningtree/svspart.cpp b/src/modules/m_spanningtree/svspart.cpp index 95d1a1c23..59f9b7fcc 100644 --- a/src/modules/m_spanningtree/svspart.cpp +++ b/src/modules/m_spanningtree/svspart.cpp @@ -36,8 +36,8 @@ bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string> if (params.size() == 3) reason = params[2]; - User* u = this->Instance->FindNick(params[0]); - Channel* c = this->Instance->FindChan(params[1]); + User* u = this->ServerInstance->FindNick(params[0]); + Channel* c = this->ServerInstance->FindChan(params[1]); if (u) { diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp index eb90eab8d..da05b5ded 100644 --- a/src/modules/m_spanningtree/time.cpp +++ b/src/modules/m_spanningtree/time.cpp @@ -33,20 +33,20 @@ bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> ¶ms if (params.size() == 2) { // someone querying our time? - if (this->Instance->Config->ServerName == params[0] || this->Instance->Config->GetSID() == params[0]) + if (this->ServerInstance->Config->ServerName == params[0] || this->ServerInstance->Config->GetSID() == params[0]) { - User* u = this->Instance->FindNick(params[1]); + User* u = this->ServerInstance->FindNick(params[1]); if (u) { - params.push_back(ConvToStr(Instance->Time())); + params.push_back(ConvToStr(ServerInstance->Time())); params[0] = prefix; - Utils->DoOneToOne(this->Instance->Config->GetSID(),"TIME",params,params[0]); + Utils->DoOneToOne(this->ServerInstance->Config->GetSID(),"TIME",params,params[0]); } } else { // not us, pass it on - User* u = this->Instance->FindNick(params[1]); + User* u = this->ServerInstance->FindNick(params[1]); if (u) Utils->DoOneToOne(prefix,"TIME",params,params[0]); } @@ -54,7 +54,7 @@ bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> ¶ms else if (params.size() == 3) { // a response to a previous TIME - User* u = this->Instance->FindNick(params[1]); + User* u = this->ServerInstance->FindNick(params[1]); if ((u) && (IS_LOCAL(u))) { time_t rawtime = atol(params[2].c_str()); diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index a89bd2574..03fd05a34 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -65,7 +65,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, cha if (Hook) BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); - Instance->Timers->AddTimer(new HandshakeTimer(Instance, this, &(Utils->LinkBlocks[0]), this->Utils, 1)); + ServerInstance->Timers->AddTimer(new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1)); /* Fix by Brain - inbound sockets need a timeout, too. 30 secs should be pleanty */ Utils->timeoutlist[this] = std::pair<std::string, int>("<unknown>", 30); @@ -115,7 +115,7 @@ bool TreeSocket::OnConnected() /* found who we're supposed to be connecting to, send the neccessary gubbins. */ if (this->GetHook()) - Instance->Timers->AddTimer(new HandshakeTimer(Instance, this, &(*x), this->Utils, 1)); + ServerInstance->Timers->AddTimer(new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1)); else this->SendCapabilities(); @@ -211,7 +211,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) if ((Current) && (Current != Utils->TreeRoot)) { Event rmode((char*)Current->GetName().c_str(), (Module*)Utils->Creator, "lost_server"); - rmode.Send(Instance); + rmode.Send(ServerInstance); std::deque<std::string> params; params.push_back(Current->GetName()); @@ -219,11 +219,11 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName()); if (Current->GetParent() == Utils->TreeRoot) { - this->Instance->SNO->WriteToSnoMask('l',"Server \002"+Current->GetName()+"\002 split: "+reason); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \002"+Current->GetName()+"\002 split: "+reason); } else { - this->Instance->SNO->WriteToSnoMask('l',"Server \002"+Current->GetName()+"\002 split from server \002"+Current->GetParent()->GetName()+"\002 with reason: "+reason); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \002"+Current->GetName()+"\002 split from server \002"+Current->GetParent()->GetName()+"\002 with reason: "+reason); } num_lost_servers = 0; num_lost_users = 0; @@ -232,10 +232,10 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) Current->Tidy(); Current->GetParent()->DelChild(Current); delete Current; - this->Instance->SNO->WriteToSnoMask('l',"Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers); + this->ServerInstance->SNO->WriteToSnoMask('l',"Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers); } else - Instance->Logs->Log("m_spanningtree",DEFAULT,"Squit from unknown server"); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Squit from unknown server"); } /** This function is called when we receive data from a remote diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index c1b45237d..8b3fbf2fb 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -31,7 +31,7 @@ void TreeSocket::WriteLine(std::string line) { - Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str()); line.append("\r\n"); this->Write(line); } @@ -42,7 +42,7 @@ bool TreeSocket::Error(std::deque<std::string> ¶ms) { if (params.size() < 1) return false; - this->Instance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); + this->ServerInstance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); /* we will return false to cause the socket to close. */ return false; } @@ -70,7 +70,7 @@ bool TreeSocket::ProcessLine(std::string &line) if (line.empty()) return true; - Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str()); this->Split(line.c_str(),params); @@ -160,16 +160,16 @@ bool TreeSocket::ProcessLine(std::string &line) if (params.size()) { time_t them = atoi(params[0].c_str()); - time_t delta = them - Instance->Time(); + time_t delta = them - ServerInstance->Time(); if ((delta < -600) || (delta > 600)) { - Instance->SNO->WriteToSnoMask('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs((long)delta)); + ServerInstance->SNO->WriteToSnoMask('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs((long)delta)); SendError("Your clocks are out by "+ConvToStr(abs((long)delta))+" seconds (this is more than five minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!"); return false; } else if ((delta < -30) || (delta > 30)) { - Instance->SNO->WriteToSnoMask('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta)); + ServerInstance->SNO->WriteToSnoMask('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta)); } } this->LinkState = CONNECTED; @@ -177,12 +177,12 @@ bool TreeSocket::ProcessLine(std::string &line) Utils->timeoutlist.erase(this); - Node = new TreeServer(this->Utils, this->Instance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + Node = new TreeServer(this->Utils, this->ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); if (Node->DuplicateID()) { this->SendError("Server ID "+InboundSID+" already exists on the network!"); - this->Instance->SNO->WriteToSnoMask('l',"Server \2"+InboundServerName+"\2 being introduced from \2" + prefix + "\2 denied, server ID already exists on the network. Closing link."); + this->ServerInstance->SNO->WriteToSnoMask('l',"Server \2"+InboundServerName+"\2 being introduced from \2" + prefix + "\2 denied, server ID already exists on the network. Closing link."); return false; } @@ -193,7 +193,7 @@ bool TreeSocket::ProcessLine(std::string &line) params.push_back("1"); params.push_back(InboundSID); params.push_back(":"+InboundDescription); - Utils->DoOneToAllButSender(Instance->Config->GetSID(),"SERVER",params,InboundServerName); + Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,InboundServerName); Node->bursting = true; this->DoBurst(Node); } @@ -250,7 +250,7 @@ bool TreeSocket::ProcessLine(std::string &line) */ std::string direction = prefix; - User *t = this->Instance->FindUUID(prefix); + User *t = this->ServerInstance->FindUUID(prefix); if (t) { direction = t->server; @@ -260,14 +260,14 @@ bool TreeSocket::ProcessLine(std::string &line) if ((!route_back_again) || (route_back_again->GetSocket() != this)) { if (route_back_again) - Instance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str()); return true; } /* Fix by brain: * When there is activity on the socket, reset the ping counter so * that we're not wasting bandwidth pinging an active server. */ - route_back_again->SetNextPingTime(Instance->Time() + Utils->PingFreq); + route_back_again->SetNextPingTime(ServerInstance->Time() + Utils->PingFreq); route_back_again->SetPingFlag(); } else @@ -343,7 +343,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else if (command == "MAP") { - User* user = Instance->FindNick(prefix); + User* user = ServerInstance->FindNick(prefix); if (user) { std::vector<std::string> p(params.begin(), params.end()); @@ -383,7 +383,7 @@ bool TreeSocket::ProcessLine(std::string &line) TreeServer *s = Utils->FindServer(prefix); if (s && s->bursting) { - Instance->SNO->WriteToSnoMask('l',"Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", prefix.c_str()); + ServerInstance->SNO->WriteToSnoMask('l',"Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", prefix.c_str()); s->FinishBurst(); } return this->LocalPong(prefix,params); @@ -433,8 +433,8 @@ bool TreeSocket::ProcessLine(std::string &line) if (params.size() == 3) { TreeServer* pf = Utils->FindServer(prefix); - User* user = this->Instance->FindNick(params[1]); - Channel* chan = this->Instance->FindChan(params[0]); + User* user = this->ServerInstance->FindNick(params[1]); + Channel* chan = this->ServerInstance->FindChan(params[0]); if (pf && user && chan) { if (!chan->ServerKickUser(user, params[2].c_str(), false, pf->GetName().c_str())) @@ -466,7 +466,7 @@ bool TreeSocket::ProcessLine(std::string &line) if (params.size() >= 2) { if (ServerSource) - Instance->Users->WriteMode(params[0].c_str(), WM_AND, "*** From %s: %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str()), params[1].c_str()); + ServerInstance->Users->WriteMode(params[0].c_str(), WM_AND, "*** From %s: %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str()), params[1].c_str()); } return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params); } @@ -474,7 +474,7 @@ bool TreeSocket::ProcessLine(std::string &line) { if (params.size() >= 2) { - Instance->SNO->WriteToSnoMask(*(params[0].c_str()), "From " + (ServerSource ? ServerSource->GetName().c_str() : prefix) + ": "+ params[1]); + ServerInstance->SNO->WriteToSnoMask(*(params[0].c_str()), "From " + (ServerSource ? ServerSource->GetName().c_str() : prefix) + ": "+ params[1]); return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params); } @@ -484,7 +484,7 @@ bool TreeSocket::ProcessLine(std::string &line) // Set prefix server as bursting if (!ServerSource) { - this->Instance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); + this->ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); return false; } @@ -495,7 +495,7 @@ bool TreeSocket::ProcessLine(std::string &line) { if (!ServerSource) { - this->Instance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); + this->ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); return false; } @@ -506,7 +506,7 @@ bool TreeSocket::ProcessLine(std::string &line) { return this->Encap(prefix, params); } - else if (command == "MODE" && !this->Instance->FindUUID(prefix)) // XXX we should check for no such serv? + else if (command == "MODE" && !this->ServerInstance->FindUUID(prefix)) // XXX we should check for no such serv? { // Server-prefix MODE. std::vector<std::string> modelist(params.begin(), params.end()); @@ -514,7 +514,7 @@ bool TreeSocket::ProcessLine(std::string &line) /* We don't support this for channel mode changes any more! */ if (params.size() >= 1) { - if (Instance->FindChan(params[0])) + if (ServerInstance->FindChan(params[0])) { this->SendError("Protocol violation by '"+(ServerSource ? ServerSource->GetName().c_str() : prefix)+"'! MODE for channel mode changes is not supported by the InspIRCd 1.2 protocol. You must use FMODE to preserve channel timestamps."); return false; @@ -522,7 +522,7 @@ bool TreeSocket::ProcessLine(std::string &line) } // Insert into the parser - this->Instance->SendMode(modelist, this->Instance->FakeClient); + this->ServerInstance->SendMode(modelist, this->ServerInstance->FakeClient); // Pass out to the network return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params); @@ -533,7 +533,7 @@ bool TreeSocket::ProcessLine(std::string &line) * Not a special s2s command. Emulate the user doing it. * This saves us having a huge ugly command parser again. */ - User *who = this->Instance->FindUUID(prefix); + User *who = this->ServerInstance->FindUUID(prefix); if (!who) { @@ -556,7 +556,7 @@ bool TreeSocket::ProcessLine(std::string &line) * On nick messages, check that the nick doesnt already exist here. * If it does, perform collision logic. */ - User* x = this->Instance->FindNickOnly(params[0]); + User* x = this->ServerInstance->FindNickOnly(params[0]); if ((x) && (x != who)) { int collideret = 0; @@ -577,7 +577,7 @@ bool TreeSocket::ProcessLine(std::string &line) // its a user std::vector<std::string> strparams(params.begin(), params.end()); - switch (this->Instance->CallCommandHandler(command.c_str(), strparams, who)) + switch (this->ServerInstance->CallCommandHandler(command.c_str(), strparams, who)) { case CMD_INVALID: /* @@ -650,7 +650,7 @@ void TreeSocket::OnClose() if (!quitserver.empty()) { Utils->Creator->RemoteMessage(NULL,"Connection to '\2%s\2' failed.",quitserver.c_str()); - time_t server_uptime = Instance->Time() - this->age; + time_t server_uptime = ServerInstance->Time() - this->age; if (server_uptime) Utils->Creator->RemoteMessage(NULL,"Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 14c4e2bb5..7b7a477f2 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -39,7 +39,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa if (params.size() < 10) { if (!params.empty()) - this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction ("+params[0]+" with only "+ + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction ("+params[0]+" with only "+ ConvToStr(params.size())+" of 10 or more parameters?)"); return true; } @@ -52,26 +52,26 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa if (!remoteserver) { - this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (Unknown server "+source+")"); + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (Unknown server "+source+")"); return true; } /* Check parameters for validity before introducing the client, discovered by dmb */ if (!age_t) { - this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (Invalid TS?)"); + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (Invalid TS?)"); return true; } /* check for collision */ - user_hash::iterator iter = this->Instance->Users->clientlist->find(params[2]); + user_hash::iterator iter = this->ServerInstance->Users->clientlist->find(params[2]); - if (iter != this->Instance->Users->clientlist->end()) + if (iter != this->ServerInstance->Users->clientlist->end()) { /* * Nick collision. */ - Instance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s", params[2].c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s", params[2].c_str()); int collide = this->DoCollision(iter->second, age_t, params[5], params[8], params[0]); if (collide == 2) @@ -87,19 +87,19 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa User* _new = NULL; try { - _new = new User(this->Instance, params[0]); + _new = new User(this->ServerInstance, params[0]); } catch (...) { SendError("Protocol violation - Duplicate UUID '" + params[0] + "' on introduction of new user"); return false; } - (*(this->Instance->Users->clientlist))[params[2]] = _new; + (*(this->ServerInstance->Users->clientlist))[params[2]] = _new; _new->SetFd(FD_MAGIC_NUMBER); _new->nick.assign(params[2], 0, MAXBUF); _new->host.assign(params[3], 0, 64); _new->dhost.assign(params[4], 0, 64); - _new->server = this->Instance->FindServerNamePtr(remoteserver->GetName().c_str()); + _new->server = this->ServerInstance->FindServerNamePtr(remoteserver->GetName().c_str()); _new->ident.assign(params[5], 0, MAXBUF); _new->fullname.assign(params[params.size() - 1], 0, MAXBUF); _new->registered = REG_ALL; @@ -118,7 +118,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa continue; /* For each mode thats set, increase counter */ - ModeHandler* mh = Instance->Modes->FindMode(*v, MODETYPE_USER); + ModeHandler* mh = ServerInstance->Modes->FindMode(*v, MODETYPE_USER); if (mh) { @@ -127,7 +127,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa if (paramptr < params.size() - 1) mh->OnModeChange(_new, _new, NULL, params[paramptr++], true); else - Instance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, expected a parameter for user mode '%c' but there aren't enough parameters in the command!", *v); + ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, expected a parameter for user mode '%c' but there aren't enough parameters in the command!", *v); } else mh->OnModeChange(_new, _new, NULL, empty, true); @@ -135,7 +135,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa mh->ChangeCount(1); } else - Instance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, unknown user mode '%c' in the mode string!", *v); + ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, unknown user mode '%c' in the mode string!", *v); } //_new->ProcessNoticeMasks(params[7].c_str()); @@ -151,21 +151,21 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa #endif _new->SetSockAddr(AF_INET, params[6].c_str(), 0); - Instance->Users->AddGlobalClone(_new); + ServerInstance->Users->AddGlobalClone(_new); bool dosend = true; - if ((this->Utils->quiet_bursts && remoteserver->bursting) || this->Instance->SilentULine(_new->server)) + if ((this->Utils->quiet_bursts && remoteserver->bursting) || this->ServerInstance->SilentULine(_new->server)) dosend = false; if (dosend) - this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server, _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str()); + this->ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server, _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str()); params[params.size() - 1] = ":" + params[params.size() - 1]; Utils->DoOneToAllButSender(source, "UID", params, source); - Instance->PI->Introduce(_new); - FOREACH_MOD_I(Instance,I_OnPostConnect,OnPostConnect(_new)); + ServerInstance->PI->Introduce(_new); + FOREACH_MOD_I(ServerInstance,I_OnPostConnect,OnPostConnect(_new)); return true; } diff --git a/src/modules/m_spanningtree/whois.cpp b/src/modules/m_spanningtree/whois.cpp index b38f25a38..05be18712 100644 --- a/src/modules/m_spanningtree/whois.cpp +++ b/src/modules/m_spanningtree/whois.cpp @@ -30,19 +30,19 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> ¶m { if (params.size() < 1) return true; - User* u = this->Instance->FindNick(prefix); + User* u = this->ServerInstance->FindNick(prefix); if (u) { // an incoming request if (params.size() == 1) { - User* x = this->Instance->FindNick(params[0]); + User* x = this->ServerInstance->FindNick(params[0]); if ((x) && (IS_LOCAL(x))) { char signon[MAXBUF]; char idle[MAXBUF]; snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon); - snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((long)((x->idle_lastmsg) - Instance->Time()))); + snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((long)((x->idle_lastmsg) - ServerInstance->Time()))); std::deque<std::string> par; par.push_back(prefix); par.push_back(signon); @@ -60,7 +60,7 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> ¶m else if (params.size() == 3) { std::string who_did_the_whois = params[0]; - User* who_to_send_to = this->Instance->FindNick(who_did_the_whois); + User* who_to_send_to = this->ServerInstance->FindNick(who_did_the_whois); if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) { // an incoming reply to a whois we sent out @@ -69,7 +69,7 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> ¶m unsigned long idle = atoi(params[2].c_str()); if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) { - do_whois(this->Instance, who_to_send_to, u, signon, idle, nick_whoised.c_str()); + do_whois(this->ServerInstance, who_to_send_to, u, signon, idle, nick_whoised.c_str()); } } else |