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.
35 userrec* n = new userrec(ServerInstance);
36 n->SetFd(FD_MAGIC_NUMBER);
37 ServerInstance->SendMode(parameters,pcnt,n);
40 if (ServerInstance->Modes->GetLastParse().length())
42 ServerInstance->WriteOpers("*** " + std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
44 std::deque<std::string> n;
45 irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
46 std::string one = "*";
47 while (spaced.GetToken(one))
50 Event rmode((char *)&n, NULL, "send_mode");
51 rmode.Send(ServerInstance);
54 n.push_back(std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
55 Event rmode2((char *)&n, NULL, "send_opers");
56 rmode2.Send(ServerInstance);
58 /* XXX: Yes, this is right. We dont want to propogate the
59 * actual SAMODE command, just the MODE command generated
66 user->WriteServ("NOTICE %s :*** Invalid SAMODE sequence.", user->nick);
73 class ModuleSaMode : public Module
75 cmd_samode* mycommand;
77 ModuleSaMode(InspIRCd* Me)
81 mycommand = new cmd_samode(ServerInstance);
82 ServerInstance->AddCommand(mycommand);
85 virtual ~ModuleSaMode()
89 virtual Version GetVersion()
91 return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
95 MODULE_INIT(ModuleSaMode)