unrealircd

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

sqline.c (2226B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/sqline.c
      3  *   (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
      4  *   Moved to modules by Fish (Justin Hammond)
      5  *
      6  *   This program is free software; you can redistribute it and/or modify
      7  *   it under the terms of the GNU General Public License as published by
      8  *   the Free Software Foundation; either version 1, or (at your option)
      9  *   any later version.
     10  *
     11  *   This program is distributed in the hope that it will be useful,
     12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14  *   GNU General Public License for more details.
     15  *
     16  *   You should have received a copy of the GNU General Public License
     17  *   along with this program; if not, write to the Free Software
     18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19  */
     20 
     21 #include "unrealircd.h"
     22 
     23 CMD_FUNC(cmd_sqline);
     24 
     25 /* Place includes here */
     26 #define MSG_SQLINE      "SQLINE"        /* SQLINE */
     27 
     28 
     29 
     30 ModuleHeader MOD_HEADER
     31   = {
     32 	"sqline",	/* Name of module */
     33 	"5.0", /* Version */
     34 	"command /sqline", /* Short description of module */
     35 	"UnrealIRCd Team",
     36 	"unrealircd-6",
     37     };
     38 
     39 /* This is called on module init, before Server Ready */
     40 MOD_INIT()
     41 {
     42 	CommandAdd(modinfo->handle, MSG_SQLINE, cmd_sqline, MAXPARA, CMD_SERVER);
     43 	MARK_AS_OFFICIAL_MODULE(modinfo);
     44 	return MOD_SUCCESS;
     45 }
     46 
     47 /* Is first run when server is 100% ready */
     48 MOD_LOAD()
     49 {
     50 	return MOD_SUCCESS;
     51 }
     52 
     53 
     54 /* Called when module is unloaded */
     55 MOD_UNLOAD()
     56 {
     57 	return MOD_SUCCESS;
     58 }
     59 
     60 /* cmd_sqline
     61  *	parv[1] = nickmask
     62  *	parv[2] = reason
     63  */
     64 CMD_FUNC(cmd_sqline)
     65 {
     66 	char mo[32];
     67 	const char *comment = (parc == 3) ? parv[2] : NULL;
     68 	const char *tkllayer[9] = {
     69 		me.name,        /*0  server.name */
     70 		"+",            /*1  +|- */
     71 		"Q",            /*2  G   */
     72 		"*" ,           /*3  user */
     73 		parv[1],        /*4  host */
     74 		client->name,     /*5  setby */
     75 		"0",            /*6  expire_at */
     76 		NULL,           /*7  set_at */
     77 		"no reason"     /*8  reason */
     78 	};
     79 
     80 	if (parc < 2)
     81 		return;
     82 
     83 	ircsnprintf(mo, sizeof(mo), "%lld", (long long)TStime());
     84 	tkllayer[7] = mo;
     85 	tkllayer[8] = comment ? comment : "no reason";
     86 	cmd_tkl(&me, NULL, 9, tkllayer);
     87 }