X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_abbreviation.cpp;h=32878614d40750e34434633477e49e2106053930;hb=e950f568d0f571e9475aa38177486468714de4d3;hp=f29ad1b58475a96f3650a0828fb321487cb58c70;hpb=27e0df3719ce1d6153f8f332d23631044b3c9a79;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index f29ad1b58..32878614d 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -1,43 +1,42 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * Copyright (C) 2008 Craig Edwards * - * 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 the ability to abbreviate commands a-la BBC BASIC keywords. */ +#include "inspircd.h" class ModuleAbbreviation : public Module { - public: - - ModuleAbbreviation(InspIRCd* Me) - : Module(Me) + void Prioritize() { - Me->Modules->Attach(I_OnPreCommand, this); - /* Must do this first */ - Me->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); + ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { - return Version("$Id$",VF_VENDOR,API_VERSION); + return Version("Provides the ability to abbreviate commands a-la BBC BASIC keywords.",VF_VENDOR); } - virtual int OnPreCommand(std::string &command, std::vector ¶meters, User *user, bool validated, const std::string &original_line) + ModResult OnPreCommand(std::string &command, std::vector ¶meters, LocalUser *user, bool validated, const std::string &original_line) CXX11_OVERRIDE { /* Command is already validated, has a length of 0, or last character is not a . */ if (validated || command.empty() || *command.rbegin() != '.') - return 0; + return MOD_RES_PASSTHRU; /* Whack the . off the end */ command.erase(command.end() - 1); @@ -56,7 +55,7 @@ class ModuleAbbreviation : public Module if (matchlist.length() > 450) { user->WriteNumeric(420, "%s :Ambiguous abbreviation and too many possible matches.", user->nick.c_str()); - return true; + return MOD_RES_DENY; } if (!foundmatch) @@ -74,7 +73,7 @@ class ModuleAbbreviation : public Module if (!matchlist.empty()) { user->WriteNumeric(420, "%s :Ambiguous abbreviation, posssible matches: %s%s", user->nick.c_str(), foundcommand.c_str(), matchlist.c_str()); - return true; + return MOD_RES_DENY; } if (foundcommand.empty()) @@ -87,7 +86,7 @@ class ModuleAbbreviation : public Module command = foundcommand; } - return false; + return MOD_RES_PASSTHRU; } };