1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
20 * SAQUIT module for InspIRCd
24 * Syntax: /SAQUIT <user> [reason]
25 * Makes it appear as though <user> has /quit with [reason]
36 /* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */
40 class cmd_saquit : public command_t
43 cmd_saquit (InspIRCd* Instance) : command_t(Instance,"SAQUIT",'o',2)
45 this->source = "m_saquit.so";
46 syntax = "<nick> <reason>";
49 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
51 userrec* dest = ServerInstance->FindNick(parameters[0]);
54 if (ServerInstance->ULine(dest->server))
56 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
59 irc::stringjoiner reason_join(" ", parameters, 1, pcnt - 1);
60 std::string line = reason_join.GetJoined();
62 ServerInstance->WriteOpers(std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+line);
63 userrec::QuitUser(ServerInstance, dest, line);
72 class ModuleSaquit : public Module
74 cmd_saquit* mycommand;
76 ModuleSaquit(InspIRCd* Me)
80 mycommand = new cmd_saquit(ServerInstance);
81 ServerInstance->AddCommand(mycommand);
84 virtual ~ModuleSaquit()
88 virtual Version GetVersion()
90 return Version(1,0,0,1,VF_VENDOR,API_VERSION);
95 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
97 class ModuleSaquitFactory : public ModuleFactory
100 ModuleSaquitFactory()
104 ~ModuleSaquitFactory()
108 virtual Module * CreateModule(InspIRCd* Me)
110 return new ModuleSaquit(Me);
116 extern "C" void * init_module( void )
118 return new ModuleSaquitFactory;