All pastes #260783 Raw Edit

Something

public cpp v1 · immutable
#260783 ·published 2006-11-28 18:10 UTC
rendered paste body
        #include <string.h>        #include "config.h"        #include "struct.h"        #include "common.h"        #include "sys.h"        #include "numeric.h"        #include "msg.h"        #include "proto.h"        #include "channel.h"        #include <time.h>        #include <sys/stat.h>        #include <stdio.h>        #include <stdlib.h>        #include <string.h>        #ifdef _WIN32        #include <io.h>        #endif        #include <fcntl.h>        #include "h.h"        #ifdef STRIPBADWORDS        #include "badwords.h"        #endif        #ifdef _WIN32        #include "version.h"        #endif        ModuleHeader MOD_HEADER(m_regexcept)          = {                "m_cidrban",                "v0.2",                "ExtBan ~C",                "3.2.3",                NULL            };        Extban *extbanC;        /* this one can remain the same */        char *extban_modeC_conv_param(char *para)        {                if (strstr(para,"~C:~")) {                        return NULL;                }                static char retbuf[64];                strlcpy(retbuf, para, sizeof(retbuf));                return retbuf;        };        int extban_modeC_is_banned(aClient *sptr, aChannel *chptr, char *xban, int type)        {                struct irc_netmask tmp;                struct irc_netmask *nmask;                char *tempchar = strtok(xban,"~C:");                tmp.type = parse_netmask(tempchar, &tmp);                if (&xban != NULL) {                       if (tmp.type != HM_HOST) {                        nmask = MyMallocEx(sizeof(struct irc_netmask));                        bcopy(&tmp, nmask, sizeof(struct irc_netmask));                        if (match_ip(sptr->ip,NULL, NULL, nmask)) {                                free(nmask);                                return 1;                         }                }        /* well the first thing we need is what the CIDR is */                free(nmask);                return 0;}DLLFUNC int MOD_INIT(m_cidrban)(ModuleInfo *modinfo){ExtbanInfo req;        memset(&req, 0, sizeof(ExtbanInfo));        req.flag = 'C';        req.conv_param = extban_modeC_conv_param;        req.is_banned = extban_modeC_is_banned;        extbanC = ExtbanAdd(modinfo->handle, req);        if (!extbanC)        {                config_error("m_regexcept module: adding extban ~C failed! module NOT loaded");                return MOD_FAILED;        }        ModuleSetOptions(modinfo->handle, MOD_OPT_PERM);        return MOD_SUCCESS;}DLLFUNC int MOD_LOAD(m_regexcept)(int module_load){        return MOD_SUCCESS;}DLLFUNC int MOD_UNLOAD(m_regexcept)(int module_unload){        ExtbanDel(extbanC);        return MOD_SUCCESS;}