summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/treesocket2.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-04 11:45:24 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-04 11:45:24 +0000
commita3f89e772514aca9aa4615ebe1656010111fc455 (patch)
tree237a27dfb89a60a56faf0e790110fe90579b6d00 /src/modules/m_spanningtree/treesocket2.cpp
parentcea2a8c1684ddc686319e78ff1747e174f5424e7 (diff)
Split treesocket2 into various smaller files
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8814 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/treesocket2.cpp')
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp728
1 files changed, 0 insertions, 728 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index f668b9061..5673aae6a 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -50,734 +50,6 @@ bool TreeSocket::Error(std::deque<std::string> &params)
return false;
}
-bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.empty())
- return true;
-
- if (!this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
- {
- /* Pass it on, not for us */
- Utils->DoOneToOne(prefix, "MODULES", params, params[0]);
- return true;
- }
-
- char strbuf[MAXBUF];
- std::deque<std::string> par;
- par.push_back(prefix);
- par.push_back("");
-
- User* source = this->Instance->FindNick(prefix);
- if (!source)
- return true;
-
- std::vector<std::string> module_names = Instance->Modules->GetAllModuleNames(0);
-
- for (unsigned int i = 0; i < module_names.size(); i++)
- {
- Module* m = Instance->Modules->Find(module_names[i]);
- Version V = m->GetVersion();
- char modulename[MAXBUF];
- char flagstate[MAXBUF];
- *flagstate = 0;
- if (V.Flags & VF_STATIC)
- strlcat(flagstate,", static",MAXBUF);
- if (V.Flags & VF_VENDOR)
- strlcat(flagstate,", vendor",MAXBUF);
- if (V.Flags & VF_COMMON)
- strlcat(flagstate,", common",MAXBUF);
- if (V.Flags & VF_SERVICEPROVIDER)
- strlcat(flagstate,", service provider",MAXBUF);
- if (!flagstate[0])
- strcpy(flagstate," <no flags>");
- strlcpy(modulename,module_names[i].c_str(),256);
- if (*source->oper)
- {
- snprintf(strbuf, MAXBUF, "::%s 900 %s :0x%08lx %d.%d.%d.%d %s (%s)",Instance->Config->ServerName,source->nick,(unsigned long)m,
- V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
- }
- else
- {
- snprintf(strbuf, MAXBUF, "::%s 900 %s :%s",Instance->Config->ServerName,source->nick,ServerConfig::CleanFilename(modulename));
- }
- par[1] = strbuf;
- Utils->DoOneToOne(Instance->Config->GetSID(), "PUSH", par, source->server);
- }
- snprintf(strbuf, MAXBUF, "::%s 901 %s :End of MODULES list", Instance->Config->ServerName, source->nick);
- par[1] = strbuf;
- Utils->DoOneToOne(Instance->Config->GetSID(), "PUSH", par, source->server);
- return true;
-}
-
-/** remote MOTD. leet, huh? */
-bool TreeSocket::Motd(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() > 0)
- {
- if (this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
- {
- /* It's for our server */
- string_list results;
- User* source = this->Instance->FindNick(prefix);
-
- if (source)
- {
- std::deque<std::string> par;
- par.push_back(prefix);
- par.push_back("");
-
- if (!Instance->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);
- 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);
-
- for (unsigned int i = 0; i < Instance->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("::")+Instance->Config->ServerName+" 376 "+source->nick+" :End of message of the day.";
- Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server);
- }
- }
- else
- {
- /* Pass it on */
- User* source = this->Instance->FindNick(prefix);
- if (source)
- Utils->DoOneToOne(prefix, "MOTD", params, params[0]);
- }
- }
- return true;
-}
-
-/** remote ADMIN. leet, huh? */
-bool TreeSocket::Admin(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() > 0)
- {
- if (this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
- {
- /* It's for our server */
- string_list results;
- User* source = this->Instance->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);
- }
- }
- else
- {
- /* Pass it on */
- User* source = this->Instance->FindNick(prefix);
- if (source)
- Utils->DoOneToOne(prefix, "ADMIN", params, params[0]);
- }
- }
- return true;
-}
-
-bool TreeSocket::Stats(const std::string &prefix, std::deque<std::string> &params)
-{
- /* Get the reply to a STATS query if it matches this servername,
- * and send it back as a load of PUSH queries
- */
- if (params.size() > 1)
- {
- if (this->Instance->MatchText(this->Instance->Config->ServerName, params[1]))
- {
- /* It's for our server */
- string_list results;
- User* source = this->Instance->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);
- for (size_t i = 0; i < results.size(); i++)
- {
- par[1] = "::" + results[i];
- Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server);
- }
- }
- }
- else
- {
- /* Pass it on */
- User* source = this->Instance->FindNick(prefix);
- if (source)
- Utils->DoOneToOne(source->uuid, "STATS", params, params[1]);
- }
- }
- return true;
-}
-
-
-/** Because the core won't let users or even SERVERS set +o,
- * we use the OPERTYPE command to do this.
- */
-bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() != 1)
- return true;
- std::string opertype = params[0];
- User* u = this->Instance->FindNick(prefix);
- if (u)
- {
- if (!u->IsModeSet('o'))
- this->Instance->Users->all_opers.push_back(u);
- u->modes[UM_OPERATOR] = 1;
- strlcpy(u->oper,opertype.c_str(),NICKMAX-1);
- Utils->DoOneToAllButSender(u->nick,"OPERTYPE",params,u->server);
-
- TreeServer* remoteserver = Utils->FindServer(u->server);
- bool dosend = true;
-
- if (this->Utils->quiet_bursts)
- {
- /*
- * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
- * then do nothing. -- w00t
- */
- if (
- remoteserver->bursting ||
- this->Instance->SilentULine(this->Instance->FindServerNamePtr(u->server))
- )
- {
- dosend = false;
- }
- }
-
- 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,u->ident,u->host,irc::Spacify(opertype.c_str()));
- }
- return true;
-}
-
-/** Because Andy insists that services-compatible servers must
- * implement SVSNICK and SVSJOIN, that's exactly what we do :p
- */
-bool TreeSocket::ForceNick(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 3)
- return true;
-
- User* u = this->Instance->FindNick(params[0]);
-
- if (u)
- {
- Utils->DoOneToAllButSender(prefix,"SVSNICK",params,prefix);
-
- if (IS_LOCAL(u))
- {
- std::deque<std::string> par;
- par.push_back(params[1]);
-
- if (!u->ForceNickChange(params[1].c_str()))
- {
- /* buh. UID them */
- if (!u->ForceNickChange(u->uuid))
- {
- User::QuitUser(this->Instance, u, "Nickname collision");
- return true;
- }
- }
-
- u->age = atoi(params[2].c_str());
- }
- }
-
- return true;
-}
-
-bool TreeSocket::OperQuit(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
-
- User* u = this->Instance->FindNick(prefix);
-
- if (u)
- {
- u->SetOperQuit(params[0]);
- params[0] = ":" + params[0];
- Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix);
- }
- return true;
-}
-
-bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 2)
- return true;
-
- if (!this->Instance->IsChannel(params[1].c_str()))
- return true;
-
- User* u = this->Instance->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());
- Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix);
- }
- return true;
-}
-
-bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 2)
- return true;
-
- if (!this->Instance->IsChannel(params[1].c_str()))
- return true;
-
- User* u = this->Instance->FindNick(params[0]);
- Channel* c = this->Instance->FindChan(params[1]);
-
- if (u)
- {
- /* only part if it's local, otherwise just pass it on! */
- if (IS_LOCAL(u))
- if (!c->PartUser(u, "Services forced part"))
- delete c;
- Utils->DoOneToAllButSender(prefix,"SVSPART",params,prefix);
- }
-
- return true;
-}
-
-bool TreeSocket::RemoteRehash(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return false;
-
- std::string servermask = params[0];
-
- if (this->Instance->MatchText(this->Instance->Config->ServerName,servermask))
- {
- this->Instance->SNO->WriteToSnoMask('l',"Remote rehash initiated by \002"+prefix+"\002.");
- this->Instance->RehashServer();
- Utils->ReadConfiguration(true);
- InitializeDisabledCommands(Instance->Config->DisabledCommands, Instance);
- }
- Utils->DoOneToAllButSender(prefix,"REHASH",params,prefix);
- return true;
-}
-
-bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() != 2)
- return true;
-
- User* who = this->Instance->FindNick(params[0]);
-
- if (who)
- {
- /* Prepend kill source, if we don't have one */
- if (*(params[1].c_str()) != '[')
- {
- params[1] = "[" + prefix + "] Killed (" + params[1] +")";
- }
- std::string reason = params[1];
- params[1] = ":" + params[1];
- Utils->DoOneToAllButSender(prefix,"KILL",params,prefix);
- // 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, prefix.c_str(), reason.c_str());
- User::QuitUser(this->Instance,who,reason);
- }
- return true;
-}
-
-bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
-
- if (params.size() == 1)
- {
- TreeServer* ServerSource = Utils->FindServer(prefix);
- if (ServerSource)
- {
- ServerSource->SetPingFlag();
- timeval t;
- gettimeofday(&t, NULL);
- long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
- ServerSource->rtt = ts - ServerSource->LastPingMsec;
- }
- }
- else
- {
- std::string forwardto = params[1];
- if (forwardto == Instance->Config->GetSID() || forwardto == Instance->Config->ServerName)
- {
- /*
- * this is a PONG for us
- * if the prefix is a user, check theyre local, and if they are,
- * 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);
- if (u)
- {
- u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str());
- }
- }
- else
- {
- // not for us, pass it on :)
- Utils->DoOneToOne(prefix,"PONG",params,forwardto);
- }
- }
-
- return true;
-}
-
-bool TreeSocket::MetaData(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 2)
- return true;
- else if (params.size() < 3)
- params.push_back("");
- TreeServer* ServerSource = Utils->FindServer(prefix);
- if (ServerSource)
- {
- if (params[0] == "*")
- {
- FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_OTHER,NULL,params[1],params[2]));
- }
- else if (*(params[0].c_str()) == '#')
- {
- Channel* c = this->Instance->FindChan(params[0]);
- if (c)
- {
- FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_CHANNEL,c,params[1],params[2]));
- }
- }
- else if (*(params[0].c_str()) != '#')
- {
- User* u = this->Instance->FindNick(params[0]);
- if (u)
- {
- FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_USER,u,params[1],params[2]));
- }
- }
- }
-
- params[2] = ":" + params[2];
- Utils->DoOneToAllButSender(prefix,"METADATA",params,prefix);
- return true;
-}
-
-bool TreeSocket::ServerVersion(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
-
- TreeServer* ServerSource = Utils->FindServer(prefix);
-
- if (ServerSource)
- {
- ServerSource->SetVersion(params[0]);
- }
- params[0] = ":" + params[0];
- Utils->DoOneToAllButSender(prefix,"VERSION",params,prefix);
- return true;
-}
-
-bool TreeSocket::ChangeHost(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
- User* u = this->Instance->FindNick(prefix);
-
- if (u)
- {
- u->ChangeDisplayedHost(params[0].c_str());
- Utils->DoOneToAllButSender(prefix,"FHOST",params,u->server);
- }
- return true;
-}
-
-bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &params)
-{
- 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());
- return true;
- }
-
- XLineFactory* xlf = Instance->XLines->GetFactory(params[0]);
-
- if (!xlf)
- {
- this->Instance->SNO->WriteToSnoMask('x',"%s sent me an unknown ADDLINE type (%s).",prefix.c_str(),params[0].c_str());
- return true;
- }
-
- XLine* xl = xlf->Generate(Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
- xl->SetCreateTime(atoi(params[3].c_str()));
- if (Instance->XLines->AddLine(xl,NULL))
- {
- if (xl->duration)
- {
- this->Instance->SNO->WriteToSnoMask('x',"%s added %s%s on %s to expire on %s (%s).",prefix.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());
- }
- else
- {
- this->Instance->SNO->WriteToSnoMask('x',"%s added permanent %s%s on %s (%s).",prefix.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);
- Utils->DoOneToAllButSender(prefix, "ADDLINE", params, u ? u->server : prefix);
- TreeServer *remoteserver = Utils->FindServer(u ? u->server : prefix);
-
- if (!remoteserver->bursting)
- {
- Instance->XLines->ApplyLines();
- }
- }
- else
- delete xl;
-
- return true;
-}
-
-bool TreeSocket::DelLine(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 2)
- return true;
-
- User* user = Instance->FindNick(prefix);
-
- /* NOTE: No check needed on 'user', this function safely handles NULL */
- if (Instance->XLines->DelLine(params[0].c_str(), params[1], user))
- {
- this->Instance->SNO->WriteToSnoMask('x',"%s removed %s%s on %s.", prefix.c_str(),
- params[0].c_str(), params[0].length() == 1 ? "LINE" : "", params[1].c_str());
- Utils->DoOneToAllButSender(prefix,"DELLINE", params, prefix);
- }
- return true;
-}
-
-bool TreeSocket::ChangeName(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
- User* u = this->Instance->FindNick(prefix);
- if (u)
- {
- u->ChangeName(params[0].c_str());
- params[0] = ":" + params[0];
- Utils->DoOneToAllButSender(prefix,"FNAME",params,u->server);
- }
- return true;
-}
-
-bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
- User* u = this->Instance->FindNick(prefix);
- if (u)
- {
- // an incoming request
- if (params.size() == 1)
- {
- User* x = this->Instance->FindNick(params[0]);
- if ((x) && (IS_LOCAL(x)))
- {
- User* x = this->Instance->FindNick(params[0]);
- char signon[MAXBUF];
- char idle[MAXBUF];
- snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon);
- snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((x->idle_lastmsg) - Instance->Time(true)));
- std::deque<std::string> par;
- par.push_back(prefix);
- par.push_back(signon);
- par.push_back(idle);
- // ours, we're done, pass it BACK
- Utils->DoOneToOne(params[0], "IDLE", par, u->server);
- }
- else
- {
- // not ours pass it on
- if (x)
- Utils->DoOneToOne(prefix, "IDLE", params, x->server);
- }
- }
- 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);
- if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
- {
- // an incoming reply to a whois we sent out
- std::string nick_whoised = prefix;
- unsigned long signon = atoi(params[1].c_str());
- 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());
- }
- }
- else
- {
- // not ours, pass it on
- if (who_to_send_to)
- Utils->DoOneToOne(prefix, "IDLE", params, who_to_send_to->server);
- }
- }
- }
- return true;
-}
-
-bool TreeSocket::Push(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 2)
- return true;
- User* u = this->Instance->FindNick(params[0]);
- if (!u)
- return true;
- if (IS_LOCAL(u))
- {
- u->Write(params[1]);
- }
- else
- {
- // continue the raw onwards
- params[1] = ":" + params[1];
- Utils->DoOneToOne(prefix,"PUSH",params,u->server);
- }
- return true;
-}
-
-bool TreeSocket::HandleSetTime(const std::string &prefix, std::deque<std::string> &params)
-{
- if (!params.size() || !Utils->EnableTimeSync)
- return true;
-
- bool force = false;
-
- if ((params.size() == 2) && (params[1] == "FORCE"))
- force = true;
-
- time_t them = atoi(params[0].c_str());
- time_t us = Instance->Time(false);
-
- time_t diff = them - us;
-
- Utils->DoOneToAllButSender(prefix, "TIMESET", params, prefix);
-
- if (force || (them != us))
- {
- time_t old = Instance->SetTimeDelta(diff);
- Instance->Log(DEBUG, "TS (diff %d) from %s applied (old delta was %d)", diff, prefix.c_str(), old);
- }
-
- return true;
-}
-
-bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> &params)
-{
- // :source.server TIME remote.server sendernick
- // :remote.server TIME source.server sendernick TS
- if (params.size() == 2)
- {
- // someone querying our time?
- if (this->Instance->Config->ServerName == params[0] || this->Instance->Config->GetSID() == params[0])
- {
- User* u = this->Instance->FindNick(params[1]);
- if (u)
- {
- params.push_back(ConvToStr(Instance->Time(false)));
- params[0] = prefix;
- Utils->DoOneToOne(this->Instance->Config->GetSID(),"TIME",params,params[0]);
- }
- }
- else
- {
- // not us, pass it on
- User* u = this->Instance->FindNick(params[1]);
- if (u)
- Utils->DoOneToOne(prefix,"TIME",params,params[0]);
- }
- }
- else if (params.size() == 3)
- {
- // a response to a previous TIME
- User* u = this->Instance->FindNick(params[1]);
- if ((u) && (IS_LOCAL(u)))
- {
- time_t rawtime = atol(params[2].c_str());
- struct tm * timeinfo;
- timeinfo = localtime(&rawtime);
- char tms[26];
- snprintf(tms,26,"%s",asctime(timeinfo));
- tms[24] = 0;
- u->WriteServ("391 %s %s :%s",u->nick,prefix.c_str(),tms);
- }
- else
- {
- if (u)
- Utils->DoOneToOne(prefix,"TIME",params,u->server);
- }
- }
- return true;
-}
-
-bool TreeSocket::LocalPing(const std::string &prefix, std::deque<std::string> &params)
-{
- if (params.size() < 1)
- return true;
- if (params.size() == 1)
- {
- std::string stufftobounce = params[0];
- this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" PONG "+stufftobounce);
- return true;
- }
- else
- {
- std::string forwardto = params[1];
- if (forwardto == this->Instance->Config->ServerName || forwardto == this->Instance->Config->GetSID())
- {
- // this is a ping for us, send back PONG to the requesting server
- params[1] = params[0];
- params[0] = forwardto;
- Utils->DoOneToOne(forwardto,"PONG",params,params[1]);
- }
- else
- {
- // not for us, pass it on :)
- Utils->DoOneToOne(prefix,"PING",params,forwardto);
- }
- return true;
- }
-}
-
/** TODO: This creates a total mess of output and needs to really use irc::modestacker.
*/
bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string> &params)