4 * A server-side module for Citadel designed to filter idiots off the network.
6 * Copyright (c) 2002 / released under the GNU General Public License
17 #include <sys/types.h>
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
24 # include <sys/time.h>
33 #include <libcitadel.h>
36 #include "citserver.h"
45 #include "serv_network.h" /* Needed for defenition of FilterList */
48 #include "ctdl_module.h"
52 * This handler detects whether an incoming network message is from some
53 * moron user who the site operator has elected to filter out. If a match
54 * is found, the message is rejected.
56 int filter_the_idiots(struct CtdlMessage *msg, char *target_room) {
62 if ( (msg == NULL) || (filterlist == NULL) ) {
66 for (fptr = filterlist; fptr != NULL; fptr = fptr->next) {
72 if (msg->cm_fields['A'] != NULL) {
73 if ( (!strcasecmp(msg->cm_fields['A'], fptr->fl_user))
74 || (fptr->fl_user[0] == 0) ) {
79 if (msg->cm_fields['C'] != NULL) {
80 if ( (!strcasecmp(msg->cm_fields['C'], fptr->fl_room))
81 || (fptr->fl_room[0] == 0) ) {
86 if (msg->cm_fields['O'] != NULL) {
87 if ( (!strcasecmp(msg->cm_fields['O'], fptr->fl_room))
88 || (fptr->fl_room[0] == 0) ) {
93 if (msg->cm_fields['N'] != NULL) {
94 if ( (!strcasecmp(msg->cm_fields['N'], fptr->fl_node))
95 || (fptr->fl_node[0] == 0) ) {
100 if (zap_user + zap_room + zap_node == 3) return(1);
108 CTDL_MODULE_INIT(netfilter)
112 CtdlRegisterNetprocHook(filter_the_idiots);
115 /* return our Subversion id for the Log */