unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

svsjoin.c (2515B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/svsjoin.c
      3  *   (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
      4  *
      5  *   This program is free software; you can redistribute it and/or modify
      6  *   it under the terms of the GNU General Public License as published by
      7  *   the Free Software Foundation; either version 1, or (at your option)
      8  *   any later version.
      9  *
     10  *   This program is distributed in the hope that it will be useful,
     11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  *   GNU General Public License for more details.
     14  *
     15  *   You should have received a copy of the GNU General Public License
     16  *   along with this program; if not, write to the Free Software
     17  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18  */
     19 
     20 #include "unrealircd.h"
     21 
     22 CMD_FUNC(cmd_svsjoin);
     23 
     24 /* Place includes here */
     25 #define MSG_SVSJOIN       "SVSJOIN"
     26 
     27 ModuleHeader MOD_HEADER
     28   = {
     29 	"svsjoin",	/* Name of module */
     30 	"5.0", /* Version */
     31 	"command /svsjoin", /* Short description of module */
     32 	"UnrealIRCd Team",
     33 	"unrealircd-6",
     34     };
     35 
     36 /* This is called on module init, before Server Ready */
     37 MOD_INIT()
     38 {
     39 	CommandAdd(modinfo->handle, MSG_SVSJOIN, cmd_svsjoin, MAXPARA, CMD_USER|CMD_SERVER);
     40 	MARK_AS_OFFICIAL_MODULE(modinfo);
     41 	return MOD_SUCCESS;
     42 }
     43 
     44 /* Is first run when server is 100% ready */
     45 MOD_LOAD()
     46 {
     47 	return MOD_SUCCESS;
     48 }
     49 
     50 /* Called when module is unloaded */
     51 MOD_UNLOAD()
     52 {
     53 	return MOD_SUCCESS;	
     54 }
     55 
     56 /* cmd_svsjoin() - Lamego - Wed Jul 21 20:04:48 1999
     57    Copied off PTlink IRCd (C) PTlink coders team.
     58 	parv[1] - nick to make join
     59 	parv[2] - channel(s) to join
     60 	parv[3] - (optional) channel key(s)
     61 */
     62 CMD_FUNC(cmd_svsjoin)
     63 {
     64 	Client *target;
     65 
     66 	if (!IsSvsCmdOk(client))
     67 		return;
     68 
     69 	if ((parc < 3) || !(target = find_user(parv[1], NULL)))
     70 		return;
     71 
     72 	if (MyUser(target))
     73 	{
     74 		parv[0] = target->name;
     75 		parv[1] = parv[2];
     76 		if (parc == 3)
     77 		{
     78 			parv[2] = NULL;
     79 			do_cmd(target, NULL, "JOIN", 2, parv);
     80 			/* NOTE: 'target' may be killed if we ever implement spamfilter join channel target */
     81 		} else {
     82 			parv[2] = parv[3];
     83 			parv[3] = NULL;
     84 			do_cmd(target, NULL, "JOIN", 3, parv);
     85 			/* NOTE: 'target' may be killed if we ever implement spamfilter join channel target */
     86 		}
     87 	}
     88 	else
     89 	{
     90 		if (parc == 3)
     91 			sendto_one(target, NULL, ":%s SVSJOIN %s %s", client->name,
     92 			    parv[1], parv[2]);
     93 		else
     94 			sendto_one(target, NULL, ":%s SVSJOIN %s %s %s", client->name,
     95 				parv[1], parv[2], parv[3]);
     96 	}
     97 }