X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_vhost.cpp;h=31c504af8df7084a4ec713af73d631991eeb6dbd;hb=68211809ee3111bdc9609fbd46dc3c875fbb5ea6;hp=18c2a1eb059fbded40b417dccd88fe47c5576a14;hpb=a59d08fffd3dc8a9850ce34c9928fb6382b9b37f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 18c2a1eb0..31c504af8 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -1,16 +1,25 @@ -/* +------------------------------------+ - * | 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) 2009 Daniel De Graaf + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006-2007 Craig Edwards + * Copyright (C) 2006 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" /* $ModDesc: Provides masking of user hostnames via traditional /VHOST command */ @@ -27,11 +36,10 @@ class CommandVhost : public Command CmdResult Handle (const std::vector ¶meters, User *user) { - for (int index = 0;; index++) + ConfigTagList tags = ServerInstance->Config->ConfTags("vhost"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("vhost", index); - if (!tag) - break; + ConfigTag* tag = i->second; std::string mask = tag->getString("host"); std::string username = tag->getString("user"); std::string pass = tag->getString("pass"); @@ -48,7 +56,7 @@ class CommandVhost : public Command } } - user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password."); + user->WriteServ("NOTICE "+user->nick+" :Invalid username or password."); return CMD_FAILURE; } }; @@ -61,7 +69,11 @@ class ModuleVHost : public Module public: ModuleVHost() : cmd(this) { - ServerInstance->AddCommand(&cmd); + } + + void init() + { + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleVHost()