X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmode.h;h=c8a315cce85df14b129a002a472061fce56f055c;hb=e6d000042ea75d4e0485bec9564b47163a3ca414;hp=b3c580e6cecf960148b54f45e4fb34ed48ca31d5;hpb=696ee9ff66bb94be2229bfa9c3dc288affc38a72;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/mode.h b/include/mode.h index b3c580e6c..c8a315cce 100644 --- a/include/mode.h +++ b/include/mode.h @@ -30,7 +30,9 @@ class InspIRCd; */ enum ModeType { + /** User mode */ MODETYPE_USER = 0, + /** Channel mode */ MODETYPE_CHANNEL = 1 }; @@ -64,8 +66,11 @@ enum ModeMasks */ enum PrefixModeValue { + /* +v */ VOICE_VALUE = 10000, + /* +h */ HALFOP_VALUE = 20000, + /* +o */ OP_VALUE = 30000 }; @@ -90,9 +95,12 @@ typedef std::pair ModePair; * mode is expected to have a parameter, then this is * equivalent to returning MODEACTION_DENY. */ -class ModeHandler : public Extensible +class CoreExport ModeHandler : public Extensible { protected: + /** + * Creator/owner pointer + */ InspIRCd* ServerInstance; /** * The mode letter you're implementing. @@ -132,6 +140,10 @@ class ModeHandler : public Extensible */ char prefix; + /** Number of items with this mode set on them + */ + unsigned int count; + public: /** * The constructor for ModeHandler initalizes the mode handler. @@ -164,6 +176,12 @@ class ModeHandler : public Extensible * value for this mode prefix. */ char GetPrefix(); + /** 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. @@ -210,9 +228,17 @@ class ModeHandler : public Extensible * If your mode is a listmode, then this method will be called for displaying an item list, e.g. on MODE #channel +modechar * without any parameter or other modes in the command. * @param user The user issuing the command - * @parameter channel The channel they're requesting an item list of (e.g. a banlist, or an exception list etc) + * @param channel The channel they're requesting an item list of (e.g. a banlist, or an exception list etc) */ virtual void DisplayList(userrec* user, chanrec* channel); + + /** + * If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric) + * @param user The user issuing the command + * @param channel The channel tehy're requesting an item list of (e.g. a banlist, or an exception list etc) + */ + virtual void DisplayEmptyList(userrec* user, chanrec* channel); + /** * If your mode needs special action during a server sync to determine which side wins when comparing timestamps, * override this function and use it to return true or false. The default implementation just returns true if @@ -269,9 +295,12 @@ class ModeHandler : public Extensible * and attach it to the mode using Server::AddModeWatcher and Server::DelModeWatcher. * A ModeWatcher will be called both before and after the mode change. */ -class ModeWatcher : public Extensible +class CoreExport ModeWatcher : public Extensible { protected: + /** + * Creator/owner pointer + */ InspIRCd* ServerInstance; /** * The mode letter this class is watching @@ -337,9 +366,12 @@ typedef std::vector::iterator ModeWatchIter; * parses client to server MODE strings for user and channel modes, and performs * processing for the 004 mode list numeric, amongst other things. */ -class ModeParser : public classbase +class CoreExport ModeParser : public classbase { private: + /** + * Creator/owner pointer + */ InspIRCd* ServerInstance; /** Mode handlers for each mode, to access a handler subtract * 65 from the ascii value of the mode letter. @@ -474,7 +506,7 @@ class ModeParser : public classbase std::string ChanModes(); /** Used by this class internally during std::sort and 005 generation */ - static bool PrefixComparison(const prefixtype one, const prefixtype two); + static bool PrefixComparison(prefixtype one, prefixtype two); /** This returns the PREFIX=(ohv)@%+ section of the 005 numeric. */ @@ -492,3 +524,4 @@ class ModeParser : public classbase }; #endif +