2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2020 Matt Schatz <genius3000@g3k.solutions>
5 * Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
6 * Copyright (C) 2013, 2017-2020 Sadie Powell <sadie@witchery.services>
7 * Copyright (C) 2013, 2016 Adam <Adam@anope.org>
8 * Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
9 * Copyright (C) 2012 Robby <robby@chatbelgie.be>
10 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
11 * Copyright (C) 2007-2009 Robin Burchell <robin+git@viroteck.net>
12 * Copyright (C) 2007-2009 Dennis Friis <peavey@inspircd.org>
13 * Copyright (C) 2005, 2007-2010 Craig Edwards <brain@inspircd.org>
15 * This file is part of InspIRCd. InspIRCd is free software: you can
16 * redistribute it and/or modify it under the terms of the GNU General Public
17 * License as published by the Free Software Foundation, version 2.
19 * This program is distributed in the hope that it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
34 #include "resolvers.h"
37 #include "treeserver.h"
39 #include "treesocket.h"
41 #include "translate.h"
43 ModuleSpanningTree::ModuleSpanningTree()
44 : Away::EventListener(this)
45 , Stats::EventListener(this)
46 , CTCTags::EventListener(this)
52 , broadcasteventprov(this, "event/server-broadcast")
53 , linkeventprov(this, "event/server-link")
54 , messageeventprov(this, "event/server-message")
55 , synceventprov(this, "event/server-sync")
64 SpanningTreeCommands::SpanningTreeCommands(ModuleSpanningTree* module)
65 : svsjoin(module), svspart(module), svsnick(module), metadata(module),
66 uid(module), opertype(module), fjoin(module), ijoin(module), resync(module),
67 fmode(module), ftopic(module), fhost(module), fident(module), fname(module),
68 away(module), addline(module), delline(module), encap(module), idle(module),
69 nick(module), ping(module), pong(module), save(module),
70 server(module), squit(module), snonotice(module),
71 endburst(module), sinfo(module), num(module)
77 void SetLocalUsersServer(Server* newserver)
79 // Does not change the server of quitting users because those are not in the list
81 ServerInstance->FakeClient->server = newserver;
82 const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
83 for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
84 (*i)->server = newserver;
87 void ResetMembershipIds()
89 // Set all membership ids to 0
90 const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
91 for (UserManager::LocalList::iterator i = list.begin(); i != list.end(); ++i)
94 for (User::ChanList::iterator j = user->chans.begin(); j != user->chans.end(); ++j)
100 void ModuleSpanningTree::init()
102 ServerInstance->SNO->EnableSnomask('l', "LINK");
104 ResetMembershipIds();
106 Utils = new SpanningTreeUtilities(this);
107 Utils->TreeRoot = new TreeServer;
109 ServerInstance->PI = &protocolinterface;
111 delete ServerInstance->FakeClient->server;
112 SetLocalUsersServer(Utils->TreeRoot);
115 void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
117 std::string Parent = Utils->TreeRoot->GetName();
118 if (Current->GetParent())
120 Parent = Current->GetParent()->GetName();
123 const TreeServer::ChildServers& children = Current->GetChildren();
124 for (TreeServer::ChildServers::const_iterator i = children.begin(); i != children.end(); ++i)
126 TreeServer* server = *i;
127 if ((server->Hidden) || ((Utils->HideULines) && (server->IsULine())))
131 ShowLinks(server, user, hops+1);
136 ShowLinks(server, user, hops+1);
139 /* Don't display the line if its a uline, hide ulines is on, and the user isn't an oper */
140 if ((Utils->HideULines) && (Current->IsULine()) && (!user->IsOper()))
142 /* Or if the server is hidden and they're not an oper */
143 else if ((Current->Hidden) && (!user->IsOper()))
146 user->WriteNumeric(RPL_LINKS, Current->GetName(),
147 (((Utils->FlatLinks) && (!user->IsOper())) ? ServerInstance->Config->ServerName : Parent),
148 InspIRCd::Format("%d %s", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc().c_str()));
151 void ModuleSpanningTree::HandleLinks(const CommandBase::Params& parameters, User* user)
153 ShowLinks(Utils->TreeRoot,user,0);
154 user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
157 void ModuleSpanningTree::ConnectServer(Autoconnect* a, bool on_timer)
161 for(unsigned int j=0; j < a->servers.size(); j++)
163 if (Utils->FindServer(a->servers[j]))
165 // found something in this block. Should the server fail,
166 // we want to start at the start of the list, not in the
167 // middle where we left off
172 if (on_timer && a->position >= 0)
174 if (!on_timer && a->position < 0)
178 while (a->position < (int)a->servers.size())
180 Link* x = Utils->FindLink(a->servers[a->position]);
183 ServerInstance->SNO->WriteToSnoMask('l', "AUTOCONNECT: Auto-connecting server \002%s\002", x->Name.c_str());
189 // Autoconnect chain has been fully iterated; start at the beginning on the
190 // next AutoConnectServers run
194 void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
196 if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map))
198 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
202 irc::sockets::sockaddrs sa;
203 if (x->IPAddr.find('/') != std::string::npos)
205 if (!irc::sockets::isunix(x->IPAddr) || !irc::sockets::untosa(x->IPAddr, sa))
207 // We don't use the family() != AF_UNSPEC check below for UNIX sockets as
208 // that results in a DNS lookup.
209 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s is not a UNIX socket!",
210 x->Name.c_str(), x->IPAddr.c_str());
216 // If this fails then the IP sa will be AF_UNSPEC.
217 irc::sockets::aptosa(x->IPAddr, x->Port, sa);
220 /* Do we already have an IP? If so, no need to resolve it. */
221 if (sa.family() != AF_UNSPEC)
223 // Create a TreeServer object that will start connecting immediately in the background
224 TreeSocket* newsocket = new TreeSocket(x, y, sa);
225 if (!newsocket->HasFd())
227 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",
228 x->Name.c_str(), newsocket->getError().c_str());
229 ServerInstance->GlobalCulls.AddItem(newsocket);
234 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: Hostname given and core_dns is not loaded, unable to resolve.", x->Name.c_str());
238 // Guess start_type from bindip aftype
239 DNS::QueryType start_type = DNS::QUERY_AAAA;
240 irc::sockets::sockaddrs bind;
241 if ((!x->Bind.empty()) && (irc::sockets::aptosa(x->Bind, 0, bind)))
243 if (bind.family() == AF_INET)
244 start_type = DNS::QUERY_A;
247 ServernameResolver* snr = new ServernameResolver(*DNS, x->IPAddr, x, start_type, y);
252 catch (DNS::Exception& e)
255 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(), e.GetReason().c_str());
256 ConnectServer(y, false);
261 void ModuleSpanningTree::AutoConnectServers(time_t curtime)
263 for (std::vector<reference<Autoconnect> >::iterator i = Utils->AutoconnectBlocks.begin(); i < Utils->AutoconnectBlocks.end(); ++i)
266 if (curtime >= x->NextConnectTime)
268 x->NextConnectTime = curtime + x->Period;
269 ConnectServer(x, true);
274 void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
276 SpanningTreeUtilities::TimeoutList::iterator i = Utils->timeoutlist.begin();
277 while (i != Utils->timeoutlist.end())
279 TreeSocket* s = i->first;
280 std::pair<std::string, unsigned int> p = i->second;
281 SpanningTreeUtilities::TimeoutList::iterator me = i;
283 if (s->GetLinkState() == DYING)
285 Utils->timeoutlist.erase(me);
288 else if (curtime > s->age + p.second)
290 ServerInstance->SNO->WriteToSnoMask('l',"CONNECT: Error connecting \002%s\002 (timeout of %u seconds)",p.first.c_str(),p.second);
291 Utils->timeoutlist.erase(me);
297 ModResult ModuleSpanningTree::HandleVersion(const CommandBase::Params& parameters, User* user)
299 // We've already confirmed that !parameters.empty(), so this is safe
300 TreeServer* found = Utils->FindServerMask(parameters[0]);
303 if (found == Utils->TreeRoot)
305 // Pass to default VERSION handler.
306 return MOD_RES_PASSTHRU;
309 // If an oper wants to see the version then show the full version string instead of the normal,
310 // but only if it is non-empty.
311 // If it's empty it might be that the server is still syncing (full version hasn't arrived yet)
312 // or the server is a 2.0 server and does not send a full version.
313 bool showfull = ((user->IsOper()) && (!found->GetFullVersion().empty()));
315 Numeric::Numeric numeric(RPL_VERSION);
316 irc::tokenstream tokens(showfull ? found->GetFullVersion() : found->GetVersion());
317 for (std::string token; tokens.GetTrailing(token); )
319 user->WriteNumeric(numeric);
323 user->WriteNumeric(ERR_NOSUCHSERVER, parameters[0], "No such server");
328 ModResult ModuleSpanningTree::HandleConnect(const CommandBase::Params& parameters, User* user)
330 for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++)
333 if (InspIRCd::Match(x->Name, parameters[0], ascii_case_insensitive_map))
335 if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map))
337 user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str()));
341 TreeServer* CheckDupe = Utils->FindServer(x->Name);
344 user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Connecting to server: \002%s\002 (%s:%d)", x->Name.c_str(), (x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()), x->Port));
350 user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002", x->Name.c_str(), CheckDupe->GetParent()->GetName().c_str()));
355 user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: No server matching \002%s\002 could be found in the config file.", parameters[0].c_str()));
359 void ModuleSpanningTree::OnUserInvite(User* source, User* dest, Channel* channel, time_t expiry, unsigned int notifyrank, CUList& notifyexcepts)
361 if (IS_LOCAL(source))
363 CmdBuilder params(source, "INVITE");
364 params.push(dest->uuid);
365 params.push(channel->name);
366 params.push_int(channel->age);
367 params.push(ConvToStr(expiry));
372 ModResult ModuleSpanningTree::OnPreTopicChange(User* user, Channel* chan, const std::string& topic)
374 // XXX: Deny topic changes if the current topic set time is the current time or is in the future because
375 // other servers will drop our FTOPIC. This restriction will be removed when the protocol is updated.
376 if ((chan->topicset >= ServerInstance->Time()) && (Utils->serverlist.size() > 1))
378 user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, "Retry topic change later");
381 return MOD_RES_PASSTHRU;
384 void ModuleSpanningTree::OnPostTopicChange(User* user, Channel* chan, const std::string &topic)
386 // Drop remote events on the floor.
390 CommandFTopic::Builder(user, chan).Broadcast();
393 void ModuleSpanningTree::OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details)
398 const char* message_type = (details.type == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE");
401 case MessageTarget::TYPE_USER:
403 User* d = target.Get<User>();
406 CmdBuilder params(user, message_type);
407 params.push_tags(details.tags_out);
408 params.push(d->uuid);
409 params.push_last(details.text);
414 case MessageTarget::TYPE_CHANNEL:
416 Utils->SendChannelMessage(user, target.Get<Channel>(), details.text, target.status, details.tags_out, details.exemptions, message_type);
419 case MessageTarget::TYPE_SERVER:
421 const std::string* serverglob = target.Get<std::string>();
422 CmdBuilder par(user, message_type);
423 par.push_tags(details.tags_out);
424 par.push(std::string("$") + *serverglob);
425 par.push_last(details.text);
432 void ModuleSpanningTree::OnUserPostTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details)
439 case MessageTarget::TYPE_USER:
441 User* d = target.Get<User>();
444 CmdBuilder params(user, "TAGMSG");
445 params.push_tags(details.tags_out);
446 params.push(d->uuid);
451 case MessageTarget::TYPE_CHANNEL:
453 Utils->SendChannelMessage(user, target.Get<Channel>(), "", target.status, details.tags_out, details.exemptions, "TAGMSG");
456 case MessageTarget::TYPE_SERVER:
458 const std::string* serverglob = target.Get<std::string>();
459 CmdBuilder par(user, "TAGMSG");
460 par.push_tags(details.tags_out);
461 par.push(std::string("$") + *serverglob);
468 void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
470 AutoConnectServers(curtime);
471 DoConnectTimeout(curtime);
474 void ModuleSpanningTree::OnUserConnect(LocalUser* user)
479 // Create the lazy ssl_cert metadata for this user if not already created.
481 sslapi->GetCertificate(user);
483 CommandUID::Builder(user).Broadcast();
486 CommandOpertype::Builder(user).Broadcast();
488 for(Extensible::ExtensibleStore::const_iterator i = user->GetExtList().begin(); i != user->GetExtList().end(); i++)
490 ExtensionItem* item = i->first;
491 std::string value = item->ToNetwork(user, i->second);
493 ServerInstance->PI->SendMetaData(user, item->name, value);
496 Utils->TreeRoot->UserCount++;
499 void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by_local, CUList& excepts)
501 // Only do this for local users
502 if (!IS_LOCAL(memb->user))
505 // Assign the current membership id to the new Membership and increase it
506 memb->id = currmembid++;
508 if (created_by_local)
510 CommandFJoin::Builder params(memb->chan);
517 CmdBuilder params(memb->user, "IJOIN");
518 params.push(memb->chan->name);
519 params.push_int(memb->id);
520 if (!memb->modes.empty())
522 params.push(ConvToStr(memb->chan->age));
523 params.push(memb->modes);
529 void ModuleSpanningTree::OnChangeHost(User* user, const std::string &newhost)
531 if (user->registered != REG_ALL || !IS_LOCAL(user))
534 CmdBuilder(user, "FHOST").push(newhost).Broadcast();
537 void ModuleSpanningTree::OnChangeRealName(User* user, const std::string& real)
539 if (user->registered != REG_ALL || !IS_LOCAL(user))
542 CmdBuilder(user, "FNAME").push_last(real).Broadcast();
545 void ModuleSpanningTree::OnChangeIdent(User* user, const std::string &ident)
547 if ((user->registered != REG_ALL) || (!IS_LOCAL(user)))
550 CmdBuilder(user, "FIDENT").push(ident).Broadcast();
553 void ModuleSpanningTree::OnUserPart(Membership* memb, std::string &partmessage, CUList& excepts)
555 if (IS_LOCAL(memb->user))
557 CmdBuilder params(memb->user, "PART");
558 params.push(memb->chan->name);
559 if (!partmessage.empty())
560 params.push_last(partmessage);
565 void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
569 if (oper_message != reason)
570 ServerInstance->PI->SendMetaData(user, "operquit", oper_message);
572 CmdBuilder(user, "QUIT").push_last(reason).Broadcast();
576 // Hide the message if one of the following is true:
577 // - User is being quit due to a netsplit and quietbursts is on
578 // - Server is a silent uline
579 TreeServer* server = TreeServer::Get(user);
580 bool hide = (((server->IsDead()) && (Utils->quiet_bursts)) || (server->IsSilentULine()));
583 ServerInstance->SNO->WriteToSnoMask('Q', "Client exiting on server %s: %s (%s) [%s]",
584 user->server->GetName().c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str());
588 // Regardless, update the UserCount
589 TreeServer::Get(user)->UserCount--;
592 void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick)
596 // The nick TS is updated by the core, we don't do it
597 CmdBuilder params(user, "NICK");
598 params.push(user->nick);
599 params.push(ConvToStr(user->age));
604 ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WARNING: Changed nick of remote user %s from %s to %s TS %lu by ourselves!", user->uuid.c_str(), oldnick.c_str(), user->nick.c_str(), (unsigned long) user->age);
608 void ModuleSpanningTree::OnUserKick(User* source, Membership* memb, const std::string &reason, CUList& excepts)
610 if ((!IS_LOCAL(source)) && (source != ServerInstance->FakeClient))
613 CmdBuilder params(source, "KICK");
614 params.push(memb->chan->name);
615 params.push(memb->user->uuid);
616 // If a remote user is being kicked by us then send the membership id in the kick too
617 if (!IS_LOCAL(memb->user))
618 params.push_int(memb->id);
619 params.push_last(reason);
623 void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter)
625 ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "OnPreRehash called with param %s", parameter.c_str());
627 // Send out to other servers
628 if (!parameter.empty() && parameter[0] != '-')
630 CmdBuilder params(user ? user : ServerInstance->FakeClient, "REHASH");
631 params.push(parameter);
632 params.Forward(user ? TreeServer::Get(user)->GetRoute() : NULL);
636 void ModuleSpanningTree::ReadConfig(ConfigStatus& status)
638 // Did this rehash change the description of this server?
639 const std::string& newdesc = ServerInstance->Config->ServerDesc;
640 if (newdesc != Utils->TreeRoot->GetDesc())
642 // Broadcast a SINFO desc message to let the network know about the new description. This is the description
643 // string that is sent in the SERVER message initially and shown for example in WHOIS.
644 // We don't need to update the field itself in the Server object - the core does that.
645 CommandSInfo::Builder(Utils->TreeRoot, "desc", newdesc).Broadcast();
648 // Re-read config stuff
651 Utils->ReadConfiguration();
653 catch (ModuleException& e)
655 // Refresh the IP cache anyway, so servers read before the error will be allowed to connect
656 Utils->RefreshIPCache();
657 // Always warn local opers with snomask +l, also warn globally (snomask +L) if the rehash was issued by a remote user
658 std::string msg = "Error in configuration: ";
659 msg.append(e.GetReason());
660 ServerInstance->SNO->WriteToSnoMask('l', msg);
661 if (status.srcuser && !IS_LOCAL(status.srcuser))
662 ServerInstance->PI->SendSNONotice('L', msg);
666 void ModuleSpanningTree::OnLoadModule(Module* mod)
670 data.append(mod->ModuleSourceFile);
671 Version v = mod->GetVersion();
672 if (!v.link_data.empty())
675 data.append(v.link_data);
677 ServerInstance->PI->SendMetaData("modules", data);
680 void ModuleSpanningTree::OnUnloadModule(Module* mod)
684 ServerInstance->PI->SendMetaData("modules", "-" + mod->ModuleSourceFile);
688 // We are being unloaded, inform modules about all servers splitting which cannot be done later when the servers are actually disconnected
689 const server_hash& servers = Utils->serverlist;
690 for (server_hash::const_iterator i = servers.begin(); i != servers.end(); ++i)
692 TreeServer* server = i->second;
693 if (!server->IsRoot())
694 FOREACH_MOD_CUSTOM(GetLinkEventProvider(), ServerProtocol::LinkEventListener, OnServerSplit, (server, false));
699 // Some other module is being unloaded. If it provides an IOHook we use, we must close that server connection now.
702 // Close all connections which use an IO hook provided by this module
703 const TreeServer::ChildServers& list = Utils->TreeRoot->GetChildren();
704 for (TreeServer::ChildServers::const_iterator i = list.begin(); i != list.end(); ++i)
706 TreeSocket* sock = (*i)->GetSocket();
707 if (sock->GetModHook(mod))
709 sock->SendError("SSL module unloaded");
711 // XXX: The list we're iterating is modified by TreeServer::SQuit() which is called by Close()
716 for (SpanningTreeUtilities::TimeoutList::const_iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); ++i)
718 TreeSocket* sock = i->first;
719 if (sock->GetModHook(mod))
724 void ModuleSpanningTree::OnOper(User* user, const std::string &opertype)
726 if (user->registered != REG_ALL || !IS_LOCAL(user))
729 // Note: The protocol does not allow direct umode +o;
730 // sending OPERTYPE infers +o modechange locally.
731 CommandOpertype::Builder(user).Broadcast();
734 void ModuleSpanningTree::OnAddLine(User* user, XLine *x)
736 if (!x->IsBurstable() || loopCall || (user && !IS_LOCAL(user)))
740 user = ServerInstance->FakeClient;
742 CommandAddLine::Builder(x, user).Broadcast();
745 void ModuleSpanningTree::OnDelLine(User* user, XLine *x)
747 if (!x->IsBurstable() || loopCall || (user && !IS_LOCAL(user)))
751 user = ServerInstance->FakeClient;
753 CmdBuilder params(user, "DELLINE");
754 params.push(x->type);
755 params.push(x->Displayable());
759 void ModuleSpanningTree::OnUserAway(User* user)
762 CommandAway::Builder(user).Broadcast();
765 void ModuleSpanningTree::OnUserBack(User* user)
768 CommandAway::Builder(user).Broadcast();
771 void ModuleSpanningTree::OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags)
773 if (processflags & ModeParser::MODE_LOCALONLY)
778 if (u->registered != REG_ALL)
781 CmdBuilder params(source, "MODE");
782 params.push(u->uuid);
783 params.push(ClientProtocol::Messages::Mode::ToModeLetters(modes));
784 params.push_raw(Translate::ModeChangeListToParams(modes.getlist()));
789 CmdBuilder params(source, "FMODE");
790 params.push(c->name);
791 params.push_int(c->age);
792 params.push(ClientProtocol::Messages::Mode::ToModeLetters(modes));
793 params.push_raw(Translate::ModeChangeListToParams(modes.getlist()));
798 void ModuleSpanningTree::OnShutdown(const std::string& reason)
800 const TreeServer::ChildServers& children = Utils->TreeRoot->GetChildren();
801 while (!children.empty())
802 children.front()->SQuit(reason, true);
805 CullResult ModuleSpanningTree::cull()
809 return this->Module::cull();
812 ModuleSpanningTree::~ModuleSpanningTree()
814 ServerInstance->PI = &ServerInstance->DefaultProtocolInterface;
816 Server* newsrv = new Server(ServerInstance->Config->GetSID(), ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc);
817 SetLocalUsersServer(newsrv);
822 Version ModuleSpanningTree::GetVersion()
824 return Version("Allows linking multiple servers together as part of one network.", VF_VENDOR);
827 /* It is IMPORTANT that m_spanningtree is the last module in the chain
828 * so that any activity it sees is FINAL, e.g. we arent going to send out
829 * a NICK message before m_cloaking has finished putting the +x on the user,
831 * Therefore, we set our priority to PRIORITY_LAST to make sure we end up at the END of
832 * the module call queue.
834 void ModuleSpanningTree::Prioritize()
836 ServerInstance->Modules->SetPriority(this, PRIORITY_LAST);
837 ServerInstance->Modules.SetPriority(this, I_OnPreTopicChange, PRIORITY_FIRST);
840 MODULE_INIT(ModuleSpanningTree)