X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_motd.cpp;h=9ed5ff188079fa1a86e3bc4737e128470c471425;hb=748b3a0d89e7ecc9a766471b79fb78f63a5ca2bb;hp=b48c1c951a87c0ad5986cb545e74ebd8086e8314;hpb=f2256deeefe9a9f57f6f6b902604c01138ad16cc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_motd.cpp b/src/commands/cmd_motd.cpp index b48c1c951..9ed5ff188 100644 --- a/src/commands/cmd_motd.cpp +++ b/src/commands/cmd_motd.cpp @@ -1,16 +1,23 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2007 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" /** Handle /MOTD. These command handlers can be reloaded by the core, @@ -44,9 +51,19 @@ class CommandMotd : public Command CmdResult CommandMotd::Handle (const std::vector& parameters, User *user) { if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName) + { + // Give extra penalty if a non-oper queries the /MOTD of a remote server + LocalUser* localuser = IS_LOCAL(user); + if ((localuser) && (!IS_OPER(user))) + localuser->CommandFloodPenalty += 2000; return CMD_SUCCESS; + } - ConfigFileCache::iterator motd = ServerInstance->Config->Files.find("motd"); + ConfigTag* tag = ServerInstance->Config->EmptyTag; + if (IS_LOCAL(user)) + tag = user->GetClass()->config; + std::string motd_name = tag->getString("motd", "motd"); + ConfigFileCache::iterator motd = ServerInstance->Config->Files.find(motd_name); if (motd == ServerInstance->Config->Files.end()) { user->SendText(":%s %03d %s :Message of the day file is missing.", @@ -58,7 +75,7 @@ CmdResult CommandMotd::Handle (const std::vector& parameters, User RPL_MOTDSTART, user->nick.c_str(), ServerInstance->Config->ServerName.c_str()); for (file_cache::iterator i = motd->second.begin(); i != motd->second.end(); i++) - user->SendText(":%s %03d %s :- %s", ServerInstance->Config->ServerName.c_str(), RPL_MOTD, user->nick.c_str(),i->c_str()); + user->SendText(":%s %03d %s :- %s", ServerInstance->Config->ServerName.c_str(), RPL_MOTD, user->nick.c_str(), i->c_str()); user->SendText(":%s %03d %s :End of message of the day.", ServerInstance->Config->ServerName.c_str(), RPL_ENDOFMOTD, user->nick.c_str());