2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
5 * Copyright (C) 2013, 2017-2020 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2013, 2016 Adam <Adam@anope.org>
7 * Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
8 * Copyright (C) 2012 Robby <robby@chatbelgie.be>
9 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
10 * Copyright (C) 2007-2009 Robin Burchell <robin+git@viroteck.net>
11 * Copyright (C) 2007-2009 Dennis Friis <peavey@inspircd.org>
12 * Copyright (C) 2005, 2007-2010 Craig Edwards <brain@inspircd.org>
14 * This file is part of InspIRCd. InspIRCd is free software: you can
15 * redistribute it and/or modify it under the terms of the GNU General Public
16 * License as published by the Free Software Foundation, version 2.
18 * This program is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 #include "resolvers.h"
36 #include "treeserver.h"
38 #include "treesocket.h"
40 #include "translate.h"
42 ModuleSpanningTree::ModuleSpanningTree()
43 : Away::EventListener(this)
44 , Stats::EventListener(this)
45 , CTCTags::EventListener(this)
51 , broadcasteventprov(this, "event/server-broadcast")
52 , linkeventprov(this, "event/server-link")
53 , messageeventprov(this, "event/server-message")
54 , synceventprov(this, "event/server-sync")
63 SpanningTreeCommands::SpanningTreeCommands(ModuleSpanningTree* module)
64 : svsjoin(module), svspart(module), svsnick(module), metadata(module),
65 uid(module), opertype(module), fjoin(module), ijoin(module), resync(module),
66 fmode(module), ftopic(module), fhost(module), fident(module), fname(module),
67 away(module), addline(module), delline(module), encap(module), idle(module),
68 nick(module), ping(module), pong(module), save(module),
69 server(module), squit(module), snonotice(module),
70 endburst(module), sinfo(module), num(module)
76 void SetLocalUsersServer(Server* newserver)
78 // Does not change the server of quitting users because those are not in the list
80 ServerInstance->FakeClient->server = newserver;
81 const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
82 for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
83 (*i)->server = newserver;
86 void ResetMembershipIds()
88 // Set all membership ids to 0
89 const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
90 for (UserManager::LocalList::iterator i = list.begin(); i != list.end(); ++i)
93 for (User::ChanList::iterator j = user->chans.begin(); j != user->chans.end(); ++j)
99 void ModuleSpanningTree::init()
101 ServerInstance->SNO->EnableSnomask('l', "LINK");
103 ResetMembershipIds();
105 Utils = new SpanningTreeUtilities(this);
106 Utils->TreeRoot = new TreeServer;
108 ServerInstance->PI = &protocolinterface;
110 delete ServerInstance->FakeClient->server;
111 SetLocalUsersServer(Utils->TreeRoot);
114 void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
116 std::string Parent = Utils->TreeRoot->GetName();
117 if (Current->GetParent())
119 Parent = Current->GetParent()->GetName();
122 const TreeServer::ChildServers& children = Current->GetChildren();
123 for (TreeServer::ChildServers::const_iterator i = children.begin(); i != children.end(); ++i)
125 TreeServer* server = *i;
126 if ((server->Hidden) || ((Utils->HideULines) && (server->IsULine())))
130 ShowLinks(server, user, hops+1);
135 ShowLinks(server, user, hops+1);
138 /* Don't display the line if its a uline, hide ulines is on, and the user isnt an oper */
139 if ((Utils->HideULines) && (Current->IsULine()) && (!user->IsOper()))
141 /* Or if the server is hidden and they're not an oper */
142 else if ((Current->Hidden) && (!user->IsOper()))
145 user->WriteNumeric(RPL_LINKS, Current->GetName(),
146 (((Utils->FlatLinks) && (!user->IsOper())) ? ServerInstance->Config->ServerName : Parent),
147 InspIRCd::Format("%d %s", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc().c_str()));
150 void ModuleSpanningTree::HandleLinks(const CommandBase::Params& parameters, User* user)
152 ShowLinks(Utils->TreeRoot,user,0);
153 user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
156 void ModuleSpanningTree::ConnectServer(Autoconnect* a, bool on_timer)
160 for(unsigned int j=0; j < a->servers.size(); j++)
162 if (Utils->FindServer(a->servers[j]))
164 // found something in this block. Should the server fail,
165 // we want to start at the start of the list, not in the
166 // middle where we left off
171 if (on_timer && a->position >= 0)
173 if (!on_timer && a->position < 0)
177 while (a->position < (int)a->servers.size())
179 Link* x = Utils->FindLink(a->servers[a->position]);
182 ServerInstance->SNO->WriteToSnoMask('l', "AUTOCONNECT: Auto-connecting server \002%s\002", x->Name.c_str());
188 // Autoconnect chain has been fully iterated; start at the beginning on the
189 // next AutoConnectServers run
193 void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
195 if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map))
197 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
201 irc::sockets::sockaddrs sa;
202 if (x->IPAddr.find('/') != std::string::npos)
204 if (!irc::sockets::isunix(x->IPAddr) || !irc::sockets::untosa(x->IPAddr, sa))
206 // We don't use the family() != AF_UNSPEC check below for UNIX sockets as
207 // that results in a DNS lookup.
208 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s is not a UNIX socket!",
209 x->Name.c_str(), x->IPAddr.c_str());
215 // If this fails then the IP sa will be AF_UNSPEC.
216 irc::sockets::aptosa(x->IPAddr, x->Port, sa);
219 /* Do we already have an IP? If so, no need to resolve it. */
220 if (sa.family() != AF_UNSPEC)
222 // Create a TreeServer object that will start connecting immediately in the background
223 TreeSocket* newsocket = new TreeSocket(x, y, sa);
224 if (!newsocket->HasFd())
226 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",
227 x->Name.c_str(), newsocket->getError().c_str());
228 ServerInstance->GlobalCulls.AddItem(newsocket);
233 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());
237 // Guess start_type from bindip aftype
238 DNS::QueryType start_type = DNS::QUERY_AAAA;
239 irc::sockets::sockaddrs bind;
240 if ((!x->Bind.empty()) && (irc::sockets::aptosa(x->Bind, 0, bind)))
242 if (bind.family() == AF_INET)
243 start_type = DNS::QUERY_A;
246 ServernameResolver* snr = new ServernameResolver(*DNS, x->IPAddr, x, start_type, y);
251 catch (DNS::Exception& e)
254 ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.",x->Name.c_str(), e.GetReason().c_str());
255 ConnectServer(y, false);
260 void ModuleSpanningTree::AutoConnectServers(time_t curtime)
262 for (std::vector<reference<Autoconnect> >::iterator i = Utils->AutoconnectBlocks.begin(); i < Utils->AutoconnectBlocks.end(); ++i)
265 if (curtime >= x->NextConnectTime)
267 x->NextConnectTime = curtime + x->Period;
268 ConnectServer(x, true);
273 void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
275 SpanningTreeUtilities::TimeoutList::iterator i = Utils->timeoutlist.begin();
276 while (i != Utils->timeoutlist.end())
278 TreeSocket* s = i->first;
279 std::pair<std::string, unsigned int> p = i->second;
280 SpanningTreeUtilities::TimeoutList::iterator me = i;
282 if (s->GetLinkState() == DYING)
284 Utils->timeoutlist.erase(me);
287 else if (curtime > s->age + p.second)
289 ServerInstance->SNO->WriteToSnoMask('l',"CONNECT: Error connecting \002%s\002 (timeout of %u seconds)",p.first.c_str(),p.second);
290 Utils->timeoutlist.erase(me);
296 ModResult ModuleSpanningTree::HandleVersion(const CommandBase::Params& parameters, User* user)
298 // We've already confirmed that !parameters.empty(), so this is safe
299 TreeServer* found = Utils->FindServerMask(parameters[0]);
302 if (found == Utils->TreeRoot)
304 // Pass to default VERSION handler.
305 return MOD_RES_PASSTHRU;
308 // If an oper wants to see the version then show the full version string instead of the normal,
309 // but only if it is non-empty.
310 // If it's empty it might be that the server is still syncing (full version hasn't arrived yet)
311 // or the server is a 2.0 server and does not send a full version.
312 bool showfull = ((user->IsOper()) && (!found->GetFullVersion().empty()));
314 Numeric::Numeric numeric(RPL_VERSION);
315 irc::tokenstream tokens(showfull ? found->GetFullVersion() : found->GetVersion());
316 for (std::string token; tokens.GetTrailing(token); )
318 user->WriteNumeric(numeric);
322 user->WriteNumeric(ERR_NOSUCHSERVER, parameters[0], "No such server");
327 ModResult ModuleSpanningTree::HandleConnect(const CommandBase::Params& parameters, User* user)
329 for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++)
332 if (InspIRCd::Match(x->Name, parameters[0], ascii_case_insensitive_map))
334 if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map))
336 user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str()));
340 TreeServer* CheckDupe = Utils->FindServer(x->Name);
343 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));
349 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()));
354 user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: No server matching \002%s\002 could be found in the config file.", parameters[0].c_str()));
358 void ModuleSpanningTree::OnUserInvite(User* source, User* dest, Channel* channel, time_t expiry, unsigned int notifyrank, CUList& notifyexcepts)
360 if (IS_LOCAL(source))
362 CmdBuilder params(source, "INVITE");
363 params.push(dest->uuid);
364 params.push(channel->name);
365 params.push_int(channel->age);
366 params.push(ConvToStr(expiry));
371 ModResult ModuleSpanningTree::OnPreTopicChange(User* user, Channel* chan, const std::string& topic)
373 // XXX: Deny topic changes if the current topic set time is the current time or is in the future because
374 // other servers will drop our FTOPIC. This restriction will be removed when the protocol is updated.
375 if ((chan->topicset >= ServerInstance->Time()) && (Utils->serverlist.size() > 1))
377 user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, "Retry topic change later");
380 return MOD_RES_PASSTHRU;
383 void ModuleSpanningTree::OnPostTopicChange(User* user, Channel* chan, const std::string &topic)
385 // Drop remote events on the floor.
389 CommandFTopic::Builder(user, chan).Broadcast();
392 void ModuleSpanningTree::OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details)
397 const char* message_type = (details.type == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE");
400 case MessageTarget::TYPE_USER:
402 User* d = target.Get<User>();
405 CmdBuilder params(user, message_type);
406 params.push_tags(details.tags_out);
407 params.push(d->uuid);
408 params.push_last(details.text);
413 case MessageTarget::TYPE_CHANNEL:
415 Utils->SendChannelMessage(user, target.Get<Channel>(), details.text, target.status, details.tags_out, details.exemptions, message_type);
418 case MessageTarget::TYPE_SERVER:
420 const std::string* serverglob = target.Get<std::string>();
421 CmdBuilder par(user, message_type);
422 par.push_tags(details.tags_out);
423 par.push(*serverglob);
424 par.push_last(details.text);
431 void ModuleSpanningTree::OnUserPostTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details)
438 case MessageTarget::TYPE_USER:
440 User* d = target.Get<User>();
443 CmdBuilder params(user, "TAGMSG");
444 params.push_tags(details.tags_out);
445 params.push(d->uuid);
450 case MessageTarget::TYPE_CHANNEL:
452 Utils->SendChannelMessage(user, target.Get<Channel>(), "", target.status, details.tags_out, details.exemptions, "TAGMSG");
455 case MessageTarget::TYPE_SERVER:
457 const std::string* serverglob = target.Get<std::string>();
458 CmdBuilder par(user, "TAGMSG");
459 par.push_tags(details.tags_out);
460 par.push(*serverglob);
467 void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
469 AutoConnectServers(curtime);
470 DoConnectTimeout(curtime);
473 void ModuleSpanningTree::OnUserConnect(LocalUser* user)
478 // Create the lazy ssl_cert metadata for this user if not already created.
480 sslapi->GetCertificate(user);
482 CommandUID::Builder(user).Broadcast();
485 CommandOpertype::Builder(user).Broadcast();
487 for(Extensible::ExtensibleStore::const_iterator i = user->GetExtList().begin(); i != user->GetExtList().end(); i++)
489 ExtensionItem* item = i->first;
490 std::string value = item->ToNetwork(user, i->second);
492 ServerInstance->PI->SendMetaData(user, item->name, value);
495 Utils->TreeRoot->UserCount++;
498 void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by_local, CUList& excepts)
500 // Only do this for local users
501 if (!IS_LOCAL(memb->user))
504 // Assign the current membership id to the new Membership and increase it
505 memb->id = currmembid++;
507 if (created_by_local)
509 CommandFJoin::Builder params(memb->chan);
516 CmdBuilder params(memb->user, "IJOIN");
517 params.push(memb->chan->name);
518 params.push_int(memb->id);
519 if (!memb->modes.empty())
521 params.push(ConvToStr(memb->chan->age));
522 params.push(memb->modes);
528 void ModuleSpanningTree::OnChangeHost(User* user, const std::string &newhost)
530 if (user->registered != REG_ALL || !IS_LOCAL(user))
533 CmdBuilder(user, "FHOST").push(newhost).Broadcast();
536 void ModuleSpanningTree::OnChangeRealName(User* user, const std::string& real)
538 if (user->registered != REG_ALL || !IS_LOCAL(user))
541 CmdBuilder(user, "FNAME").push_last(real).Broadcast();
544 void ModuleSpanningTree::OnChangeIdent(User* user, const std::string &ident)
546 if ((user->registered != REG_ALL) || (!IS_LOCAL(user)))
549 CmdBuilder(user, "FIDENT").push(ident).Broadcast();
552 void ModuleSpanningTree::OnUserPart(Membership* memb, std::string &partmessage, CUList& excepts)
554 if (IS_LOCAL(memb->user))
556 CmdBuilder params(memb->user, "PART");
557 params.push(memb->chan->name);
558 if (!partmessage.empty())
559 params.push_last(partmessage);
564 void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
568 if (oper_message != reason)
569 ServerInstance->PI->SendMetaData(user, "operquit", oper_message);
571 CmdBuilder(user, "QUIT").push_last(reason).Broadcast();
575 // Hide the message if one of the following is true:
576 // - User is being quit due to a netsplit and quietbursts is on
577 // - Server is a silent uline
578 TreeServer* server = TreeServer::Get(user);
579 bool hide = (((server->IsDead()) && (Utils->quiet_bursts)) || (server->IsSilentULine()));
582 ServerInstance->SNO->WriteToSnoMask('Q', "Client exiting on server %s: %s (%s) [%s]",
583 user->server->GetName().c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str());
587 // Regardless, update the UserCount
588 TreeServer::Get(user)->UserCount--;
591 void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick)
595 // The nick TS is updated by the core, we don't do it
596 CmdBuilder params(user, "NICK");
597 params.push(user->nick);
598 params.push(ConvToStr(user->age));
603 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);
607 void ModuleSpanningTree::OnUserKick(User* source, Membership* memb, const std::string &reason, CUList& excepts)
609 if ((!IS_LOCAL(source)) && (source != ServerInstance->FakeClient))
612 CmdBuilder params(source, "KICK");
613 params.push(memb->chan->name);
614 params.push(memb->user->uuid);
615 // If a remote user is being kicked by us then send the membership id in the kick too
616 if (!IS_LOCAL(memb->user))
617 params.push_int(memb->id);
618 params.push_last(reason);
622 void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter)
624 ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "OnPreRehash called with param %s", parameter.c_str());
626 // Send out to other servers
627 if (!parameter.empty() && parameter[0] != '-')
629 CmdBuilder params(user ? user : ServerInstance->FakeClient, "REHASH");
630 params.push(parameter);
631 params.Forward(user ? TreeServer::Get(user)->GetRoute() : NULL);
635 void ModuleSpanningTree::ReadConfig(ConfigStatus& status)
637 // Did this rehash change the description of this server?
638 const std::string& newdesc = ServerInstance->Config->ServerDesc;
639 if (newdesc != Utils->TreeRoot->GetDesc())
641 // Broadcast a SINFO desc message to let the network know about the new description. This is the description
642 // string that is sent in the SERVER message initially and shown for example in WHOIS.
643 // We don't need to update the field itself in the Server object - the core does that.
644 CommandSInfo::Builder(Utils->TreeRoot, "desc", newdesc).Broadcast();
647 // Re-read config stuff
650 Utils->ReadConfiguration();
652 catch (ModuleException& e)
654 // Refresh the IP cache anyway, so servers read before the error will be allowed to connect
655 Utils->RefreshIPCache();
656 // Always warn local opers with snomask +l, also warn globally (snomask +L) if the rehash was issued by a remote user
657 std::string msg = "Error in configuration: ";
658 msg.append(e.GetReason());
659 ServerInstance->SNO->WriteToSnoMask('l', msg);
660 if (status.srcuser && !IS_LOCAL(status.srcuser))
661 ServerInstance->PI->SendSNONotice('L', msg);
665 void ModuleSpanningTree::OnLoadModule(Module* mod)
669 data.append(mod->ModuleSourceFile);
670 Version v = mod->GetVersion();
671 if (!v.link_data.empty())
674 data.append(v.link_data);
676 ServerInstance->PI->SendMetaData("modules", data);
679 void ModuleSpanningTree::OnUnloadModule(Module* mod)
683 ServerInstance->PI->SendMetaData("modules", "-" + mod->ModuleSourceFile);
687 // We are being unloaded, inform modules about all servers splitting which cannot be done later when the servers are actually disconnected
688 const server_hash& servers = Utils->serverlist;
689 for (server_hash::const_iterator i = servers.begin(); i != servers.end(); ++i)
691 TreeServer* server = i->second;
692 if (!server->IsRoot())
693 FOREACH_MOD_CUSTOM(GetLinkEventProvider(), ServerProtocol::LinkEventListener, OnServerSplit, (server, false));
698 // Some other module is being unloaded. If it provides an IOHook we use, we must close that server connection now.
701 // Close all connections which use an IO hook provided by this module
702 const TreeServer::ChildServers& list = Utils->TreeRoot->GetChildren();
703 for (TreeServer::ChildServers::const_iterator i = list.begin(); i != list.end(); ++i)
705 TreeSocket* sock = (*i)->GetSocket();
706 if (sock->GetModHook(mod))
708 sock->SendError("SSL module unloaded");
710 // XXX: The list we're iterating is modified by TreeServer::SQuit() which is called by Close()
715 for (SpanningTreeUtilities::TimeoutList::const_iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); ++i)
717 TreeSocket* sock = i->first;
718 if (sock->GetModHook(mod))
723 void ModuleSpanningTree::OnOper(User* user, const std::string &opertype)
725 if (user->registered != REG_ALL || !IS_LOCAL(user))
728 // Note: The protocol does not allow direct umode +o;
729 // sending OPERTYPE infers +o modechange locally.
730 CommandOpertype::Builder(user).Broadcast();
733 void ModuleSpanningTree::OnAddLine(User* user, XLine *x)
735 if (!x->IsBurstable() || loopCall || (user && !IS_LOCAL(user)))
739 user = ServerInstance->FakeClient;
741 CommandAddLine::Builder(x, user).Broadcast();
744 void ModuleSpanningTree::OnDelLine(User* user, XLine *x)
746 if (!x->IsBurstable() || loopCall || (user && !IS_LOCAL(user)))
750 user = ServerInstance->FakeClient;
752 CmdBuilder params(user, "DELLINE");
753 params.push(x->type);
754 params.push(x->Displayable());
758 void ModuleSpanningTree::OnUserAway(User* user)
761 CommandAway::Builder(user).Broadcast();
764 void ModuleSpanningTree::OnUserBack(User* user)
767 CommandAway::Builder(user).Broadcast();
770 void ModuleSpanningTree::OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags)
772 if (processflags & ModeParser::MODE_LOCALONLY)
777 if (u->registered != REG_ALL)
780 CmdBuilder params(source, "MODE");
781 params.push(u->uuid);
782 params.push(ClientProtocol::Messages::Mode::ToModeLetters(modes));
783 params.push_raw(Translate::ModeChangeListToParams(modes.getlist()));
788 CmdBuilder params(source, "FMODE");
789 params.push(c->name);
790 params.push_int(c->age);
791 params.push(ClientProtocol::Messages::Mode::ToModeLetters(modes));
792 params.push_raw(Translate::ModeChangeListToParams(modes.getlist()));
797 void ModuleSpanningTree::OnShutdown(const std::string& reason)
799 const TreeServer::ChildServers& children = Utils->TreeRoot->GetChildren();
800 while (!children.empty())
801 children.front()->SQuit(reason, true);
804 CullResult ModuleSpanningTree::cull()
808 return this->Module::cull();
811 ModuleSpanningTree::~ModuleSpanningTree()
813 ServerInstance->PI = &ServerInstance->DefaultProtocolInterface;
815 Server* newsrv = new Server(ServerInstance->Config->GetSID(), ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc);
816 SetLocalUsersServer(newsrv);
821 Version ModuleSpanningTree::GetVersion()
823 return Version("Allows servers to be linked", VF_VENDOR);
826 /* It is IMPORTANT that m_spanningtree is the last module in the chain
827 * so that any activity it sees is FINAL, e.g. we arent going to send out
828 * a NICK message before m_cloaking has finished putting the +x on the user,
830 * Therefore, we set our priority to PRIORITY_LAST to make sure we end up at the END of
831 * the module call queue.
833 void ModuleSpanningTree::Prioritize()
835 ServerInstance->Modules->SetPriority(this, PRIORITY_LAST);
836 ServerInstance->Modules.SetPriority(this, I_OnPreTopicChange, PRIORITY_FIRST);
839 MODULE_INIT(ModuleSpanningTree)