/************************************************************************
* IRC - Internet Relay Chat, modules/rexcom/r_kline.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 "chanmode.h"
#include "sys.h"
#include "msg.h"
#include "h.h"
#include "hook.h"
static int do_rexcom_kline(struct hook_data *thisdata);
#ifndef STATIC_MODULES
void _modinit(void)
{
hook_add_hook("load rexcom core module", (hookfn *) do_rexcom_kline);
}
void _moddeinit(void)
{
hook_del_hook("load rexcom core module", (hookfn *) do_rexcom_kline);
}
char *_version = "$Revision: 1.3 $";
#else
void r_kline_init(void)
{
hook_add_hook("load rexcom core module", (hookfn *) do_rexcom_kline);
}
#endif
static int do_rexcom_kline(struct hook_data *thisdata)
{
int what;
char k = thisdata->statchar;
struct MaskItem *ami;
if ((k != 'K') && (k != 'k'))
return 0;
what = thisdata->check;
if (what == 1) {
if ((ami = find_maskitem(thisdata->mask, NULL, MASKITEM_KLINE_REGEX, 1)) == NULL) {
ami =
create_maskitem(thisdata->source_p->name, thisdata->mask, NULL,
MASKITEM_KLINE_REGEX, 0);
DupString(ami->reason, thisdata->data);
ireg_merge_pattern(ami, thisdata->len, thisdata->mask);
sendto_ops("%s added permanent regular expression kline to: %s", thisdata->source_p->name, thisdata->mask);
}
} else if (what == 2) {
terminate_maskitem(thisdata->mask, NULL, MASKITEM_KLINE_REGEX);
sendto_ops("%s removed regular expression kline from: %s", thisdata->source_p->name, thisdata->mask);
}
return 1;
}
syntax highlighted by Code2HTML, v. 0.9.1