diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-04-07 22:34:46 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-04-07 22:34:46 +0000 |
commit | e9b343457de271771c181a288aaa3e34bd397850 (patch) | |
tree | 03cee2e22d05f96bcf6c2b71364aa6d12a88df7e /src/modules/m_shun.cpp | |
parent | ef30d86d11696bb7ca639ae7a156a0c91d396cdb (diff) |
Add a factory to produce shuns, don't autoapply to userlist, etc.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9410 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_shun.cpp')
-rw-r--r-- | src/modules/m_shun.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index f580c5646..509ed3ae1 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -56,6 +56,27 @@ public: } }; +/** An XLineFactory specialized to generate shun pointers + */ +class ShunFactory : public XLineFactory +{ + public: + ShunFactory(InspIRCd* Instance) : XLineFactory(Instance, "SHUN") { } + + /** Generate a shun + */ + XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask) + { + return new Shun(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + } + + virtual bool AutoApplyToUserList(XLine*) + { + // No, we don't want to be applied to users automagically. + return false; + } +}; + //typedef std::vector<Shun> shunlist; class cmd_shun : public Command @@ -135,14 +156,23 @@ class cmd_shun : public Command class ModuleShun : public Module { cmd_shun* mycommand; + ShunFactory *f; public: ModuleShun(InspIRCd* Me) : Module(Me) { + f = new ShunFactory(ServerInstance); + ServerInstance->XLines->RegisterFactory(f); + mycommand = new cmd_shun(ServerInstance); ServerInstance->AddCommand(mycommand); } + virtual ~ModuleShun() + { + ServerInstance->XLines->UnregisterFactory(f); + } + void Implements(char* List) { List[I_OnPreCommand] = List[I_OnStats] = 1; @@ -176,10 +206,6 @@ class ModuleShun : public Module return 0; } - virtual ~ModuleShun() - { - } - virtual Version GetVersion() { return Version(1,0,0,0,0,API_VERSION); |