/************************************************************************
* IRC - Internet Relay Chat, modules/m_svskill.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_svskill.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"
static char *token = TOK1_SVSKILL;
static struct Message _msgtab[] = {
{MSG_SVSKILL, 0, MAXPARA, M_SLOW, 0L,
m_unregistered, m_ignore, m_ignore, m_svskill, m_ignore}
};
#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_svskill_init(void)
{
mod_add_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = _msgtab;
}
#endif
/*
* m_svskill - Just about the same as outta df
* * - Raistlin
* * parv[0] = servername
* * parv[1] = client
* * parv[2] = nick stamp
* * parv[3] = kill message
*/
int m_svskill(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
aClient *acptr;
char *comment;
char reason[TOPICLEN + 1];
long ts = 0;
if (parc > 3) {
comment = parv[3] ? parv[3] : parv[0];
ts = atol(parv[2]);
} else
comment = (parc > 2 && parv[2]) ? parv[2] : parv[0];
if (!IsULine(sptr))
return -1;
if ((acptr = find_client(parv[1]))
&& (!ts || ts == acptr->tsval)) {
if (MyClient(acptr)) {
strcpy(reason, "Quit: ");
strlcpy_irc(reason + 6, comment, TOPICLEN - 11);
reason[TOPICLEN] = '\0';
return exit_client(acptr, sptr, reason);
}
if (acptr->from == cptr) {
sendto_lev(DEBUG_LEV,
"Received wrong-direction SVSKILL for %s (behind %s) from %s",
acptr->name, cptr->name, get_client_name(sptr, HIDEME));
return 0;
} else
sendto_serv_butone(cptr, sptr, TOK1_SVSKILL, "%~C :%s", acptr, comment);
}
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1