/************************************************************************ * IRC - Internet Relay Chat, modules/m_error.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_error.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 struct Message _msgtab[] = { {MSG_ERROR, 0, MAXPARA, M_SLOW, 0L, m_ignore, m_ignore, m_ignore, m_error, m_error} }; static char *token = TOK1_ERROR; static int log_error = -1; #ifndef STATIC_MODULES char *_version = "$Revision: 1.3 $"; void _modinit(void) { mod_add_cmd(_msgtab); tok1_msgtab[(u_char) *token].msg = _msgtab; log_error = logevent_register("ERROR", LOG_ON_LOG, LOG_ERRORLOG, LOG_ERROR, "Received ERROR message from %s: %s"); } void _moddeinit(void) { mod_del_cmd(_msgtab); tok1_msgtab[(u_char) *token].msg = NULL; logevent_unregister(log_error); } #else void m_error_init(void) { mod_add_cmd(_msgtab); tok1_msgtab[(u_char) *token].msg = _msgtab; log_error = logevent_register("ERROR", LOG_ON_LOG, LOG_ERRORLOG, LOG_ERROR, "Received ERROR message from %s: %s"); } #endif /* * * Note: At least at protocol level ERROR has only one parameter, * although this is called internally from other functions --msa * * parv[0] = sender prefix * parv[*] = parameters */ int m_error(aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *para; para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>"; logevent_call(log_error, sptr->name, para); if (cptr == sptr) sendto_operators(0, "Error", "from %C: %s", cptr, para); else sendto_operators(0, "Error", "from %C via %C: %s", sptr, cptr, para); return 0; }