From b9e99da4dafd836e995970216835cefe3716a01a Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 29 Aug 2006 18:26:55 +0000 Subject: Snomask support cometh! and it leave a sticky white mess all over the floor :( git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5062 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 7 ++++++- include/snomasks.h | 10 +++++++++- include/users.h | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/inspircd.h b/include/inspircd.h index 965cf44fc..dfc36a720 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -25,9 +25,9 @@ #include "channels.h" #include "socket.h" #include "mode.h" - #include "socketengine.h" #include "command_parse.h" +#include "snomasks.h" /** Returned by some functions to indicate failure, * and the exit code of the program if it terminates. @@ -373,6 +373,11 @@ class InspIRCd : public classbase */ ServerConfig* Config; + /** Snomask manager - handles routing of snomask messages + * to opers. + */ + SnomaskManager* SNO; + /** Client list, a hash_map containing all clients, local and remote */ user_hash clientlist; diff --git a/include/snomasks.h b/include/snomasks.h index ab8980c26..a6ee0d050 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -19,18 +19,26 @@ #include #include +#include #include "configreader.h" #include "inspircd.h" +typedef std::map SnoList; + class SnomaskManager : public Extensible { private: InspIRCd* ServerInstance; + SnoList SnoMasks; public: SnomaskManager(InspIRCd* Instance); ~SnomaskManager(); - + bool EnableSnomask(char letter, const std::string &description); + bool DisableSnomask(char letter); + void WriteToSnoMask(char letter, const std::string &text); + void WriteToSnoMask(char letter, const char* text, ...); + bool IsEnabled(char letter); }; #endif diff --git a/include/users.h b/include/users.h index 83ea9bf3f..731cb785a 100644 --- a/include/users.h +++ b/include/users.h @@ -46,6 +46,7 @@ enum UserModes { UM_WALLOPS = 'w'-65, UM_INVISIBLE = 'i'-65, UM_OPERATOR = 'o'-65, + UM_SNOMASK = 'n'-65, }; enum RegistrationState { @@ -372,9 +373,11 @@ class userrec : public connection /** Process a snomask modifier string, e.g. +abc-de * @param sm A sequence of notice mask characters - * @return True if the notice masks were successfully applied + * @return The cleaned mode sequence which can be output, + * e.g. in the above example if masks c and e are not + * valid, this function will return +ab-d */ - bool userrec::ProcessNoticeMasks(const char *sm); + std::string userrec::ProcessNoticeMasks(const char *sm); /** Returns true if a notice mask is set * @param sm A notice mask character to check -- cgit v1.2.3