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>
35 #include "sysdep_decls.h"
36 #include "citserver.h"
40 #include "serv_extensions.h"
46 #include "serv_network.h"
50 * This handler detects whether an incoming network message is from some
51 * moron user who the site operator has elected to filter out. If a match
52 * is found, the message is rejected.
54 int filter_the_idiots(struct CtdlMessage *msg, char *target_room) {
55 struct FilterList *fptr;
60 if ( (msg == NULL) || (filterlist == NULL) ) {
64 for (fptr = filterlist; fptr != NULL; fptr = fptr->next) {
70 if (msg->cm_fields['A'] != NULL) {
71 if ( (!strcasecmp(msg->cm_fields['A'], fptr->fl_user))
72 || (fptr->fl_user[0] == 0) ) {
77 if (msg->cm_fields['C'] != NULL) {
78 if ( (!strcasecmp(msg->cm_fields['C'], fptr->fl_room))
79 || (fptr->fl_room[0] == 0) ) {
84 if (msg->cm_fields['O'] != NULL) {
85 if ( (!strcasecmp(msg->cm_fields['O'], fptr->fl_room))
86 || (fptr->fl_room[0] == 0) ) {
91 if (msg->cm_fields['N'] != NULL) {
92 if ( (!strcasecmp(msg->cm_fields['N'], fptr->fl_node))
93 || (fptr->fl_node[0] == 0) ) {
98 if (zap_user + zap_room + zap_node == 3) return(1);
106 char *serv_netfilter_init(void)
108 CtdlRegisterNetprocHook(filter_the_idiots);
110 /* return our Subversion id for the Log */