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 chanrec::JoinUser(ServerInstance, dest, parameters[1], true);
60 /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */
61 chanrec* n = ServerInstance->FindChan(parameters[1]);
66 ServerInstance->WriteOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
71 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]+" (User is probably banned, or blocking modes)");
77 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]);
86 class ModuleSajoin : public Module
88 cmd_sajoin* mycommand;
90 ModuleSajoin(InspIRCd* Me)
94 mycommand = new cmd_sajoin(ServerInstance);
95 ServerInstance->AddCommand(mycommand);
98 virtual ~ModuleSajoin()
102 virtual Version GetVersion()
104 return Version(1,0,0,1,VF_VENDOR,API_VERSION);
109 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
111 class ModuleSajoinFactory : public ModuleFactory
114 ModuleSajoinFactory()
118 ~ModuleSajoinFactory()
122 virtual Module * CreateModule(InspIRCd* Me)
124 return new ModuleSajoin(Me);
130 extern "C" void * init_module( void )
132 return new ModuleSajoinFactory;