1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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 CommandSamode : public Command
23 CommandSamode (InspIRCd* Instance) : Command(Instance,"SAMODE", "o", 2, false, 0)
25 this->source = "m_samode.so";
26 syntax = "<target> <modes> {<mode-parameters>}";
29 CmdResult Handle (const char* const* parameters, int pcnt, User *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->SNO->WriteToSnoMask('A', std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
40 std::deque<std::string> n;
41 irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
43 while (spaced.GetToken(one))
46 std::string channel = n[0];
48 ServerInstance->PI->SendMode(channel, n);
50 ServerInstance->PI->SendOperNotice(std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
52 /* XXX: Yes, this is right. We dont want to propagate the
53 * actual SAMODE command, just the MODE command generated
54 * by the Protocol Interface
60 user->WriteServ("NOTICE %s :*** Invalid SAMODE sequence.", user->nick);
67 class ModuleSaMode : public Module
69 CommandSamode* mycommand;
71 ModuleSaMode(InspIRCd* Me)
75 mycommand = new CommandSamode(ServerInstance);
76 ServerInstance->AddCommand(mycommand);
80 virtual ~ModuleSaMode()
84 virtual Version GetVersion()
86 return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
90 MODULE_INIT(ModuleSaMode)