/************************************************************************
* IRC - Internet Relay Chat, modules/m_jupiter.c
*
* Copyright (C) 2000-2003 TR-IRCD Development
*
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Co Center
*
* 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.
*/
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include "s_conf.h"
#include "h.h"
static char *token = TOK1_JUPITER;
static struct Message _msgtab[] = {
{MSG_JUPITER, 0, MAXPARA, M_SLOW, 0L,
m_unregistered, m_permission, o_jupiter, m_jupiter, m_jupiter}
};
#ifndef STATIC_MODULES
char *_version = "$Revision: 1.4 $";
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_jupiter_init(void)
{
mod_add_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = _msgtab;
}
#endif
int o_jupiter(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
if (ServerOpts.no_oper_jupiter)
return m_permission(cptr, sptr, parc, parv);
else
return m_jupiter(cptr, sptr, parc, parv);
}
int m_jupiter(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
aMaskItem *ami;
if (!(IsServer(sptr) || IsULine(sptr)))
return 0;
if (parc < 3) {
send_me_numeric(sptr, ERR_NEEDMOREPARAMS, MSG_JUPITER);
return 0;
}
/*
* get rid of redundancies
*/
parv[1] = collapse(parv[1]);
if ((ami = find_maskitem(parv[1], NULL, MASKITEM_JUPITER, 1)) == NULL) {
ami = create_maskitem(sptr->name, parv[1], NULL, MASKITEM_JUPITER, 0);
DupString(ami->reason, parv[2]);
}
logevent_call(LogSys.operevent, MSG_JUPITER, sptr, &parv, parc);
sendto_serv_butone(cptr, sptr, TOK1_JUPITER, "%s :%s", parv[1], parv[2]);
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1