1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
20 * SAMODE module for InspIRCd
21 * Co authored by Brain and w00t
23 * Syntax: /SAMODE <#chan/nick> +/-<modes> [parameters for modes]
27 /* $ModDesc: Povides more advanced UnrealIRCd SAMODE command */
31 * Err... not a lot really.
42 class cmd_samode : public command_t
45 cmd_samode () : command_t("SAMODE", 'o', 2)
47 this->source = "m_samode.so";
48 syntax = "<target> <modes> {<mode-parameters>}";
51 void Handle (const char** parameters, int pcnt, userrec *user)
54 * Handles an SAMODE request. Notifies all +s users.
57 Srv->Log(DEBUG,"SAMODE: Being handled");
58 userrec* n = new userrec();
59 n->fd = FD_MAGIC_NUMBER;
60 Srv->SendMode(parameters,pcnt,n);
62 Srv->Log(DEBUG,"SAMODE: Modechange handled");
63 result = std::string(user->nick);
64 result.append(" used SAMODE");
65 for (int n = 0; n < pcnt; n++)
68 result.append(parameters[n]);
70 Srv->SendOpers(result);
74 class ModuleSaMode : public Module
76 cmd_samode* mycommand;
78 ModuleSaMode(Server* Me)
82 mycommand = new cmd_samode();
83 Srv->AddCommand(mycommand);
86 virtual ~ModuleSaMode()
90 virtual Version GetVersion()
92 return Version(1,0,2,2,VF_VENDOR);
97 class ModuleSaModeFactory : public ModuleFactory
100 ModuleSaModeFactory()
104 ~ModuleSaModeFactory()
108 virtual Module * CreateModule(Server* Me)
110 return new ModuleSaMode(Me);
116 extern "C" void * init_module( void )
118 return new ModuleSaModeFactory;