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 * ---------------------------------------------------
27 /* $ModDesc: Provides support for unreal-style SAJOIN command */
32 class cmd_sajoin : public command_t
35 cmd_sajoin (InspIRCd* Instance) : command_t(Instance,"SAJOIN", 'o', 2)
37 this->source = "m_sajoin.so";
38 syntax = "<nick> <channel>";
41 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
43 userrec* dest = ServerInstance->FindNick(parameters[0]);
46 if (ServerInstance->ULine(dest->server))
48 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
51 if (!ServerInstance->IsChannel(parameters[1]))
53 /* we didn't need to check this for each character ;) */
54 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
58 ServerInstance->WriteOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
59 chanrec::JoinUser(ServerInstance, dest, parameters[1], true);
61 /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */
62 chanrec* n = ServerInstance->FindChan(parameters[1]);
67 ServerInstance->WriteOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
72 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(user->nick)+" to "+parameters[1]+" (User is probably banned, or blocking modes)");
78 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(user->nick)+" to "+parameters[1]);
87 class ModuleSajoin : public Module
89 cmd_sajoin* mycommand;
91 ModuleSajoin(InspIRCd* Me)
95 mycommand = new cmd_sajoin(ServerInstance);
96 ServerInstance->AddCommand(mycommand);
99 virtual ~ModuleSajoin()
103 virtual Version GetVersion()
105 return Version(1,0,0,1,VF_VENDOR);
110 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
112 class ModuleSajoinFactory : public ModuleFactory
115 ModuleSajoinFactory()
119 ~ModuleSajoinFactory()
123 virtual Module * CreateModule(InspIRCd* Me)
125 return new ModuleSajoin(Me);
131 extern "C" void * init_module( void )
133 return new ModuleSajoinFactory;