summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-06 11:17:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-06 11:17:44 +0000
commit039494a6973f733106d8de93188f027e0bee523e (patch)
tree952a2bbc92a58f44df9ea9cfe2c8bc943bf127c9 /src/modules
parent2aa149d631b11208f2cfea7b9475edf76044e1ca (diff)
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
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_samode.cpp94
1 files changed, 94 insertions, 0 deletions
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> +/-<modes> [parameters for modes]
+ *
+ */
+
+/* $ModDesc: Povides more advanced UnrealIRCd SAMODE command */
+
+/*
+ * ToDo:
+ * Err... not a lot really.
+ */
+
+#include <stdio.h>
+
+#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 (n<pcnt)
+ {
+ result=result + std::string(" ") + std::string(parameters[n]);
+ n++;
+ }
+ Srv->SendOpers(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;
+}