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 * ---------------------------------------------------
24 #include "helperfuncs.h"
26 /* $ModDesc: Provides support for unreal-style SAJOIN command */
30 class cmd_sajoin : public command_t
33 cmd_sajoin() : command_t("SAJOIN", 'o', 2)
35 this->source = "m_sajoin.so";
36 syntax = "<nick> <channel>";
39 void Handle (const char** parameters, int pcnt, userrec *user)
41 userrec* dest = Srv->FindNick(std::string(parameters[0]));
44 if (Srv->IsUlined(dest->server))
46 WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
49 if (!IsValidChannelName(parameters[1]))
51 /* we didn't need to check this for each character ;) */
52 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
56 Srv->SendOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
57 Srv->JoinUserToChannel(dest,std::string(parameters[1]),std::string(dest->nick));
62 class ModuleSajoin : public Module
64 cmd_sajoin* mycommand;
66 ModuleSajoin(Server* Me)
70 mycommand = new cmd_sajoin();
71 Srv->AddCommand(mycommand);
74 virtual ~ModuleSajoin()
78 virtual Version GetVersion()
80 return Version(1,0,0,1,VF_VENDOR);
85 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
87 class ModuleSajoinFactory : public ModuleFactory
94 ~ModuleSajoinFactory()
98 virtual Module * CreateModule(Server* Me)
100 return new ModuleSajoin(Me);
106 extern "C" void * init_module( void )
108 return new ModuleSajoinFactory;