- RemoteMessage(user, "NOTICE %s :*** CONNECT: No server matching \002%s\002 could be found in the config file.",user->nick,parameters[0]);
- return 1;
-}
-
-void ModuleSpanningTree::BroadcastTimeSync()
-{
- if (Utils->MasterTime)
- {
- std::deque<std::string> params;
- params.push_back(ConvToStr(ServerInstance->Time(false)));
- params.push_back("FORCE");
- Utils->DoOneToMany(Utils->TreeRoot->GetName(), "TIMESET", params);
- }
-}
-
-int ModuleSpanningTree::OnStats(char statschar, userrec* user, string_list &results)
-{
- if ((statschar == 'c') || (statschar == 'n'))
- {
- for (unsigned int i = 0; i < Utils->LinkBlocks.size(); i++)
- {
- results.push_back(std::string(ServerInstance->Config->ServerName)+" 213 "+user->nick+" "+statschar+" *@"+(Utils->LinkBlocks[i].HiddenFromStats ? "<hidden>" : Utils->LinkBlocks[i].IPAddr)+" * "+Utils->LinkBlocks[i].Name.c_str()+" "+ConvToStr(Utils->LinkBlocks[i].Port)+" "+(Utils->LinkBlocks[i].Hook.empty() ? "plaintext" : Utils->LinkBlocks[i].Hook)+" "+(Utils->LinkBlocks[i].AutoConnect ? 'a' : '-')+'s');
- if (statschar == 'c')
- results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+Utils->LinkBlocks[i].Name.c_str());
- }
- results.push_back(std::string(ServerInstance->Config->ServerName)+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
- ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",(!strcmp(user->server,ServerInstance->Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick,user->ident,user->host);
- return 1;
- }
-
- if (statschar == 'p')
- {
- /* show all server ports, after showing client ports. -- w00t */
-
- for (unsigned int i = 0; i < Utils->Bindings.size(); i++)
- {
- std::string ip = Utils->Bindings[i]->IP;
- if (ip.empty())
- ip = "*";
-
- std::string transport("plaintext");
- if (Utils->Bindings[i]->GetHook())
- transport = InspSocketNameRequest(this, Utils->Bindings[i]->GetHook()).Send();
-
- results.push_back(ConvToStr(ServerInstance->Config->ServerName) + " 249 "+user->nick+" :" + ip + ":" + ConvToStr(Utils->Bindings[i]->port)+
- " (server, " + transport + ")");
- }
- }
- return 0;
-}
-
-int ModuleSpanningTree::OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
-{
- /* If the command doesnt appear to be valid, we dont want to mess with it. */
- if (!validated)
- return 0;
-
- if (command == "CONNECT")
- {
- return this->HandleConnect(parameters,pcnt,user);
- }
- else if (command == "STATS")
- {
- return this->HandleStats(parameters,pcnt,user);
- }
- else if (command == "MOTD")
- {
- return this->HandleMotd(parameters,pcnt,user);
- }
- else if (command == "ADMIN")
- {
- return this->HandleAdmin(parameters,pcnt,user);
- }
- else if (command == "SQUIT")
- {
- return this->HandleSquit(parameters,pcnt,user);
- }
- else if (command == "MAP")
- {
- this->HandleMap(parameters,pcnt,user);
- return 1;
- }
- else if ((command == "TIME") && (pcnt > 0))
- {
- return this->HandleTime(parameters,pcnt,user);
- }
- else if (command == "LUSERS")
- {
- this->HandleLusers(parameters,pcnt,user);
- return 1;
- }
- else if (command == "LINKS")
- {
- this->HandleLinks(parameters,pcnt,user);
- return 1;
- }
- else if (command == "WHOIS")
- {
- if (pcnt > 1)
- {
- // remote whois
- return this->HandleRemoteWhois(parameters,pcnt,user);
- }
- }
- else if ((command == "VERSION") && (pcnt > 0))
- {
- this->HandleVersion(parameters,pcnt,user);
- return 1;
- }
- else if ((command == "MODULES") && (pcnt > 0))
- {
- return this->HandleModules(parameters,pcnt,user);
- }
- return 0;