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: Provides more advanced UnrealIRCd SAMODE command */
31 * Err... not a lot really.
42 class cmd_samode : public command_t
45 cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
47 this->source = "m_samode.so";
48 syntax = "<target> <modes> {<mode-parameters>}";
51 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
54 * Handles an SAMODE request. Notifies all +s users.
57 userrec* n = new userrec(ServerInstance);
58 n->SetFd(FD_MAGIC_NUMBER);
59 ServerInstance->SendMode(parameters,pcnt,n);
62 if (ServerInstance->Modes->GetLastParse().length())
64 ServerInstance->WriteOpers(std::string(user->nick)+" used SAMODE: "+ServerInstance->Modes->GetLastParse());
66 std::deque<std::string> n;
67 irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
68 std::string one = "*";
69 while ((one = spaced.GetToken()) != "")
72 Event rmode((char *)&n, NULL, "send_mode_explicit");
73 rmode.Send(ServerInstance);
75 /* XXX: Yes, this is right. We dont want to propogate the
76 * actual SAMODE command, just the MODE command generated
77 * by the send_mode_explicit
86 class ModuleSaMode : public Module
88 cmd_samode* mycommand;
90 ModuleSaMode(InspIRCd* Me)
94 mycommand = new cmd_samode(ServerInstance);
95 ServerInstance->AddCommand(mycommand);
98 virtual ~ModuleSaMode()
102 virtual Version GetVersion()
104 return Version(1,1,2,2,VF_VENDOR,API_VERSION);
109 class ModuleSaModeFactory : public ModuleFactory
112 ModuleSaModeFactory()
116 ~ModuleSaModeFactory()
120 virtual Module * CreateModule(InspIRCd* Me)
122 return new ModuleSaMode(Me);
128 extern "C" void * init_module( void )
130 return new ModuleSaModeFactory;