X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fmain.cpp;h=5ed66b80541f299cbf3d3f630a7149b2cc003fed;hb=a5cb6b99fb781d4b8e63f98d0644e02f75e54608;hp=3e992f39f90f043355c76437e2e778d74df10dd8;hpb=cf5d382b822cecd54fdbc77e4c1c4de8a8aa3c35;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 3e992f39f..5ed66b805 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -1,11 +1,15 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2019 linuxdaemon + * Copyright (C) 2013, 2017-2020 Sadie Powell + * Copyright (C) 2013, 2016 Adam + * Copyright (C) 2012-2016, 2018 Attila Molnar + * Copyright (C) 2012 Robby * Copyright (C) 2009-2010 Daniel De Graaf - * Copyright (C) 2007-2009 Craig Edwards - * Copyright (C) 2007-2008 Robin Burchell - * Copyright (C) 2008 Thomas Stagner - * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2007-2009 Robin Burchell + * Copyright (C) 2007-2009 Dennis Friis + * Copyright (C) 2005, 2007-2010 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -49,8 +53,9 @@ ModuleSpanningTree::ModuleSpanningTree() , messageeventprov(this, "event/server-message") , synceventprov(this, "event/server-sync") , sslapi(this) + , servicetag(this) , DNS(this, "DNS") - , tagevprov(this, "event/messagetag") + , tagevprov(this) , loopCall(false) { } @@ -210,17 +215,13 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) // If this fails then the IP sa will be AF_UNSPEC. irc::sockets::aptosa(x->IPAddr, x->Port, sa); } - + /* Do we already have an IP? If so, no need to resolve it. */ if (sa.family() != AF_UNSPEC) { // Create a TreeServer object that will start connecting immediately in the background TreeSocket* newsocket = new TreeSocket(x, y, sa); - if (newsocket->GetFd() > -1) - { - /* Handled automatically on success */ - } - else + if (!newsocket->HasFd()) { ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.", x->Name.c_str(), newsocket->getError().c_str()); @@ -419,7 +420,7 @@ void ModuleSpanningTree::OnUserPostMessage(User* user, const MessageTarget& targ const std::string* serverglob = target.Get(); CmdBuilder par(user, message_type); par.push_tags(details.tags_out); - par.push(*serverglob); + par.push(std::string("$") + *serverglob); par.push_last(details.text); par.Broadcast(); break; @@ -456,7 +457,7 @@ void ModuleSpanningTree::OnUserPostTagMessage(User* user, const MessageTarget& t const std::string* serverglob = target.Get(); CmdBuilder par(user, "TAGMSG"); par.push_tags(details.tags_out); - par.push(*serverglob); + par.push(std::string("$") + *serverglob); par.Broadcast(); break; } @@ -793,6 +794,13 @@ void ModuleSpanningTree::OnMode(User* source, User* u, Channel* c, const Modes:: } } +void ModuleSpanningTree::OnShutdown(const std::string& reason) +{ + const TreeServer::ChildServers& children = Utils->TreeRoot->GetChildren(); + while (!children.empty()) + children.front()->SQuit(reason, true); +} + CullResult ModuleSpanningTree::cull() { if (Utils)