1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 /* $ModDesc: Provides more advanced UnrealIRCd SAMODE command */
20 class cmd_samode : public command_t
23 cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
25 this->source = "m_samode.so";
26 syntax = "<target> <modes> {<mode-parameters>}";
29 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
32 * Handles an SAMODE request. Notifies all +s users.
34 ServerInstance->SendMode(parameters, pcnt, ServerInstance->FakeClient);
36 if (ServerInstance->Modes->GetLastParse().length())
38 ServerInstance->WriteOpers("*** " + std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
40 std::deque<std::string> n;
41 irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
42 std::string one = "*";
43 while (spaced.GetToken(one))
46 Event rmode((char *)&n, NULL, "send_mode");
47 rmode.Send(ServerInstance);
50 n.push_back(std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
51 Event rmode2((char *)&n, NULL, "send_opers");
52 rmode2.Send(ServerInstance);
54 /* XXX: Yes, this is right. We dont want to propogate the
55 * actual SAMODE command, just the MODE command generated
62 user->WriteServ("NOTICE %s :*** Invalid SAMODE sequence.", user->nick);
69 class ModuleSaMode : public Module
71 cmd_samode* mycommand;
73 ModuleSaMode(InspIRCd* Me)
77 mycommand = new cmd_samode(ServerInstance);
78 ServerInstance->AddCommand(mycommand);
81 virtual ~ModuleSaMode()
85 virtual Version GetVersion()
87 return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
91 MODULE_INIT(ModuleSaMode)