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 */
24 class cmd_samode : public command_t
27 cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
29 this->source = "m_samode.so";
30 syntax = "<target> <modes> {<mode-parameters>}";
33 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
36 * Handles an SAMODE request. Notifies all +s users.
39 userrec* n = new userrec(ServerInstance);
40 n->SetFd(FD_MAGIC_NUMBER);
41 ServerInstance->SendMode(parameters,pcnt,n);
44 if (ServerInstance->Modes->GetLastParse().length())
46 ServerInstance->WriteOpers("*** " + std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
48 std::deque<std::string> n;
49 irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
50 std::string one = "*";
51 while ((one = spaced.GetToken()) != "")
54 Event rmode((char *)&n, NULL, "send_mode");
55 rmode.Send(ServerInstance);
58 n.push_back(std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
59 Event rmode2((char *)&n, NULL, "send_opers");
60 rmode2.Send(ServerInstance);
62 /* XXX: Yes, this is right. We dont want to propogate the
63 * actual SAMODE command, just the MODE command generated
70 user->WriteServ("NOTICE %s :*** Invalid SAMODE sequence.", user->nick);
77 class ModuleSaMode : public Module
79 cmd_samode* mycommand;
81 ModuleSaMode(InspIRCd* Me)
85 mycommand = new cmd_samode(ServerInstance);
86 ServerInstance->AddCommand(mycommand);
89 virtual ~ModuleSaMode()
93 virtual Version GetVersion()
95 return Version(1,1,2,2,VF_VENDOR,API_VERSION);
100 class ModuleSaModeFactory : public ModuleFactory
103 ModuleSaModeFactory()
107 ~ModuleSaModeFactory()
111 virtual Module * CreateModule(InspIRCd* Me)
113 return new ModuleSaMode(Me);
119 extern "C" void * init_module( void )
121 return new ModuleSaModeFactory;