X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_info%2Fcmd_motd.cpp;h=c9a542f14f80220e91cbfeb9d1c75f0b68738f2d;hb=b4a174ee9c32d62ea6bf010e837e8c5b1c3d36a3;hp=cfb083eed2b08b10b0d1c0a6280232cd065cb03e;hpb=124c17e14134a4999afc1a5e981ab7c75b3694b9;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_info/cmd_motd.cpp b/src/coremods/core_info/cmd_motd.cpp index cfb083eed..c9a542f14 100644 --- a/src/coremods/core_info/cmd_motd.cpp +++ b/src/coremods/core_info/cmd_motd.cpp @@ -1,8 +1,12 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2014, 2018-2020 Sadie Powell + * Copyright (C) 2013-2016 Attila Molnar + * Copyright (C) 2012 Robby * Copyright (C) 2009-2010 Daniel De Graaf - * Copyright (C) 2007 Robin Burchell + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006, 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 @@ -29,9 +33,9 @@ CommandMotd::CommandMotd(Module* parent) /** Handle /MOTD */ -CmdResult CommandMotd::Handle (const std::vector& parameters, User *user) +CmdResult CommandMotd::Handle(User* user, const Params& parameters) { - if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName) + if (parameters.size() > 0 && !irc::equals(parameters[0], ServerInstance->Config->ServerName)) { // Give extra penalty if a non-oper queries the /MOTD of a remote server LocalUser* localuser = IS_LOCAL(user); @@ -44,18 +48,19 @@ CmdResult CommandMotd::Handle (const std::vector& parameters, User LocalUser* localuser = IS_LOCAL(user); if (localuser) tag = localuser->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()) + + const std::string motd_name = tag->getString("motd", "motd", 1); + ConfigFileCache::iterator motd = motds.find(motd_name); + if (motd == motds.end()) { user->WriteRemoteNumeric(ERR_NOMOTD, "Message of the day file is missing."); return CMD_SUCCESS; } - user->WriteRemoteNumeric(RPL_MOTDSTART, InspIRCd::Format("%s message of the day", ServerInstance->Config->ServerName.c_str())); + user->WriteRemoteNumeric(RPL_MOTDSTART, InspIRCd::Format("%s message of the day", ServerInstance->Config->GetServerName().c_str())); for (file_cache::iterator i = motd->second.begin(); i != motd->second.end(); i++) - user->WriteRemoteNumeric(RPL_MOTD, InspIRCd::Format("- %s", i->c_str())); + user->WriteRemoteNumeric(RPL_MOTD, InspIRCd::Format(" %s", i->c_str())); user->WriteRemoteNumeric(RPL_ENDOFMOTD, "End of message of the day.");