1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
22 /* $ModDesc: Provides support for unreal-style SAJOIN command */
26 class cmd_sajoin : public command_t
29 cmd_sajoin (InspIRCd* Instance) : command_t(Instance,"SAJOIN", 'o', 2)
31 this->source = "m_sajoin.so";
32 syntax = "<nick> <channel>";
35 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
37 userrec* dest = ServerInstance->FindNick(parameters[0]);
40 if (ServerInstance->ULine(dest->server))
42 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
45 if (!ServerInstance->IsChannel(parameters[1]))
47 /* we didn't need to check this for each character ;) */
48 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
52 /* For local users, we send the JoinUser which may create a channel and set its TS.
53 * For non-local users, we just return CMD_SUCCESS, knowing this will propogate it where it needs to be
54 * and then that server will generate the users JOIN or FJOIN instead.
58 chanrec::JoinUser(ServerInstance, dest, parameters[1], true, "", ServerInstance->Time(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 ServerInstance->WriteOpers("*** "+std::string(user->nick)+" sent remote SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
88 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** No such nickname "+parameters[0]);
94 class ModuleSajoin : public Module
96 cmd_sajoin* mycommand;
98 ModuleSajoin(InspIRCd* Me)
102 mycommand = new cmd_sajoin(ServerInstance);
103 ServerInstance->AddCommand(mycommand);
106 virtual ~ModuleSajoin()
110 virtual Version GetVersion()
112 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
117 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
119 class ModuleSajoinFactory : public ModuleFactory
122 ModuleSajoinFactory()
126 ~ModuleSajoinFactory()
130 virtual Module * CreateModule(InspIRCd* Me)
132 return new ModuleSajoin(Me);
138 extern "C" void * init_module( void )
140 return new ModuleSajoinFactory;