]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/override_squit.cpp
Change all socketengine methods to be static
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / override_squit.cpp
index 829c698808ac0ed2960ffbcb91824307e90fdd23..2bae809273801153bac4348303e25bc2e38af4f1 100644 (file)
@@ -1,61 +1,58 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
  *
- * This program is free but copyrighted software; see
- *       the file COPYING for details.
+ * 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
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
-#include "xline.h"
-#include "../transport.h"
 
 #include "main.h"
 #include "utils.h"
 #include "treeserver.h"
 #include "treesocket.h"
 
-/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-
-int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user)
 {
        TreeServer* s = Utils->FindServerMask(parameters[0]);
        if (s)
        {
-               if (s == Utils->TreeRoot)
+               if (s->IsRoot())
                {
-                       user->WriteServ("NOTICE %s :*** SQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)",user->nick.c_str(),parameters[0].c_str());
-                       return 1;
+                       user->WriteNotice("*** SQUIT: Foolish mortal, you cannot make a server SQUIT itself! (" + parameters[0] + " matches local server name)");
+                       return MOD_RES_DENY;
                }
 
                TreeSocket* sock = s->GetSocket();
 
-               if (sock)
+               if (s->IsLocal())
                {
                        ServerInstance->SNO->WriteToSnoMask('l',"SQUIT: Server \002%s\002 removed from network by %s",parameters[0].c_str(),user->nick.c_str());
-                       sock->Squit(s,std::string("Server quit by ") + user->GetFullRealHost());
-                       ServerInstance->SE->DelFd(sock);
+                       sock->Squit(s,"Server quit by " + user->GetFullRealHost());
+                       SocketEngine::DelFd(sock);
                        sock->Close();
                }
                else
                {
-                       user->WriteServ("NOTICE %s :*** SQUIT may not be used to remove remote servers. Please use RSQUIT instead.",user->nick.c_str());
+                       user->WriteNotice("*** SQUIT may not be used to remove remote servers. Please use RSQUIT instead.");
                }
        }
        else
        {
-                user->WriteServ("NOTICE %s :*** SQUIT: The server \002%s\002 does not exist on the network.",user->nick.c_str(),parameters[0].c_str());
+                user->WriteNotice("*** SQUIT: The server \002" + parameters[0] + "\002 does not exist on the network.");
        }
-       return 1;
+       return MOD_RES_DENY;
 }
-