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 */
31 class cmd_sajoin : public command_t
34 cmd_sajoin (InspIRCd* Instance) : command_t(Instance,"SAJOIN", 'o', 2)
36 this->source = "m_sajoin.so";
37 syntax = "<nick> <channel>";
40 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
42 userrec* dest = ServerInstance->FindNick(parameters[0]);
45 if (ServerInstance->ULine(dest->server))
47 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
50 if (!ServerInstance->IsChannel(parameters[1]))
52 /* we didn't need to check this for each character ;) */
53 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
57 chanrec::JoinUser(ServerInstance, dest, parameters[1], true);
59 /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */
60 chanrec* n = ServerInstance->FindChan(parameters[1]);
65 ServerInstance->WriteOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
70 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]+" (User is probably banned, or blocking modes)");
76 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]);
82 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** No such nickname "+parameters[0]);
88 class ModuleSajoin : public Module
90 cmd_sajoin* mycommand;
92 ModuleSajoin(InspIRCd* Me)
96 mycommand = new cmd_sajoin(ServerInstance);
97 ServerInstance->AddCommand(mycommand);
100 virtual ~ModuleSajoin()
104 virtual Version GetVersion()
106 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
111 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
113 class ModuleSajoinFactory : public ModuleFactory
116 ModuleSajoinFactory()
120 ~ModuleSajoinFactory()
124 virtual Module * CreateModule(InspIRCd* Me)
126 return new ModuleSajoin(Me);
132 extern "C" void * init_module( void )
134 return new ModuleSajoinFactory;