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.
43 class cmd_samode : public command_t
46 cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
48 this->source = "m_samode.so";
49 syntax = "<target> <modes> {<mode-parameters>}";
52 void Handle (const char** parameters, int pcnt, userrec *user)
55 * Handles an SAMODE request. Notifies all +s users.
58 ServerInstance->Log(DEBUG,"SAMODE: Being handled");
59 userrec* n = new userrec(ServerInstance);
60 n->SetFd(FD_MAGIC_NUMBER);
61 ServerInstance->SendMode(parameters,pcnt,n);
63 ServerInstance->Log(DEBUG,"SAMODE: Modechange handled");
64 result = std::string(user->nick);
65 result.append(" used SAMODE");
66 for (int n = 0; n < pcnt; n++)
69 result.append(parameters[n]);
71 ServerInstance->WriteOpers(result);
75 class ModuleSaMode : public Module
77 cmd_samode* mycommand;
79 ModuleSaMode(InspIRCd* Me)
83 mycommand = new cmd_samode(ServerInstance);
84 ServerInstance->AddCommand(mycommand);
87 virtual ~ModuleSaMode()
91 virtual Version GetVersion()
93 return Version(1,0,2,2,VF_VENDOR);
98 class ModuleSaModeFactory : public ModuleFactory
101 ModuleSaModeFactory()
105 ~ModuleSaModeFactory()
109 virtual Module * CreateModule(InspIRCd* Me)
111 return new ModuleSaMode(Me);
117 extern "C" void * init_module( void )
119 return new ModuleSaModeFactory;