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 */
23 class cmd_samode : public command_t
26 cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
28 this->source = "m_samode.so";
29 syntax = "<target> <modes> {<mode-parameters>}";
32 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
35 * Handles an SAMODE request. Notifies all +s users.
38 userrec* n = new userrec(ServerInstance);
39 n->SetFd(FD_MAGIC_NUMBER);
40 ServerInstance->SendMode(parameters,pcnt,n);
43 if (ServerInstance->Modes->GetLastParse().length())
45 ServerInstance->WriteOpers("*** " + std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
47 std::deque<std::string> n;
48 irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
49 std::string one = "*";
50 while ((one = spaced.GetToken()) != "")
53 Event rmode((char *)&n, NULL, "send_mode");
54 rmode.Send(ServerInstance);
57 n.push_back(std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
58 Event rmode2((char *)&n, NULL, "send_opers");
59 rmode2.Send(ServerInstance);
61 /* XXX: Yes, this is right. We dont want to propogate the
62 * actual SAMODE command, just the MODE command generated
69 user->WriteServ("NOTICE %s :*** Invalid SAMODE sequence.", user->nick);
76 class ModuleSaMode : public Module
78 cmd_samode* mycommand;
80 ModuleSaMode(InspIRCd* Me)
84 mycommand = new cmd_samode(ServerInstance);
85 ServerInstance->AddCommand(mycommand);
88 virtual ~ModuleSaMode()
92 virtual Version GetVersion()
94 return Version(1,1,2,2,VF_VENDOR,API_VERSION);
99 class ModuleSaModeFactory : public ModuleFactory
102 ModuleSaModeFactory()
106 ~ModuleSaModeFactory()
110 virtual Module * CreateModule(InspIRCd* Me)
112 return new ModuleSaMode(Me);
118 extern "C" DllExport void * init_module( void )
120 return new ModuleSaModeFactory;