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 * ---------------------------------------------------
25 /* $ModDesc: Provides support for unreal-style SAJOIN command */
29 class cmd_sajoin : public command_t
32 cmd_sajoin() : command_t("SAJOIN", 'o', 2)
34 this->source = "m_sajoin.so";
37 void Handle (char **parameters, int pcnt, userrec *user)
39 userrec* dest = Srv->FindNick(std::string(parameters[0]));
42 /* might be nicer to make checking valid channel names an api function sometime --w00t */
43 if (parameters[1][0] != '#')
45 /* we didn't need to check this for each character ;) */
46 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
50 for (unsigned int x = 0; x < strlen(parameters[1]); x++)
52 if ((parameters[1][x] == ' ') || (parameters[1][x] == ','))
54 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
59 Srv->SendOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
60 Srv->JoinUserToChannel(dest,std::string(parameters[1]),std::string(dest->nick));
65 class ModuleSajoin : public Module
67 cmd_sajoin* mycommand;
69 ModuleSajoin(Server* Me)
73 mycommand = new cmd_sajoin();
74 Srv->AddCommand(mycommand);
77 virtual ~ModuleSajoin()
81 virtual Version GetVersion()
83 return Version(1,0,0,1,VF_VENDOR);
88 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
90 class ModuleSajoinFactory : public ModuleFactory
97 ~ModuleSajoinFactory()
101 virtual Module * CreateModule(Server* Me)
103 return new ModuleSajoin(Me);
109 extern "C" void * init_module( void )
111 return new ModuleSajoinFactory;