X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmode.h;h=501d04aae52f3f245d08110a93ac5c4a0f3e6ac0;hb=34b2dde776b332116d04cea356843b324ab099fb;hp=f1768f5597589df60a17657d23d0e14220f4cbd4;hpb=d3747f2943c403863bc31c8d3e9802ccc763f4d3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/mode.h b/include/mode.h index f1768f559..501d04aae 100644 --- a/include/mode.h +++ b/include/mode.h @@ -1,18 +1,27 @@ -/* +------------------------------------+ - * | 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) 2004-2006, 2008 Craig Edwards + * Copyright (C) 2007 Robin Burchell + * Copyright (C) 2007 Dennis Friis * - * 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 . */ -#ifndef __MODE_H -#define __MODE_H + +#ifndef MODE_H +#define MODE_H #include "ctables.h" @@ -90,7 +99,7 @@ enum ParamSpec * mode is expected to have a parameter, then this is * equivalent to returning MODEACTION_DENY. */ -class CoreExport ModeHandler : public classbase +class CoreExport ModeHandler : public ServiceProvider { protected: /** @@ -105,7 +114,7 @@ class CoreExport ModeHandler : public classbase /** * The mode letter you're implementing. */ - const char mode; + char mode; /** Mode prefix, or 0 */ @@ -135,22 +144,12 @@ class CoreExport ModeHandler : public classbase */ ModeType m_type; - /** Number of items with this mode set on them - */ - unsigned int count; - /** The prefix char needed on channel to use this mode, * only checked for channel modes */ int levelrequired; public: - /** Module that created this mode. NULL for core modes */ - ModuleRef creator; - /** Long-form name - */ - const std::string name; - /** * The constructor for ModeHandler initalizes the mode handler. * The constructor of any class you derive from ModeHandler should @@ -173,12 +172,6 @@ class CoreExport ModeHandler : public classbase * value for this mode prefix. */ inline char GetPrefix() const { return prefix; } - /** Get number of items with this mode set on them - */ - virtual unsigned int GetCount(); - /** Adjust usage count returned by GetCount - */ - virtual void ChangeCount(int modifier); /** * Get the 'value' of this modes prefix. * determines which to display when there are multiple. @@ -325,6 +318,16 @@ class CoreExport SimpleChannelModeHandler : public ModeHandler virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); }; +class CoreExport ParamChannelModeHandler : public ModeHandler +{ + public: + ParamChannelModeHandler(Module* Creator, const std::string& Name, char modeletter) + : ModeHandler(Creator, Name, modeletter, PARAM_SETONLY, MODETYPE_CHANNEL) {} + virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); + /** Validate the parameter - you may change the value to normalize it. Return true if it is valid. */ + virtual bool ParamValidate(std::string& parameter); +}; + /** * The ModeWatcher class can be used to alter the behaviour of a mode implemented * by the core or by another module. To use ModeWatcher, derive a class from it,