X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fsvsjoin.cpp;h=416502369c7856312afe3d34fc43283a15b21c8f;hb=ed08638c1afa2742f0ebc3006dd0f1054020f7d4;hp=4fdc05dea45c4bf6f65ad612caf4c49f37dd5a15;hpb=7e843c22e16c81054bad18073d24fe1a07026431;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index 4fdc05dea..416502369 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -1,16 +1,23 @@ -/* +------------------------------------+ - * | 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) 2010 Daniel De Graaf + * Copyright (C) 2008 Robin Burchell * - * 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 . */ + #include "inspircd.h" #include "socket.h" #include "xline.h" @@ -19,24 +26,29 @@ #include "main.h" #include "utils.h" #include "treeserver.h" -#include "treesocket.h" +#include "commands.h" -/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ - -bool TreeSocket::ServiceJoin(const std::string &prefix, parameterlist ¶ms) +CmdResult CommandSVSJoin::Handle(const std::vector& parameters, User *user) { - if (params.size() < 2) - return true; + // Check for valid channel name + if (!ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax)) + return CMD_FAILURE; - User* u = ServerInstance->FindNick(params[0]); + // Check target exists + User* u = ServerInstance->FindUUID(parameters[0]); + if (!u) + return CMD_FAILURE; - if (u) - { - /* only join if it's local, otherwise just pass it on! */ - if (IS_LOCAL(u)) - Channel::JoinUser(u, params[1].c_str(), false, "", false, ServerInstance->Time()); - Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix); - } - return true; + /* only join if it's local, otherwise just pass it on! */ + if (IS_LOCAL(u)) + Channel::JoinUser(u, parameters[1].c_str(), false, "", false, ServerInstance->Time()); + return CMD_SUCCESS; } +RouteDescriptor CommandSVSJoin::GetRouting(User* user, const std::vector& parameters) +{ + User* u = ServerInstance->FindUUID(parameters[0]); + if (u) + return ROUTE_OPT_UCAST(u->server); + return ROUTE_LOCALONLY; +}