diff options
| author | Adam <Adam@anope.org> | 2011-07-14 02:31:12 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-07-14 02:31:12 -0400 |
| commit | f858164deed48f2dcacd5ffc06a55398a54da7e8 (patch) | |
| tree | 89c3cf36bd8e94942370135218d67d6d17ee222e /include | |
| parent | 924f6849fee4598a1a3a7f1a98d96b79e5ffd3b4 (diff) | |
Rewrote how commands are handled within Anope.
This allows naming commands and having spaces within command names.
Diffstat (limited to 'include')
| -rw-r--r-- | include/bots.h | 12 | ||||
| -rw-r--r-- | include/commands.h | 64 | ||||
| -rw-r--r-- | include/config.h | 52 | ||||
| -rw-r--r-- | include/extern.h | 1 | ||||
| -rw-r--r-- | include/language.h | 13 | ||||
| -rw-r--r-- | include/logger.h | 2 | ||||
| -rw-r--r-- | include/modes.h | 2 | ||||
| -rw-r--r-- | include/module.h | 3 | ||||
| -rw-r--r-- | include/modules.h | 99 | ||||
| -rw-r--r-- | include/oper.h | 89 | ||||
| -rw-r--r-- | include/services.h | 6 | ||||
| -rw-r--r-- | include/users.h | 2 |
12 files changed, 98 insertions, 247 deletions
diff --git a/include/bots.h b/include/bots.h index 7316f074e..7508e4091 100644 --- a/include/bots.h +++ b/include/bots.h @@ -8,12 +8,12 @@ #ifndef BOTS_H #define BOTS_H -#include "commands.h" - class BotInfo; extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick; extern CoreExport Anope::map<BotInfo *> BotListByUID; +typedef Anope::insensitive_map<BotInfo *> botinfo_map; +typedef Anope::insensitive_map<Anope::string> command_map; /** Flags settable on a bot */ @@ -25,11 +25,13 @@ enum BotFlag BI_CORE, /* This bot can only be assigned by IRCops */ BI_PRIVATE, + /* This bot is defined in the config */ + BI_CONF, BI_END }; -static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "" }; +static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "CONF", "" }; class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END> { @@ -37,7 +39,7 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END> uint32 chancount; time_t created; /* Birth date ;) */ time_t lastmsg; /* Last time we said something */ - CommandMap Commands; /* Commands on this bot */ + command_map commands; /* Commands, actual name to service name */ /** Create a new bot. * @param nick The nickname to assign to the bot. @@ -51,6 +53,8 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END> */ virtual ~BotInfo(); + void GenerateUID(); + /** Change the nickname for the bot. * @param newnick The nick to change to */ diff --git a/include/commands.h b/include/commands.h index 89fd1436c..0ee9af226 100644 --- a/include/commands.h +++ b/include/commands.h @@ -18,36 +18,15 @@ class Module; class BotInfo; class Command; -typedef std::map<Anope::string, Command *, std::less<ci::string> > CommandMap; - -/** The return value from commands. - */ -enum CommandReturn -{ - MOD_CONT, - MOD_STOP -}; - -extern CoreExport Command *FindCommand(BotInfo *bi, const Anope::string &cmd); -extern CoreExport void mod_help_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &cmd); -extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &message); -extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, Command *c, const Anope::string &command, const Anope::string &message); - enum CommandFlag { CFLAG_ALLOW_UNREGISTERED, - CFLAG_ALLOW_SUSPENDED, - CFLAG_ALLOW_UNREGISTEREDCHANNEL, - CFLAG_STRIP_CHANNEL, - CFLAG_DISABLE_FANTASY + CFLAG_STRIP_CHANNEL }; const Anope::string CommandFlagStrings[] = { "CFLAG_ALLOW_UNREGISTERED", - "CFLAG_ALLOW_SUSPENDED", - "CFLAG_ALLOW_UNREGISTEREDCHANNEL", "CFLAG_STRIP_CHANNEL", - "CFLAG_DISABLE_FANTASY", "" }; @@ -56,14 +35,14 @@ struct CoreExport CommandSource { /* User executing the command */ User *u; - /* Channel (if applicable) */ - ChannelInfo *ci; + /* Channel the command was executed on (fantasy) */ + Channel *c; /* The service this command is on */ BotInfo *owner; /* The service the reply should come from, *not* necessarily the service the command is on */ BotInfo *service; - /* Whether or not this was a fantasy command */ - bool fantasy; + /* The actual name of the command being executed */ + Anope::string command; std::list<Anope::string> reply; @@ -75,38 +54,40 @@ struct CoreExport CommandSource /** Every services command is a class, inheriting from Command. */ -class CoreExport Command : public Flags<CommandFlag>, public Base +class CoreExport Command : public Service, public Flags<CommandFlag> { Anope::string desc; + std::vector<Anope::string> syntax; public: /* Maximum paramaters accepted by this command */ size_t MaxParams; /* Minimum parameters required to use this command */ size_t MinParams; - /* Command name */ - Anope::string name; /* Permission needed to use this comand */ Anope::string permission; /* Module which owns us */ Module *module; - /* Service this command is on */ - BotInfo *service; /** Create a new command. + * @param owner The owner of the command * @param sname The command name * @param min_params The minimum number of parameters the parser will require to execute this command * @param max_params The maximum number of parameters the parser will create, after max_params, all will be combined into the last argument. * NOTE: If max_params is not set (default), there is no limit to the max number of params. */ - Command(const Anope::string &sname, size_t min_params, size_t max_params = 0, const Anope::string &spermission = ""); + Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0, const Anope::string &spermission = ""); virtual ~Command(); protected: void SetDesc(const Anope::string &d); + void ClearSyntax(); + void SetSyntax(const Anope::string &s); + void SendSyntax(CommandSource &); + void SendSyntax(CommandSource &, const Anope::string &syntax); public: /** Get the command description * @return The commands description @@ -117,7 +98,7 @@ class CoreExport Command : public Flags<CommandFlag>, public Base * @param source The source * @param params Command parameters */ - virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) = 0; + virtual void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) = 0; /** Called when HELP is requsted for the client this command is on. * @param source The source @@ -141,23 +122,6 @@ class CoreExport Command : public Flags<CommandFlag>, public Base * @param reststr The permission required to successfully execute this command */ void SetPermission(const Anope::string &reststr); - - /** Add a subcommand to this command - * @param creator The creator of the subcommand - * @param c The command - */ - virtual bool AddSubcommand(Module *creator, Command *c); - - /** Delete a subcommand from this command - * @param c The command - */ - virtual bool DelSubcommand(Command *c); - - /** Find a subcommand - * @param name The subcommand name - * @return The subcommand - */ - virtual Command *FindSubcommand(const Anope::string &subcommand); }; #endif // COMMANDS_H diff --git a/include/config.h b/include/config.h index 07815466e..84ed2f8d3 100644 --- a/include/config.h +++ b/include/config.h @@ -342,7 +342,7 @@ class CoreExport ServerConfig /** Below here is a list of variables which contain the config files values */ - /* Host to connect to **/ + /* Host to bind to */ Anope::string LocalHost; /* List of uplink servers to try and connect to */ std::vector<Uplink *> Uplinks; @@ -351,10 +351,6 @@ class CoreExport ServerConfig Anope::string ServerName; /* Our servers description */ Anope::string ServerDesc; - /* The username/ident of services clients */ - Anope::string ServiceUser; - /* The hostname if services clients */ - Anope::string ServiceHost; /* Name of the network were on */ Anope::string NetworkName; @@ -368,49 +364,19 @@ class CoreExport ServerConfig /* Max length of passwords */ unsigned PassLen; - /* NickServ Name */ - Anope::string s_NickServ; - /* ChanServ Name */ - Anope::string s_ChanServ; - /* MemoServ Name */ - Anope::string s_MemoServ; - /* BotServ Name */ - Anope::string s_BotServ; - /* OperServ name */ - Anope::string s_OperServ; - /* Global name */ - Anope::string s_Global; - /* NickServs realname */ - Anope::string desc_NickServ; - /* ChanServ realname */ - Anope::string desc_ChanServ; - /* MemoServ realname */ - Anope::string desc_MemoServ; - /* BotServ realname */ - Anope::string desc_BotServ; - /* OperServ realname */ - Anope::string desc_OperServ; - /* Global realname */ - Anope::string desc_Global; - - /* HostServ Name */ - Anope::string s_HostServ; - /* HostServ realname */ - Anope::string desc_HostServ; - /* Core HostServ modules */ - Anope::string HostCoreModules; - /* Filename for the PID file */ Anope::string PIDFilename; /* MOTD filename */ Anope::string MOTDFilename; - /* Core MemoServ Modules */ - Anope::string MemoCoreModules; - /* Core OperServ Modules */ - Anope::string OperCoreModules; - /* Core Global Modules */ - Anope::string GlobalCoreModules; + Anope::string BotServ; + Anope::string ChanServ; + Anope::string Global; + Anope::string HostServ; + Anope::string NickServ; + Anope::string OperServ; + Anope::string MemoServ; + /* True if its ok to not be able to save backs */ bool NoBackupOkay; /* Do password checking when new people register */ diff --git a/include/extern.h b/include/extern.h index 91312d1ab..18df923a8 100644 --- a/include/extern.h +++ b/include/extern.h @@ -99,7 +99,6 @@ E const char *translate(const char *string); E const char *translate(User *u, const char *string); E const char *translate(NickCore *nc, const char *string); E const char *anope_gettext(const char *lang, const char *string); -E void SyntaxError(CommandSource &source, const Anope::string &command, const Anope::string &message); /**** main.c ****/ diff --git a/include/language.h b/include/language.h index efddc0a34..f2b9bec7b 100644 --- a/include/language.h +++ b/include/language.h @@ -25,8 +25,7 @@ #define CHAN_X_SUSPENDED _("Channel %s is currently suspended.") #define CHAN_X_NOT_REGISTERED _("Channel \002%s\002 isn't registered.") #define CHAN_X_NOT_IN_USE _("Channel \002%s\002 doesn't exist.") -#define NICK_IDENTIFY_REQUIRED _("Password authentication required for that command.\n" \ - "Retry after typing \002%s%s IDENTIFY \037password\037\002.") +#define NICK_IDENTIFY_REQUIRED _("Password authentication required for that command.") #define MAIL_X_INVALID _("\002%s\002 is not a valid e-mail address.") #define NO_REASON _("No reason") #define UNKNOWN _("<unknown>") @@ -47,11 +46,6 @@ #define NICK_SET_DISABLED _("Sorry, nickname option setting is temporarily disabled.") #define NICK_SET_UNKNOWN_OPTION _("Unknown SET option \002%s%s\002.") #define NICK_SET_DISPLAY_CHANGED _("The new display is now \002%s\002.") -#define NICK_SASET_SYNTAX _("SASET \037nickname\037 \037option\037 \037parameters\037") -#define NICK_SASET_DISPLAY_INVALID _("The new display for \002%s\002 MUST be a nickname of the nickname group!") -#define NICK_SASET_PASSWORD_FAILED _("Sorry, couldn't change password for \002%s\002.") -#define NICK_SASET_PASSWORD_CHANGED _("Password for \002%s\002 changed.") -#define NICK_SASET_PASSWORD_CHANGED_TO _("Password for \002%s\002 changed to \002%s\002.") #define NICK_INFO_OPTIONS _(" Options: %s") #define NICK_LIST_SYNTAX _("LIST \037pattern\037") #define LIST_HEADER _("List of entries matching \002%s\002:") @@ -64,8 +58,6 @@ #define CHAN_REACHED_CHANNEL_LIMIT _("Sorry, you have already reached your limit of \002%d\002 channels.") #define CHAN_EXCEEDED_CHANNEL_LIMIT _("Sorry, you have already exceeded your limit of \002%d\002 channels.") #define CHAN_SYMBOL_REQUIRED _("Please use the symbol of \002#\002 when attempting to register") -#define CHAN_SASET_SYNTAX _("SASET \002channel\002 \037option\037 \037parameters\037") -#define CHAN_SET_SYNTAX _("SET \037channel\037 \037option\037 \037parameters\037") #define CHAN_SET_DISABLED _("Sorry, channel option setting is temporarily disabled.") #define CHAN_SETTING_CHANGED _("%s for %s set to %s.") #define CHAN_SETTING_UNSET _("%s for %s unset.") @@ -94,8 +86,7 @@ #define MEMO_HAVE_NO_NEW_MEMOS _("You have no new memos.") #define MEMO_X_HAS_NO_NEW_MEMOS _("%s has no new memos.") #define BOT_DOES_NOT_EXIST _("Bot \002%s\002 does not exist.") -#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.\n" \ - "Type %s%s HELP ASSIGN for more information.") +#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.") #define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.") #define BOT_ASSIGN_READONLY _("Sorry, bot assignment is temporarily disabled.") #define ENABLED _("Enabled") diff --git a/include/logger.h b/include/logger.h index 2a11967b9..d012c4450 100644 --- a/include/logger.h +++ b/include/logger.h @@ -29,6 +29,8 @@ struct LogFile Anope::string GetName() const; }; +class Command; + class CoreExport Log { public: diff --git a/include/modes.h b/include/modes.h index ae89c7ab7..95452bb30 100644 --- a/include/modes.h +++ b/include/modes.h @@ -295,8 +295,6 @@ class CoreExport ChannelModeBan : public ChannelModeList { public: ChannelModeBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { } - - void OnAdd(Channel *chan, const Anope::string &mask); }; /** Channel mode +k (key) diff --git a/include/module.h b/include/module.h index 4e4c96607..6435f9b7f 100644 --- a/include/module.h +++ b/include/module.h @@ -2,7 +2,8 @@ #define MODULE_H #include "services.h" -#include "commands.h" #include "modules.h" +#include "oper.h" +#include "commands.h" #endif // MODULE_H diff --git a/include/modules.h b/include/modules.h index b9ed03664..2169513a8 100644 --- a/include/modules.h +++ b/include/modules.h @@ -17,7 +17,6 @@ #include <stdio.h> #include "timers.h" #include "hashcomp.h" -#include "commands.h" /* Cross OS compatibility macros */ #ifdef _WIN32 @@ -187,8 +186,9 @@ class Version int GetBuild() const; }; -/* Forward declaration of CallBack class for the Module class */ class CallBack; +class XLineManager; +class CommandSource; /** Every module in Anope is actually a class. */ @@ -270,22 +270,6 @@ class CoreExport Module : public Extensible */ Version GetVersion() const; - /** - * Add a module provided command to the given service. - * @param bi The service to add the command to - * @param c The command to add - * @return MOD_ERR_OK on successfully adding the command - */ - int AddCommand(BotInfo *bi, Command *c); - - /** - * Delete a command from the service given. - * @param bi The service to remove the command from - * @param c Thec command to delete - * @return returns MOD_ERR_OK on success - */ - int DelCommand(BotInfo *bi, Command *c); - /** Called when the ircd notifies that a user has been kicked from a channel. * @param c The channel the user has been kicked from. * @param target The user that has been kicked. @@ -330,15 +314,17 @@ class CoreExport Module : public Extensible */ virtual void OnUserNickChange(User *u, const Anope::string &oldnick) { } - /** Called immediatly when a user tries to run a command - * @param u The user - * @param bi The bot the command is being run from - * @param command The command - * @param message The parameters used for the command - * @param ci If a tanasy command, the channel the comman was used on - * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it + /** Called when someone uses the generic/help command + * @param source Command source + * @param params Params */ - virtual EventReturn OnPreCommandRun(User *&u, BotInfo *&bi, Anope::string &command, Anope::string &message, ChannelInfo *&ci) { return EVENT_CONTINUE; } + virtual void OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) { } + + /** Called when someone uses the generic/help command + * @param source Command source + * @param params Params + */ + virtual void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) { } /** Called before a command is due to be executed. * @param source The source of the command @@ -346,7 +332,7 @@ class CoreExport Module : public Extensible * @param params The parameters the user is sending * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it */ - virtual EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { return EVENT_CONTINUE; } + virtual EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) { return EVENT_CONTINUE; } /** Called after a command has been executed. * @param source The source of the command @@ -445,6 +431,13 @@ class CoreExport Module : public Extensible */ virtual void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg) { } + /** Called when a user leaves a channel. + * From either parting, being kicked, or quitting/killed! + * @param u The user + * @param c The channel + */ + virtual void OnLeaveChannel(User *u, Channel *c) { } + /** Called before a user joins a channel * @param u The user * @param c The channel @@ -582,18 +575,6 @@ class CoreExport Module : public Extensible */ virtual void OnDefconLevel(int level) { } - /** Called before an akill is added - * @param ak The akill - * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it - */ - virtual EventReturn OnAddAkill(XLine *ak) { return EVENT_CONTINUE; } - - /** Called before an akill is deleted - * @param u The user removing the akill - * @param ak The akill, can be NULL for all akills! - */ - virtual void OnDelAkill(User *u, XLine *ak) { } - /** Called after an exception has been added * @param ex The exception * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it @@ -607,18 +588,19 @@ class CoreExport Module : public Extensible virtual void OnExceptionDel(User *u, Exception *ex) { } /** Called before a XLine is added - * @param sx The XLine - * @param Type The type of XLine this is + * @param u The user adding the XLine + * @param x The XLine + * @param xlm The xline manager it was added to * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it */ - virtual EventReturn OnAddXLine(XLine *x, XLineType Type) { return EVENT_CONTINUE; } + virtual EventReturn OnAddXLine(User *u, XLine *x, XLineManager *xlm) { return EVENT_CONTINUE; } /** Called before a XLine is deleted * @param u The user deleting the XLine - * @param sx The XLine, can be NULL for all XLines - * @param Type The type of XLine this is + * @param x The XLine, can be NULL for all XLines + * @param xlm The xline manager it was deleted from */ - virtual void OnDelXLine(User *u, XLine *x, XLineType Type) { } + virtual void OnDelXLine(User *u, XLine *x, XLineManager *xlm) { } /** Called when a user is checked for whether they are a services oper * @param u The user @@ -746,6 +728,14 @@ class CoreExport Module : public Extensible */ virtual void OnAkickDel(User *u, ChannelInfo *ci, AutoKick *ak) { } + /** Called after a user join a channel when we decide whether to kick them or not + * @param u The user + * @param ci The channel + * @param kick Set to true to kick + * @return EVENT_ALLOW to stop processing immediatly + */ + virtual EventReturn OnCheckKick(User *u, ChannelInfo *ci, bool &kick) { return EVENT_CONTINUE; } + /** Called when a user requests info for a channel * @param source The user requesting info * @param ci The channel the user is requesting info for @@ -877,7 +867,7 @@ class CoreExport Module : public Extensible * @param password The password * @return EVENT_ALLOW to allow the password, EVENT_STOP to stop processing completely */ - virtual EventReturn OnCheckAuthentication(User *u, Command *c, const std::vector<Anope::string> ¶ms, const Anope::string &account, const Anope::string &password) { return EVENT_CONTINUE; } + virtual EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> ¶ms, const Anope::string &account, const Anope::string &password) { return EVENT_CONTINUE; } /** Called when a user does /ns update * @param u The user @@ -1013,10 +1003,10 @@ class CoreExport Module : public Extensible /** Called when we receive a PRIVMSG for a registered channel we are in * @param u The source of the message - * @param ci The channel + * @param c The channel * @param msg The message */ - virtual void OnPrivmsg(User *u, ChannelInfo *ci, Anope::string &msg) { } + virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg) { } /** Called when any object is deleted * @param b The object @@ -1041,7 +1031,7 @@ enum Implementation /* ChanServ */ I_OnChanForbidden, I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd, I_OnAccessChange, I_OnAccessDel, I_OnAccessClear, I_OnLevelChange, I_OnChanRegistered, I_OnChanUnsuspend, I_OnDelChan, I_OnChannelCreate, - I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, + I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick, I_OnChanInfo, I_OnFindChan, /* BotServ */ @@ -1056,7 +1046,7 @@ enum Implementation /* Users */ I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnUserLogoff, I_OnPreJoinChannel, - I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnFingerprint, I_OnUserAway, + I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnLeaveChannel, I_OnFingerprint, I_OnUserAway, /* OperServ */ I_OnDefconLevel, I_OnAddAkill, I_OnDelAkill, I_OnExceptionAdd, I_OnExceptionDel, @@ -1070,8 +1060,8 @@ enum Implementation I_OnModuleLoad, I_OnModuleUnload, /* Other */ - I_OnReload, I_OnNewServer, I_OnPreServerConnect, I_OnServerConnect, I_OnPreUplinkSync, I_OnServerDisconnect, I_OnPreCommandRun, - I_OnPreCommand, I_OnPostCommand, I_OnRestart, I_OnShutdown, + I_OnReload, I_OnNewServer, I_OnPreServerConnect, I_OnServerConnect, I_OnPreUplinkSync, I_OnServerDisconnect, + I_OnPreHelp, I_OnPostHelp, I_OnPreCommand, I_OnPostCommand, I_OnRestart, I_OnShutdown, I_OnServerQuit, I_OnTopicUpdated, I_OnEncrypt, I_OnDecrypt, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd, @@ -1218,6 +1208,11 @@ class CoreExport ModuleManager */ static Service *GetService(const Anope::string &name); + /** Get the existing service key names + * @return The keys + */ + static std::vector<Anope::string> GetServiceKeys(); + private: /** Call the module_delete function to safely delete the module * @param m the module to delete diff --git a/include/oper.h b/include/oper.h index c718ea5fb..57ce92f7c 100644 --- a/include/oper.h +++ b/include/oper.h @@ -10,17 +10,6 @@ #define OPER_H class XLineManager; -extern CoreExport XLineManager *SGLine; -extern CoreExport XLineManager *SZLine; -extern CoreExport XLineManager *SQLine; -extern CoreExport XLineManager *SNLine; - -enum XLineType -{ - X_SNLINE, - X_SQLINE, - X_SZLINE -}; class CoreExport XLine { @@ -40,24 +29,29 @@ class CoreExport XLine Anope::string GetHost() const; }; -class CoreExport XLineManager +class CoreExport XLineManager : public Service { - private: - /* List of XLine managers we check users against in XLineManager::CheckAll */ - static std::list<XLineManager *> XLineManagers; - + char type; protected: /* List of XLines in this XLineManager */ std::vector<XLine *> XLines; public: + /* List of XLine managers we check users against in XLineManager::CheckAll */ + static std::list<XLineManager *> XLineManagers; + /** Constructor */ - XLineManager(); + XLineManager(Module *creator, const Anope::string &name, char t); /** Destructor */ virtual ~XLineManager(); + /** The type of xline provided by this service + * @return The type + */ + const char &Type(); + /** Register a XLineManager, places it in XLineManagers for use in XLineManager::CheckAll * It is important XLineManagers are registered in the proper order. Eg, if you had one akilling * clients and one handing them free olines, you would want the akilling one first. This way if a client @@ -165,65 +159,4 @@ class CoreExport XLineManager virtual void Send(User *u, XLine *x) = 0; }; -/* This is for AKILLS */ -class SGLineManager : public XLineManager -{ - public: - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason); - - void Del(XLine *x); - - void OnMatch(User *u, XLine *x); - - void OnExpire(XLine *x); - - void Send(User *u, XLine *x); -}; - -class SNLineManager : public XLineManager -{ - public: - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason); - - void Del(XLine *x); - - void OnMatch(User *u, XLine *x); - - void OnExpire(XLine *x); - - void Send(User *u, XLine *x); - - XLine *Check(User *u); -}; - -class SQLineManager : public XLineManager -{ - public: - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason); - - void Del(XLine *x); - - void OnMatch(User *u, XLine *x); - - void OnExpire(XLine *x); - - void Send(User *u, XLine *x); - - static bool Check(Channel *c); -}; - -class SZLineManager : public XLineManager -{ - public: - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason); - - void Del(XLine *x); - - void OnMatch(User *u, XLine *x); - - void OnExpire(XLine *x); - - void Send(User *u, XLine *x); -}; - #endif // OPER_H diff --git a/include/services.h b/include/services.h index fdc78ff59..556e1d715 100644 --- a/include/services.h +++ b/include/services.h @@ -660,8 +660,6 @@ enum BotServFlag BS_DONTKICKVOICES, /* BotServ bot accepts fantasy commands */ BS_FANTASY, - /* BotServ bot sets modes etc instead of ChanServ */ - BS_SYMBIOSIS, /* BotServ should show greets */ BS_GREET, /* BotServ bots are not allowed to be in this channel */ @@ -696,7 +694,7 @@ enum BotServFlag }; const Anope::string BotServFlagStrings[] = { - "BEGIN", "DONTKICKOPS", "DONTKICKVOICES", "FANTASY", "SYMBIOSIS", "GREET", "NOBOT", + "BEGIN", "DONTKICKOPS", "DONTKICKVOICES", "FANTASY", "GREET", "NOBOT", "KICK_BOLDs", "KICK_COLORS", "KICK_REVERSES", "KICK_UNDERLINES", "KICK_BADWORDS", "KICK_CAPS", "KICK_FLOOD", "KICK_REPEAT", "KICK_ITALICS", "KICK_AMSGS", "MSG_PRIVMSG", "MSG_NOTICE", "MSG_NOTICEOPS", "" @@ -817,10 +815,10 @@ class IRCdMessage; struct Uplink; class ServerConfig; class ConfigurationFile; +class XLine; #include "extern.h" #include "language.h" -#include "oper.h" #include "mail.h" #include "servers.h" #include "logger.h" diff --git a/include/users.h b/include/users.h index fd6600326..d6a0866ee 100644 --- a/include/users.h +++ b/include/users.h @@ -77,7 +77,7 @@ class CoreExport User : public Extensible * @param shost The hostname of the user * @param suid The unique identifier of the user. */ - User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid); + User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid = ""); /** Destroy a user. */ |
