From 039494a6973f733106d8de93188f027e0bee523e Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 6 Apr 2004 11:17:44 +0000 Subject: Added m_samode.cpp module by w00t (stability testing) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@403 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_samode.cpp | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/modules/m_samode.cpp (limited to 'src/modules') diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp new file mode 100644 index 000000000..419852123 --- /dev/null +++ b/src/modules/m_samode.cpp @@ -0,0 +1,94 @@ +i/* + * SAMODE module for InspIRCd + * Co authored by Brain and w00t + * + * Syntax: /SAMODE <#chan/nick> +/- [parameters for modes] + * + */ + +/* $ModDesc: Povides more advanced UnrealIRCd SAMODE command */ + +/* + * ToDo: + * Err... not a lot really. + */ + +#include + +#include "users.h" +#include "channels.h" +#include "modules.h" + +Server *Srv; + + +void handle_samode(char **parameters, int pcnt, userrec *user) +{ + /* + * Handles an SAMODE request. Notifies all +s users. + */ + int n=0; + std::string result; + Srv->Log(DEBUG,"SAMODE: Being handled"); + Srv->SendMode(parameters,pcnt,user); + Srv->Log(DEBUG,"SAMODE: Modechange handled"); + result = std::string(user->nick) + std::string(" used SAMODE "); + while (nSendOpers(result); +} + +class ModuleSaMode : public Module +{ + public: + ModuleSaMode() + { + Srv = new Server; + Srv->Log(DEBUG,"SAMODE: Pre-add cmd"); + Srv->AddCommand("SAMODE",handle_samode,'o',2); + Srv->Log(DEBUG,"SAMODE: Post-add cmd"); + } + + virtual ~ModuleSaMode() + { + delete Srv; + } + + virtual Version GetVersion() + { + return Version(1,0,2,1); + } + + virtual void OnUserConnect(userrec* user) + { + } + +}; + + +class ModuleSaModeFactory : public ModuleFactory +{ + public: + ModuleSaModeFactory() + { + } + + ~ModuleSaModeFactory() + { + } + + virtual Module * CreateModule() + { + return new ModuleSaMode; + } + +}; + + +extern "C" void * init_module( void ) +{ + return new ModuleSaModeFactory; +} -- cgit v1.2.3