/************************************************************************ * IRC - Internet Relay Chat, modules/m_akill.c * * Copyright (C) 2000-2003 TR-IRCD Development * * Copyright (C) 1990 Jarkko Oikarinen and * University of Oulu, Co Center * * See file AUTHORS in IRC package for additional names of * the programmers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * $Id: m_akill.c,v 1.3 2003/06/14 13:55:51 tr-ircd Exp $ */ #include "struct.h" #include "common.h" #include "sys.h" #include "numeric.h" #include "msg.h" #include "channel.h" #include "h.h" #include "s_conf.h" static struct Message _msgtab[] = { {MSG_AKILL, 0, MAXPARA, M_SLOW, 0L, m_unregistered, m_ignore, m_ignore, m_akill, m_akill} }; static char *token = TOK1_AKILL; #ifndef STATIC_MODULES char *_version = "$Revision: 1.3 $"; void _modinit(void) { mod_add_cmd(_msgtab); tok1_msgtab[(u_char) *token].msg = _msgtab; } void _moddeinit(void) { mod_del_cmd(_msgtab); tok1_msgtab[(u_char) *token].msg = NULL; } #else void m_akill_init(void) { mod_add_cmd(_msgtab); tok1_msgtab[(u_char) *token].msg = _msgtab; } #endif /* * m_akill - * * Parse AKILL command * * parv[1]=host, parv[2]=user, parv[3]=length, parv[4]=akiller, parv[5]=time set, parv[6]=reason */ int m_akill(aClient *cptr, aClient *sptr, int parc, char *parv[]) { aMaskItem *ami, *ami2; char *user, *host, *reason, *akiller, buffer[1024], *current_date; time_t length = 0, timeset = 0; if (parc < 6) return 0; host = parv[1]; user = parv[2]; length = atoi(parv[3]); akiller = parv[4]; timeset = atoi(parv[5]); reason = (parv[6] ? parv[6] : ""); current_date = smalldate((time_t) timeset); /* * cut reason down a little, eh? * 250 chars max */ if (strlen(reason) > 250) reason[251] = 0; ami2 = find_maskitem(host, user, MASKITEM_AUTOKILL, 1); if (ami2 != NULL) { sendto_serv_butone(cptr, sptr, TOK1_AKILL, "%s %s %d %s %d :%s", host, user, length, akiller, timeset, reason); return 0; } ami = create_maskitem(akiller, host, user, MASKITEM_AUTOKILL, length); ircsprintf(buffer, "%s (%s)", reason, current_date); DupString(ami->reason, buffer); rehashed = 1; sendto_serv_butone(cptr, sptr, TOK1_AKILL, "%s %s %d %s %d :%s", host, user, length, akiller, timeset, reason); return 0; }