IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

 Kayıt ol  Topluluk
7Beğeni(ler)
  • 2 Post By Akcafesi
  • 1 Post By toXic
  • 2 Post By KTeknoloji
  • 1 Post By Akcafesi
  • 1 Post By KTeknoloji

Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 08 Ekim 2016, 12:10   #1
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
m_rmtkl ve adwords yardım




Aşadaki gibi hatalar almakdayım. yardımcı olacak kişilere şimdiden Teşekkürler.

PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
 -o m_rmtkl.so m_rmtkl.c
m_rmtkl
.c:44errorâtkl_del_lineâ redeclared as different kind of symbol
../include/h.h:731errorprevious declaration of âtkl_del_lineâ was here
m_rmtkl
.c:46errorâtkl_hashâ redeclared as different kind of symbol
../include/h.h:727errorprevious declaration of âtkl_hashâ was here
m_rmtkl
.c:116errorâtkl_check_local_remove_shunâ redeclared as different kind of symbol
../include/h.h:732errorprevious declaration of âtkl_check_local_remove_shunâ was here
make
[2]: *** [custommoduleError 1
make
[2]: Leaving directory `/home/unreal/Unreal3.2.10.6/src/modules'
make[1]: *** [custommodule] Error 2
make[1]: Leaving directory 
`/home/unreal/Unreal3.2.10.6/src'
make: *** [custommodule] Error 2
unreal[MENTION=729]irc[/MENTION].sohbetcafesi.net [~/Unreal3.2.10.6]# 


Buda adwords verilen hata


PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
make[2]: *** [custommoduleError 1
make
[2]: Leaving directory `/home/unreal/Unreal3.2.10.6/src/modules'
make[1]: *** [custommodule] Error 2
make[1]: Leaving directory 
`/home/unreal/Unreal3.2.10.6/src'
make: *** [custommodule] Error 2
unreal[MENTION=729]irc[/MENTION].sohbetcafesi.net [~/Unreal3.2.10.6]# 


 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları sohbet odaları Benimmekan Mobil Sohbet
Alt 09 Ekim 2016, 15:59   #2
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




Merhabalar gördüğüm kadarıyla modüllerin içinde türkçe karakter sorunları var ve bu yüzden derleme işlemi yapmamakta hata vermekte örnek. m_rmtkl.c:44: error: âtkl_del_lineâ
burda gördüğünüz gibi. isterseniz pm yolu ile iletişime geçerseniz gerekli düzeltmeleri yapabiliriz.
Saygılarımla.

 
Alıntı ile Cevapla

Alt 09 Ekim 2016, 16:45   #3
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




KralShell Nickli Üyeden Alıntı
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
Merhabalar gördüğüm kadarıyla modüllerin içinde türkçe karakter sorunları var ve bu yüzden derleme işlemi yapmamakta hata vermekte örnek. m_rmtkl.c:44: error: âtkl_del_lineâ
burda gördüğünüz gibi. isterseniz pm yolu ile iletişime geçerseniz gerekli düzeltmeleri yapabiliriz.
Saygılarımla.



PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
/*
 * =================================================================
 * Filename:            m_rmtkl.c
 * Description:         Command /rmtkl
 * Author:        AngryWolf <angrywolf[MENTION=16847]Flash[/MENTION]mail.com>
 * Documentation:       m_rmtkl.txt (comes with the package)
 * =================================================================
 */

#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.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

#ifndef MODVAR /* Unreal3.2.1 */
 #define MODVAR
#endif

#define IsParam(x)      (parc > (x) && !BadPtr(parv[(x)]))
#define IsNotParam(x)   (parc <= (x) || BadPtr(parv[(x)]))
#define DelCommand(x)    if (x) CommandDel(x); x = NULL

extern void        sendto_one(aClient *tochar *pattern, ...);
extern void        sendto_serv_butone_token(aClient *onechar *prefixchar *commandchar *tokenchar *pattern, ...);
extern aTKline        *tkl_del_line(aTKline *tkl);
#ifdef TKLISTLEN /* Unreal3.2-RC1 */
extern MODVAR int    tkl_hash(char c);
extern MODVAR aTKline    *tklines[TKLISTLEN];
#else
extern aTKline        *tklines;
#endif

static int        m_rmtkl(aClient *cptraClient *sptrint parcchar *parv[]);

Command            *CmdRmtkl NULL;

ModuleHeader MOD_HEADER(m_rmtkl)
  = {
    
"rmtkl",
    
"$Id: m_rmtkl.c,v 3.3 2004/08/30 13:55:54 angrywolf Exp $",
    
"command /rmtkl",
    
"3.2-b8-1",
    
NULL 
    
};


DLLFUNC int MOD_INIT(m_rmtkl)(ModuleInfo *modinfo)
{
    if (
CommandExists("RMTKL"))
        {
        
config_error("Command RMTKL already exists");
        return 
MOD_FAILED;
        }

    
CmdRmtkl CommandAdd(modinfo->handle"RMTKL"NULLm_rmtkl30);
//    CmdRmtkl = CommandAdd(modinfo->handle, "RMTKL", NULL, m_rmtkl, MAXPARA, 0);

#ifndef STATIC_LINKING
    
if (ModuleGetError(modinfo->handle) != MODERR_NOERROR || !CmdRmtkl)
#else
    
if (!CmdRmtkl)
#endif
    
{
#ifndef STATIC_LINKING
        
config_error("Error adding command RMTKL: %s",
            
ModuleGetErrorStr(modinfo->handle));
#else
        
config_error("Error adding command RMTKL");
#endif
        
return MOD_FAILED;
    }

    return 
MOD_SUCCESS;
}

DLLFUNC int MOD_LOAD(m_rmtkl)(int module_load)
{
    return 
MOD_SUCCESS;
}


DLLFUNC int MOD_UNLOAD(m_rmtkl)(int module_unload)
{
    
DelCommand(CmdRmtkl);
    return 
MOD_SUCCESS;
}

/*
 * =================================================================
 * tkl_check_local_remove_shun:
 *     Copied from src/s_kline.c (because it's declared statically,
 *     but I want to use it).
 * =================================================================
 */

static void tkl_check_local_remove_shun(aTKline *tmp)
{
    
long i1i;
    
char *chost, *cname, *cip;
    
int  is_ip;
    
aClient *acptr;

    for (
i1 0i1 <= 5i1++)
    {
        for (
0<= LastSlot; ++i)
        {
            if ((
acptr local[i]))
                if (
MyClient(acptr) && IsShunned(acptr))
                {
                    
chost acptr->sockhost;
                    
cname acptr->user->username;

    
                    
cip = (char *)Inet_ia2p(&acptr->ip);

                    if (!(*
tmp->hostmask '0') && (*tmp->hostmask '9'))
                        
is_ip 1;
                    else
                        
is_ip 0;

                    if (
is_ip ==
                        
? (!match(tmp->hostmask,
                        
chost)
                        && !
match(tmp->usermask,
                        
cname)) : (!match(tmp->
                        
hostmaskchost)
                        || !
match(tmp->hostmask,
                        
cip))
                        && !
match(tmp->usermask,
                        
cname))
                    {
                        
ClearShunned(acptr);
#ifdef SHUN_NOTICES
                        
sendto_one(acptr,
                            
":%s NOTICE %s :*** You are no longer shunned",
                            
me.name,
                            
acptr->name);
#endif
                    
}
                }
        }
    }
}

/*
 * =================================================================
 * my_tkl_del_line:
 *     Modified version of tkl_del_line (from src/s_kline.c),
 *     because using loops is unnecessary here). Also, I don't
 *     delete any spamfilter entries with this module either.
 * =================================================================
 */

#ifdef TKLISTLEN /* Unreal3.2-RC1 */
void my_tkl_del_line(aTKline *pint tklindex)
{
    
MyFree(p->hostmask);
    
MyFree(p->reason);
    
MyFree(p->setby);
 
#ifdef OFLAG_ADDLINE /* Unreal3.2.1 */
    
if ((p->type TKL_KILL || p->type TKL_ZAP || p->type TKL_SHUN)
        && 
p->ptr.netmask)
        
MyFree(p->ptr.netmask);
 
#endif
    
DelListItem(ptklines[tklindex]);
    
MyFree(p);
}
#endif

/*
 * =================================================================
 * dumpit:
 *     Dump a NULL-terminated array of strings to user sptr using
 *     the numeric rplnum, and then return 0.
 *     (Taken from DarkFire IRCd)
 * =================================================================
 */

static int dumpit(aClient *sptrchar **p)
{
        for (; *
!= NULLp++)
                
sendto_one(sptr":%s %03d %s :%s",
                        
me.nameRPL_TEXTsptr->name, *p);
        
/* let user take 8 seconds to read it! */
        
sptr->since += 8;
        return 
0;
}

/* help for /rmtkl command */

static char *rmtkl_help[] =
{
    
"*** Help on /rmtkl *** ",
    
"COMMAND - Removes all TKLs matching the given conditions from the",
    
"local server or the IRC Network depending on it's a global ban or not.",
    
"With this command you can remove any type of TKLs (including K:Line",
    
"G:Line, Z:Line, Global Z:Line and Shun).",
    
"Syntax:",
    
"    /rmtkl type user@host [comment]",
    
"The type field may contain any number of the following characters:",
    
"    K, z, G, Z, q, Q and *",
    
"    (asterix includes every types but q & Q).",
    
"The user@host field is a wildcard mask to match an user@host which",
        
"    a ban was set on.",
    
"The comment field is also wildcard mask that you can match the",
    
"    text of the reason for a ban.",
    
"Examples:",
    
"    - /rmtkl * *",
    
"        [remove all TKLs but q and Q lines]",
    
"    - /rmtkl GZ *@*.mx",
    
"        [remove all Mexican G/Z:Lines]",
    
"    - /rmtkl * * *Zombie*",
    
"        [remove all non-nick bans having Zombie in their reasons]",
    
"*** End of help ***",
    
NULL
};

// =================================================================
// Array of TKL types
// =================================================================

typedef struct _tkl_type TKLType;

struct _tkl_type
{
    
int    type;
    
char    flag;
    
char    *txt;
    
u_long    oflag;
};

TKLType tkl_types[] =
{
    { 
TKL_KILL,            'K',    "K:Line",        OFLAG_KLINE    },
    { 
TKL_ZAP,            'z',    "Z:Line",        OFLAG_ZLINE    },
    { 
TKL_KILL TKL_GLOBAL,    'G',    "G:Line",        OFLAG_TKL    },
    { 
TKL_ZAP TKL_GLOBAL,        'Z',    "Global Z:Line",    OFLAG_GZL    },
    { 
TKL_SHUN TKL_GLOBAL,    's',    "Shun",            OFLAG_TKL    },
#ifdef TKL_NICK
    
TKL_NICK,            'q',    "Q:Line",        OFLAG_TKL    },
    { 
TKL_NICK TKL_GLOBAL,    'Q',    "Global Q:Line",    OFLAG_TKL    },
#endif
    
0,                0,    "Unknown *:Line",    0        },
};

#ifndef TKLISTLEN /* Unreal3.2-RC1 */
static TKLType *find_TKLType_by_type(int type)
{
    
TKLType *t;

    for (
tkl_typest->typet++)
        if (
t->type == type)
            break;

    return 
t;
}
#endif

static TKLType *find_TKLType_by_flag(char flag)
{
    
TKLType *t;

    for (
tkl_typest->typet++)
        if (
t->flag == flag)
            break;

    return 
t;
}

/*
 * =================================================================
 * m_rmtkl -- Remove all matching TKLs from the network
 *     parv[0] = sender prefix
 *     parv[1] = ban types
 *     parv[2] = userhost mask
 *     parv[3] = comment mask (optional)
 * =================================================================
 */

static int m_rmtkl(aClient *cptraClient *sptrint parcchar *parv[])
{
    
aTKline        *tk, *next NULL;
    
TKLType        *tkltype;
    
char        *types, *uhmask, *cmask, *p;
    
char        gmt[256], flag;
#ifdef TKLISTLEN /* Unreal3.2-RC1 */
    
int        tklindex;
#endif

    
if (!IsULine(sptr) && !(IsPerson(sptr) && IsAnOper(sptr)))
    {
        
sendto_one(sptrerr_str(ERR_NOPRIVILEGES), me.nameparv[0]);
        return -
1;
    }

    if (
IsNotParam(1))
        return 
dumpit(sptrrmtkl_help);

    if (
IsNotParam(2))
    {
        
/*
         * In this case we don't send the entire help text to
         * the client.
         */
        
sendto_one(sptr":%s NOTICE %s :Not enough parameters. "
            "Type /%s for help."
,
            
me.nameparv[0], "RMTKL");
        return 
0;
    }

    
types    parv[1];
    
uhmask    parv[2];
    
cmask    IsParam(3) ? parv[3] : NULL;

    
/* I don't add 'q' and 'Q' here. They are different. */
    
if (strchr(types'*'))
        
types "KzGZs";

    
/* check access */
    
if (!IsULine(sptr))
        for (
types; *pp++)
        {
            
tkltype find_TKLType_by_flag(*p);
            if (!
tkltype->type)
                continue;
            if (((
tkltype->type TKL_GLOBAL) && !IsOper(sptr))
                || !(
sptr->oflag tkltype->oflag))
            {
                
sendto_one(sptrerr_str(ERR_NOPRIVILEGES),
                    
me.nameparv[0]);
                return -
1;
            }
        }

#ifdef TKLISTLEN /* Unreal3.2-RC1 */
    
for (tkltype tkl_typestkltype->typetkltype++)
    {
        
flag        tkltype->flag;
        
tklindex    tkl_hash(flag);

        if (!
strchr(typesflag))
            continue;

        for (
tk tklines[tklindex]; tktk next)
        {
            
next tk->next;

            if (
tk->type != tkltype->type)
                continue;
 
#ifdef TKL_NICK
            
if (tk->type TKL_NICK)
            {
                
/*
                 * If it's a services hold (ie. NickServ is holding
                 * a nick), it's better not to touch it
                 */
                
if (*tk->usermask == 'H')
                    continue;
                if (
match(uhmasktk->hostmask))
                    continue;
            }
            else
 
#endif
                
if (match(uhmaskmake_user_host(tk->usermasktk->hostmask)))
                    continue;

            if (
cmask && _match(cmasktk->reason))
                continue;

            
strncpyzt(gmtasctime(gmtime((TS *)&tk->set_at)),
                
sizeof gmt);
            
iCstrip(gmt);

 
#ifdef TKL_NICK
            
if (tk->type TKL_NICK)
            {
                
sendto_snomask(SNO_TKL"%s removed %s %s (set at %s "
                    "- reason: %s)"
,
                    
sptr->nametkltype->txttk->hostmaskgmt,
                    
tk->reason);
                
ircd_log(LOG_TKL"%s removed %s %s (set at %s "
                    "- reason: %s)"
,
                    
sptr->nametkltype->txttk->hostmask,
                    
gmttk->reason);
            }
            else
            {
 
#endif
                
sendto_snomask(SNO_TKL"%s removed %s %s@%s (set at "
                    "%s - reason: %s)"
,
                    
sptr->nametkltype->txttk->usermask,
                    
tk->hostmaskgmttk->reason);
                
ircd_log(LOG_TKL"%s removed %s %s@%s (set at "
                    "%s - reason: %s)"
,
                    
sptr->nametkltype->txttk->usermask,
                    
tk->hostmaskgmttk->reason);
 
#ifdef TKL_NICK
            
}
 
#endif

            
if ((tk->type TKL_GLOBAL) && flag)
                
sendto_serv_butone_token(&meme.nameMSG_TKLTOK_TKL,
                    
"- %c %s %s %s",
                    
flagtk->usermasktk->hostmaskparv[0]);
            if (
tk->type TKL_SHUN)
                
tkl_check_local_remove_shun(tk);
            
my_tkl_del_line(tktklindex);
        }
    }
#else
    
for (tk tklinestktk = (aTKline *) next)
    {
        
next = (ListStruct *) tk->next;

        
tkltype find_TKLType_by_type(tk->type);
        
flag tkltype->flag;

        if (!
strchr(typesflag))
            continue;
        if (
match(uhmaskmake_user_host(tk->usermasktk->hostmask)))
            continue;
        if (
cmask && _match(cmasktk->reason))
            continue;

        
strncpyzt(gmtasctime(gmtime((TS *)&tk->set_at)), sizeof(gmt));
        
iCstrip(gmt);

        
sendto_snomask(SNO_TKL"%s removed %s %s@%s (set at %s - reason: %s)",
            
sptr->nametkltype->txttk->usermasktk->hostmaskgmt,
            
tk->reason);
        
ircd_log(LOG_TKL"%s removed %s %s@%s (set at %s - reason: %s)",
            
sptr->nametkltype->txttk->usermasktk->hostmaskgmt,
            
tk->reason);
        if ((
tk->type TKL_GLOBAL) && flag)
            
sendto_serv_butone_token(&meme.name,
                
MSG_TKLTOK_TKL,
                
"- %c %s %s %s",
                
flagtk->usermasktk->hostmaskparv[0]);

        if (
tk->type TKL_SHUN)
            
tkl_check_local_remove_shun(tk);
        
tkl_del_line(tk);
    }
#endif

    
return 0;






PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
/*
 * ==================================================================
 * Filename:             adwords.c
 * Description:          Anti-spam filtering
 * Written by:         AngryWolf <angrywolf[MENTION=16847]Flash[/MENTION]mail.com>
 * Documentation:        adwords.txt (comes with the package)
 * ==================================================================
 * Note that this is a modified version of UnrealIRCd's built-in
 * badword system which was written by the UnrealIRCd Team. This
 * means that I copied & modified some codes from src/badwords.c and
 * src/conf.c (they come with the Unreal3.2 package).
 * ==================================================================
 */

#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.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
#include "badwords.h"

extern void            sendto_one(aClient *tochar *pattern, ...);
extern void            sendto_serv_butone_token(aClient *onechar *prefixchar *commandchar *tokenchar *pattern, ...);

// =================================================================
// Macros
// =================================================================

#define MSG_ADWORDS        "ADWORDS"
#define TOK_ADWORDS        "WO"
#define DEF_REGFLAGS        (REG_ICASE | REG_EXTENDED)
#define BACKREF_TOKEN        '\\'
#define IsAlpha(x)        ((((x) >= 65) && ((x) <= 90)) || (((x) >= 97 ) && ((x) <= 122)))

#define ircfree(x)        if (x) MyFree(x); x = NULL
#define ircstrdup(x,y)        if (x) MyFree(x); if (!y) x = NULL; else x = strdup(y)
#define DelHook(x)        if (x) HookDel(x); x = NULL
#define DelOverride(cmd, ovr)    if (ovr && CommandExists(cmd)) CmdoverrideDel(ovr); ovr = NULL
#define DelCommand(x)        if (x) CommandDel(x); x = NULL

#define DelAdwordChannel(a)    DelListItem(a, AdwordsChannel); FreeAdword(a);
#define DelAdwordMessage(a)    DelListItem(a, AdwordsMessage); FreeAdword(a);
#define DelAdwordQuit(a)    DelListItem(a, AdwordsQuit); FreeAdword(a);
#ifdef HOOKTYPE_PRE_LOCAL_PART
 #define DelAdwordPart(a)    DelListItem(a, AdwordsPart); FreeAdword(a);
#endif

/* Default texts */
#define DEF_KILL_REASON        "User has been killed (Advertising)"
#define DEF_BAN_REASON        "User has been banned (Advertising)"
#define DEF_BLOCK_MSG        "Your message has been blocked (Advertising)"
#define DEF_WARNING_MSG        "Your message contains an advertisement, may have been censored"

/* Ban types */
#ifndef BAN_ACT_KILL
 #define NO_PLACE_HOST_BAN
 /* For backward compatibility */
 #define BAN_ACT_KILL        1
 #define BAN_ACT_KLINE        4
 #define BAN_ACT_ZLINE        5
 #define BAN_ACT_GLINE        6
 #define BAN_ACT_GZLINE        7
#else /* Unreal3.2-RC1 */
  #undef NO_PLACE_HOST_BAN
#endif

/* Message types */
#define MT_ALL            0
#define MT_PRIVMSG        1
#define MT_NOTICE        2
#define MT_CTCP            3
#define MT_NONCTCP        4

/* Command types */
#define CT_PRIVMSG        0
#define CT_NOTICE        1
#define CT_PART            2
#define CT_QUIT            3

/* User types */
#define UT_ALL            0
#define UT_REG            1
#define UT_NONREG        2

/* Word types */
#define WT_REGEX        0x1
#define WT_FAST            0x2
#define WT_FAST_L        0x4
#define WT_FAST_R        0x8

/* Notification methods */
#define NM_PRIVATE        0x00
#define NM_CHANNEL        0x01

// =================================================================
// Module header
// =================================================================

ModuleHeader MOD_HEADER(adwords)
  = {
    
"adwords",
    
"$Id: adwords.c,v 6.9 2004/07/02 15:31:52 angrywolf Exp $",
    
"anti-spam filtering",
    
"3.2-b8-1",
    
NULL 
    
};

// =================================================================
// Type definitions
// =================================================================

typedef struct _adword Adword;
typedef struct _myconf MyConf;
typedef struct _chlist ChanList;

struct _adword
{
    
Adword        *prev, *next;
    
char        *word, *replace, *channel;
    
u_short        type;
    
u_int        notify:1warn1block:1kill:1ban:1;
    
u_int        stoponmatch:1;
    
u_int        msgtype:3usertype:2;
    
regex_t     *expr;
};

struct _myconf
{
    
u_int        enable_adwords 1;
    
u_int        enable_notifications 1;
    
u_int        enable_bans 1;
    
u_int        enable_kills 1;
    
u_int        enable_blockings 1;
    
u_int        enable_warnings 1;
    
u_int        n_method 1;
    
u_int        require_mode_g 1;
    
int        ban_type4;
    
long        ban_period;
    
char        *channels;
    
char        *kill_reason;
    
char        *ban_reason;
    
char        *block_message;
    
char        *warning_message;
};

struct _chlist
{
    
ChanList    *prev, *next;
    
char        *channel;
};

// =================================================================
// Function definitions & variable declarations
// =================================================================

extern ConfigEntry    *config_find_entry(ConfigEntry *cechar *name);

static 
Command        *AddCommand(Module *modulechar *msgchar *tokeniFP func);
static 
int        m_adwords(aClient *cptraClient *sptrint parcchar *parv[]);
static 
int        cb_config_test(ConfigFile *, ConfigEntry *, intint *);
static 
int        cb_config_run(ConfigFile *, ConfigEntry *, int);
static 
int        cb_config_rehash();
static 
char        *cb_privmsg(aClient *, aClient *, aClient *, char *, int);
static 
char        *cb_chanmsg(aClient *, aClient *, aChannel *, char *, int);
static 
char        *cb_quit(aClient *sptrchar *comment);
#ifdef HOOKTYPE_PRE_LOCAL_PART
static char        *cb_partmsg(aClient *sptraChannel *chptrchar *comment);
#endif
#ifndef HOOKTYPE_PRE_LOCAL_QUIT
static Cmdoverride    *AddOverride(char *msgiFP cb);
static 
int        override_quit(Cmdoverride *, aClient *, aClient *, intchar *[]);
#endif
static void        adwords_event_kill(char *name);
static 
void        stats_wordlist(aClient *sptrAdword *wordlistchar wtype);
static 
char        *find_CmdType(u_int type);
static 
char        *find_BanType(int type);
#ifdef NO_PLACE_HOST_BAN
static char        *find_BanFlag(int type);
#endif
static char        find_MsgType(u_int type);
static 
char        find_WordFlag(u_int type);

static 
Hook        *HookConfTest, *HookConfRun, *HookConfRehash;
static 
Hook        *HookPrivMsg NULL, *HookChanMsg NULL;
#ifdef HOOKTYPE_PRE_LOCAL_PART
static Hook        *HookPrePart NULL;
#endif
#ifdef HOOKTYPE_PRE_LOCAL_QUIT
static Hook        *HookPreQuit NULL;
#endif

Adword            *AdwordsMessage NULL, *AdwordsChannel NULL, *AdwordsQuit NULL;
#ifdef HOOKTYPE_PRE_LOCAL_PART
Adword            *AdwordsPart NULL;
#endif

ConfigItem_except       *conf_exceptchan;
MyConf            myconf;
static 
char        nickbuf[NICKLEN+1];
Command            *CmdAdwords;
#ifndef HOOKTYPE_PRE_LOCAL_QUIT
Cmdoverride        *OvrQuit;
#endif

#ifndef STATIC_LINKING
static ModuleInfo    *MyModInfo;
 
#define MyMod        MyModInfo->handle
 #define SAVE_MODINFO    MyModInfo = modinfo;
#else
 #define MyMod        NULL
 #define SAVE_MODINFO
#endif

// =================================================================
// Functions related to the Adword struct
// =================================================================

static void FreeAdword(Adword *a)
{
    
MyFree(a->word);
    
ircfree(a->replace);
    
ircfree(a->channel);
    if (
a->expr)
    {
        
regfree(a->expr);
        
MyFree(a->expr);
    }

    
MyFree(a);
}

static 
Adword *adword_duplicate(Adword *aint regflags)
{
    
Adword *x;

    
= (Adword *) MyMalloc(sizeof(Adword));
        
memcpy(xasizeof(Adword));
    
x->word strdup(a->word);
    if (
a->replace)
            
x->replace strdup(a->replace);
    if (
a->channel)
            
x->channel strdup(a->channel);
    if (
a->expr)
    {
        
x->expr = (regex_t *) MyMallocEx(sizeof(regex_t));
        
regcomp(x->exprx->wordregflags);
    }

        return 
x;
}

static 
void AddExceptChan(char *mask)
{
        
ConfigItem_except *e;

        
= (ConfigItem_except *) MyMallocEx(sizeof(ConfigItem_except));
        
e->mask strdup(mask);

        
AddListItem(econf_exceptchan);
}

// =================================================================
// Functions related to loading/unloading configuration
// =================================================================

static void InitConf()
{
    
memset(&myconf0sizeof myconf);
    
memset(&nickbuf0sizeof nickbuf);

    
myconf.ban_type        BAN_ACT_KLINE;
    
myconf.ban_period    3600/* 1h */
        
conf_exceptchan         NULL;
}

static 
void FreeConf()
{
    
Adword            *a;
    
ListStruct        *next;
        
ConfigItem_except    *e;

    
/* myconf */

    
if (myconf.channels)
        
MyFree(myconf.channels);
    if (
myconf.kill_reason)
        
MyFree(myconf.kill_reason);
    if (
myconf.ban_reason)
        
MyFree(myconf.ban_reason);
    if (
myconf.block_message)
        
MyFree(myconf.block_message);
    if (
myconf.warning_message)
        
MyFree(myconf.warning_message);

    
/* adwords */

    
for (AdwordsChannela= (Adword *) next)
    {
        
next = (ListStruct *) a->next;
        
DelAdwordChannel(a);
    }
    for (
AdwordsMessagea= (Adword *) next)
    {
        
next = (ListStruct *) a->next;
        
DelAdwordMessage(a);
    }
    for (
AdwordsQuita= (Adword *) next)
    {
        
next = (ListStruct *) a->next;
        
DelAdwordQuit(a);
    }
#ifdef HOOKTYPE_PRE_LOCAL_PART
    
for (AdwordsParta= (Adword *) next)
    {
        
next = (ListStruct *) a->next;
        
DelAdwordPart(a);
    }
#endif
    /* channel exceptions */

        
for (conf_exceptchane= (ConfigItem_except *) next)
        {
                
next = (ListStruct *) e->next;
                
DelListItem(econf_exceptchan);
                
MyFree(e->mask);
                
MyFree(e);
        }
}

// =================================================================
// Module functions
// =================================================================

DLLFUNC int MOD_TEST(adwords)(ModuleInfo *modinfo)
{
    
SAVE_MODINFO
    HookConfTest 
HookAddEx(modinfo->handleHOOKTYPE_CONFIGTESTcb_config_test);

    return 
MOD_SUCCESS;
}

DLLFUNC int MOD_INIT(adwords)(ModuleInfo *modinfo)
{
    
SAVE_MODINFO
    InitConf
();

    
CmdAdwords    AddCommand(modinfo->handleMSG_ADWORDSTOK_ADWORDSm_adwords);
    
HookConfRun    HookAddEx(modinfo->handleHOOKTYPE_CONFIGRUNcb_config_run);
    
HookConfRehash    HookAddEx(modinfo->handleHOOKTYPE_REHASHcb_config_rehash);

    if (!
CmdAdwords)
        return 
MOD_FAILED;

    
HookPrivMsg    HookAddPCharEx(modinfo->handleHOOKTYPE_USERMSGcb_privmsg);
    
HookChanMsg    HookAddPCharEx(modinfo->handleHOOKTYPE_CHANMSGcb_chanmsg);
#ifdef HOOKTYPE_PRE_LOCAL_PART
    
HookPrePart    HookAddPCharEx(modinfo->handleHOOKTYPE_PRE_LOCAL_PARTcb_partmsg);
#endif
#ifdef HOOKTYPE_PRE_LOCAL_QUIT
    
HookPreQuit    HookAddPCharEx(modinfo->handleHOOKTYPE_PRE_LOCAL_QUITcb_quit);
#endif

    
return MOD_SUCCESS;
}

DLLFUNC int MOD_LOAD(adwords)(int module_load)
{
#ifndef HOOKTYPE_PRE_LOCAL_QUIT
    
if (!(OvrQuit AddOverride("quit"override_quit)))
        return 
MOD_FAILED;
#endif

    
return MOD_SUCCESS;
}

DLLFUNC int MOD_UNLOAD(adwords)(int module_unload)
{
    
FreeConf();

#ifdef HOOKTYPE_PRE_LOCAL_PART
    
DelHook(HookPrePart);
#endif
    
DelHook(HookChanMsg);
    
DelHook(HookPrivMsg);
    
DelHook(HookConfRehash);
    
DelHook(HookConfRun);
    
DelHook(HookConfTest);

#ifndef HOOKTYPE_PRE_LOCAL_QUIT
    
DelOverride("quit"OvrQuit);
#endif
    
DelCommand(CmdAdwords);

    return 
MOD_SUCCESS;
}

// =================================================================
// Types
// =================================================================

static char *find_CmdType(u_int type)
{
    switch(
type)
    {
        case 
CT_PRIVMSG:    return "PRIVMSG";
        case 
CT_NOTICE:        return "NOTICE";
        case 
CT_PART:        return "PART";
        case 
CT_QUIT:        return "QUIT";
    }

    return 
"???";
}

static 
char find_MsgType(u_int type)
{
    switch(
type)
    {
        case 
MT_ALL:        return 'a';
        case 
MT_PRIVMSG:    return 'p';
        case 
MT_NOTICE:        return 'n';
        case 
MT_CTCP:        return 'C';
        case 
MT_NONCTCP:    return 'N';
    }

    return 
'?';
}

static 
char find_WordFlag(u_int type)
{
    if (
type WT_FAST)
        return 
'F';
    else if (
type WT_REGEX)
        return 
'R';

    return 
'?';
}

static 
char find_UserType(u_int type)
{
    switch(
type)
    {
        case 
UT_ALL:        return 'a';
        case 
UT_REG:        return 'r';
        case 
UT_NONREG:        return 'n';
    }

    return 
'?';
}

static 
char *find_BanType(int type)
{
    switch(
type)
    {
        case 
BAN_ACT_KLINE:        return "kline";
        case 
BAN_ACT_GLINE:        return "gline";
        case 
BAN_ACT_ZLINE:        return "zline";
        case 
BAN_ACT_GZLINE:        return "gzline";
    }

    return 
"<none>";
}

#ifdef NO_PLACE_HOST_BAN
static char *find_BanFlag(int type)
{
    switch(
type)
    {
        case 
BAN_ACT_KLINE:        return "k";
        case 
BAN_ACT_GLINE:        return "G";
        case 
BAN_ACT_ZLINE:        return "z";
        case 
BAN_ACT_GZLINE:        return "Z";
    }

    return 
NULL;
}
#endif

static char *make_optlist(Adword *a)
{
    static 
char buf[11];
    
char *buf;

    if (
a->notify)        *(p++) = 'n';
    if (
a->warn)        *(p++) = 'w';
    if (
a->block)        *(p++) = 'b';
    if (
a->kill)        *(p++) = 'k';
    if (
a->ban)        *(p++) = 'B';
    if (
a->stoponmatch)    *(p++) = 's';
    if (
== buf)        *(p++) = '*';

    *
0;

    return 
buf;
}

// =================================================================
// Misc stuff
// =================================================================

static Command *AddCommand(Module *modulechar *msgchar *tokeniFP func)
{
    
Command *cmd;

    if (
CommandExists(msg))
        {
                    
config_error("Command %s already exists"msg);
                    return 
NULL;
        }
        if (
CommandExists(token))
    {
                    
config_error("Token %s already exists"token);
                    return 
NULL;
        }

    
cmd CommandAdd(modulemsgtokenfuncMAXPARA0);

#ifndef STATIC_LINKING
    
if (ModuleGetError(module) != MODERR_NOERROR || !cmd)
#else
    
if (!cmd)
#endif
    
{
#ifndef STATIC_LINKING
        
config_error("Error adding command %s: %s"msg,
            
ModuleGetErrorStr(module));
#else
        
config_error("Error adding command %s"msg);
#endif
        
return NULL;
    }

    return 
cmd;
}

#ifndef HOOKTYPE_PRE_LOCAL_QUIT
static Cmdoverride *AddOverride(char *msgiFP cb)
{
    
Cmdoverride *ovr CmdoverrideAdd(MyModmsgcb);

#ifndef STATIC_LINKING
        
if (ModuleGetError(MyMod) != MODERR_NOERROR || !ovr)
#else
    
if (!ovr)
#endif
    
{
#ifndef STATIC_LINKING
        
config_error("Error replacing command %s when loading module %s: %s",
            
msgMOD_HEADER(adwords).nameModuleGetErrorStr(MyMod));
#else
        
config_error("Error replacing command %s when loading module %s",
            
msgMOD_HEADER(adwords).name);
#endif
        
return NULL;
    }

    return 
ovr;
}
#endif

static u_int check_type(char *word)
{
    
/*
     * This code originally comes from src/s_conf.c,
     * with some modifications.
     */

    
u_int        type WT_FASTfasttype 0;
    
char        *p;

    for (
word; *pp++)
    {
        
/*
         * I use my own check for alphabetic characters.
         * The old one accepted character codes between
         * 65 and 123. That means ABCDEFGHIJKLMNOPQRSTU
         * WXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{ were
         * accepted. I don't want this.
         */
        
if (!IsAlpha(*p))
        {
            if ((
word == p) && (*== '*'))
            {
                
/* Asterisk at the left */
                
fasttype |= WT_FAST_L;
                continue;
            }
            if ((
p[1] == 0) && (*== '*'))
            {
                
/* Asterisk at the right */
                
fasttype |= WT_FAST_R;
                continue;
            }
            
type WT_REGEX;
            break;
        }
    }

    if (
type != WT_REGEX)
        
type |= fasttype;

    return 
type;
}

static 
u_int check_regex(ConfigEntry *ce_word)
{
    
/*
     * This code originally comes from src/s_conf.c,
     * with some modifications.
     */

    
int        errorcodeerrorbufsize;
    
u_int        errors 0;
    
char        *errorbuf;
    
regex_t        *expr;

    
expr = (regex_t *) MyMallocEx(sizeof(regex_t));
    
errorcode regcomp(exprce_word->ce_vardataDEF_REGFLAGS);
    if (
errorcode 0)
    {
        
errorbufsize regerror(errorcodeexprNULL0)+1;
        
errorbuf MyMalloc(errorbufsize);
        
regerror(errorcodeexprerrorbuferrorbufsize);
        
config_error("%s:%i: adwords::adword::%s contains an invalid regex: %s",
            
ce_word->ce_fileptr->cf_filename,
            
ce_word->ce_varlinenum,
            
ce_word->ce_varnameerrorbuf);
        
errors++;
        
MyFree(errorbuf);
    }
    
regfree(expr);
    
MyFree(expr);

    return 
errors;
}

static 
char *find_backref(char *string)
{
    
char *p;

    for (
string; *pp++)
    {
        if (
p[0] == BACKREF_TOKEN)
        {
            if (
!= string && p[-1] == BACKREF_TOKEN)
                continue;
            if (
p[1] >= '1' && p[1] <= '9')
                return 
p;
        }
    }

    return 
NULL;
}

static 
char *dump_fastword(u_int typechar *word)
{
    
u_int        wlength;
    
char        *wtmp, *p, *q;

    
wlength strlen(word) + 1;
    if (
type WT_FAST_L)
        
wlength--;
    if (
type WT_FAST_R)
        
wlength--;

    
wtmp = (char *) MyMalloc(wlength);
    for (
word; *pp++)
        if (*
!= '*')
            *(
q++) = *p;
    *
'\0';

    return 
wtmp;
}

// =================================================================
// Config file interfacing
// =================================================================

static int cb_config_rehash()
{
    
FreeConf();
    
InitConf();

    return 
1;
}

static 
int cb_config_test(ConfigFile *cfConfigEntry *ceint typeint *errs)
{
    
ConfigEntry    *ce_matchtype, *ce_word, *ce_replace, *cep, *cepp;
    
int        errors 0;
    
u_int        matchtype;

    if (
type != CONFIG_MAIN)
        return 
0;

    if (!
strcmp(ce->ce_varname"adwords"))
    {
        for (
cep ce->ce_entriescepcep cep->ce_next)
        {
            if (!
cep->ce_varname)
            {
                
config_error("%s:%i: blank adwords item",
                    
cep->ce_fileptr->cf_filename,
                    
cep->ce_varlinenum);
                
errors++;
            }
            else if (!
strcmp(cep->ce_varname"enable"))
            {
                for (
cepp cep->ce_entriesceppcepp cepp->ce_next)
                {
                    if (!
cepp->ce_varname)
                    {
                        
config_error("%s:%i: blank adwords::enable item",
                            
cepp->ce_fileptr->cf_filename,
                            
cepp->ce_varlinenum);    
                        
errors++;
                        continue;
                    }
                    if (!
strcmp(cepp->ce_varname"adwords"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"bans"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"kills"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"blockings"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"notifications"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"warnings"))
                         ;
                    else
                    {
                        
config_error("%s:%i: unknown directive adwords::enable::%s",
                            
cepp->ce_fileptr->cf_filenamecepp->ce_varlinenum,
                            
cepp->ce_varname);
                        
errors++;
                    }
                }
            }
            else if (!
cep->ce_vardata)
            {
                
config_error("%s:%i: adwords::%s item without value",
                    
cep->ce_fileptr->cf_filename,
                    
cep->ce_varlinenumcep->ce_varname);
                
errors++;
            }
            else if (!
strcmp(cep->ce_varname"adword"))
            {
                
matchtype 0;

                if (!
strcmp(cep->ce_vardata"all"))
                    ;
                else if (!
strcmp(cep->ce_vardata"message"))
                    ;
                else if (!
strcmp(cep->ce_vardata"channel"))
                    ;
                else if (!
strcmp(cep->ce_vardata"quit"))
                    ;
#ifdef HOOKTYPE_PRE_LOCAL_PART
                
else if (!strcmp(cep->ce_vardata"part"))
                    ;
#endif
                
else
                {
                    
config_error("%s:%i: unknown adwords::adword type %s",
                        
cep->ce_fileptr->cf_filenamecep->ce_varlinenum,
                        
cep->ce_vardata);
                    
errors++;
                    continue;
                }

                
/* matchtype */
                
if ((ce_matchtype config_find_entry(cep->ce_entries"matchtype")))
                {
                    if (!
ce_matchtype->ce_vardata)
                    {
                        
config_error("%s:%i: adwords::adword::matchtype without contents",
                            
ce_matchtype->ce_fileptr->cf_filename,
                            
ce_matchtype->ce_varlinenum);
                        
errors++;
                        continue;
                    }

                    if (!
strcmp(ce_matchtype->ce_vardata"regex"))
                        
matchtype WT_REGEX;
                    else if (!
strcmp(ce_matchtype->ce_vardata"fast"))
                        
matchtype WT_FAST;
                    else if (!
strcmp(ce_matchtype->ce_vardata"auto"))
                        ;
                    else
                    {
                        
config_error("%s:%i: unknown adwords::adword::matchtype %s",
                            
ce_matchtype->ce_fileptr->cf_filename,
                            
ce_matchtype->ce_varlinenum,
                            
ce_matchtype->ce_vardata);
                        
errors++;
                        continue;
                    }
                }

                
/* word */
                
if (!(ce_word config_find_entry(cep->ce_entries"word")))
                {
                    
config_error("%s:%i: adwords::adword without word item",
                        
cep->ce_fileptr->cf_filenamecep->ce_varlinenum);
                    
errors++;
                    continue;
                }
                else if (!
ce_word->ce_vardata)
                {
                    
config_error("%s:%i: adwords::adword::word without contents",
                        
ce_word->ce_fileptr->cf_filenamece_word->ce_varlinenum);
                    
errors++;
                    continue;
                }
                else
                {
                    
u_int wordtype check_type(ce_word->ce_vardata);

                    if (!
matchtype)
                        ;
                    else if (
matchtype WT_FAST)
                    {
                        if (
wordtype WT_REGEX)
                        {
                            
config_error("%s:%i: adwords::adword::word contains invalid data (the fast badword replace system can do: \"blah\", \"*blah\", \"blah*\" and \"*blah*\", in all other cases use regex)",
                                
ce_word->ce_fileptr->cf_filename,
                                
ce_word->ce_varlinenum);
                            
errors++;
                        }
                    }
                    else
                        
errors += check_regex(ce_word);

                    if (
errors)
                        continue;
                }

                
/* replace */
                
if ((ce_replace config_find_entry(ce->ce_entries"replace")))
                {
                    if (!
ce_replace->ce_vardata)
                    {
                        
config_error("%s:%i: adwords::adword::replace without contents",
                            
ce_replace->ce_fileptr->cf_filename,
                            
ce_replace->ce_varlinenum);
                        
errors++;
                    }
                }

                for (
cepp cep->ce_entriesceppcepp cepp->ce_next)
                {
                    if (!
cepp->ce_varname)
                    {
                        
config_error("%s:%i: blank adwords::adword item",
                            
cepp->ce_fileptr->cf_filename,
                            
cepp->ce_varlinenum);    
                        
errors++;
                        continue;
                    }
                    if (!
strcmp(cepp->ce_varname"notify"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"warn"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"block"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"kill"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"ban"))
                         ;
                    else if (!
strcmp(cepp->ce_varname"stoponmatch"))
                         ;
                    else if (!
cepp->ce_vardata)
                    {
                        
config_error("%s:%i: adwords::adword::%s item without value",
                            
cepp->ce_fileptr->cf_filename,
                            
cepp->ce_varlinenumcepp->ce_varname);    
                        
errors++;
                        continue;
                    }
                    else if (!
strcmp(cepp->ce_varname"matchtype"))
                        ;
                    else if (!
strcmp(cepp->ce_varname"word"))
                        ;
                    else if (!
strcmp(cepp->ce_varname"replace"))
                        ;
                    else if (!
strcmp(cepp->ce_varname"channel"))
                        ;
                    else if (!
strcmp(cepp->ce_varname"msgtype"))
                    {
                        if (!
strcmp(cepp->ce_vardata"all"))
                            ;
                        else if (!
strcmp(cepp->ce_vardata"privmsg"))
                            ;
                        else if (!
strcmp(cepp->ce_vardata"notice"))
                            ;
                        else if (!
strcmp(cepp->ce_vardata"ctcp"))
                            ;
                        else if (!
strcmp(cepp->ce_vardata"non-ctcp"))
                            ;
                        else
                        {
                            
config_error("%s:%i: unknown adwords::adword::msgtype %s",
                                
cepp->ce_fileptr->cf_filenamecepp->ce_varlinenum,
                                
cepp->ce_vardata);
                            
errors++;
                        }
                    }
                    else if (!
strcmp(cepp->ce_varname"usertype"))
                    {
                        if (!
strcmp(cepp->ce_vardata"all"))
                            ;
                        else if (!
strcmp(cepp->ce_vardata"registered"))
                            ;
                        else if (!
strcmp(cepp->ce_vardata"non-registered"))
                            ;
                        else
                        {
                            
config_error("%s:%i: unknown adwords::adword::usertype %s",
                                
cepp->ce_fileptr->cf_filenamecepp->ce_varlinenum,
                                
cepp->ce_vardata);
                            
errors++;
                        }
                    }
                    else
                    {
                        
config_error("%s:%i: unknown directive adwords::adword::%s",
                            
cepp->ce_fileptr->cf_filenamecepp->ce_varlinenum,
                            
cepp->ce_varname);
                        
errors++;
                    }
                }
            }
            else if (!
strcmp(cep->ce_varname"notification-channels"))
                ;
            else if (!
strcmp(cep->ce_varname"notification-method"))
            {
                if (!
strcmp(cep->ce_vardata"channel"))
                    ;
                else if (!
strcmp(cep->ce_vardata"private"))
                    ;
                else
                {
                    
config_error("%s:%i: unknown notification method %s",
                        
cep->ce_fileptr->cf_filenamecep->ce_varlinenum,
                        
cep->ce_vardata);
                    
errors++;
                }
            }
            else if (!
strcmp(cep->ce_varname"require-mode-g"))
                ;
            else if (!
strcmp(cep->ce_varname"kill-reason"))
                ;
            else if (!
strcmp(cep->ce_varname"ban-reason"))
                ;
            else if (!
strcmp(cep->ce_varname"block-message"))
                ;
            else if (!
strcmp(cep->ce_varname"warning-message"))
                ;
            else if (!
strcmp(cep->ce_varname"ban-type"))
            {
                if (!
strcmp(cep->ce_vardata"kline"))
                    ;
                else if (!
strcmp(cep->ce_vardata"gline"))
                    ;
                else if (!
strcmp(cep->ce_vardata"zline"))
                    ;
                else if (!
strcmp(cep->ce_vardata"gzline"))
                    ;
                else
                {
                    
config_error("%s:%i: unknown ban type %s",
                        
cep->ce_fileptr->cf_filenamecep->ce_varlinenum,
                        
cep->ce_vardata);
                    
errors++;
                }
            }
            else if (!
strcmp(cep->ce_varname"ban-period"))
                ;
            else if (!
strcmp(cep->ce_varname"except"))
            {
                if (!
strcmp(cep->ce_vardata"channel"))
                {
                    if (!
config_find_entry(cep->ce_entries"mask"))
                    {
                        
config_error("%s:%i: adwords::except channel without mask item",
                            
cep->ce_fileptr->cf_filenamecep->ce_varlinenum);
                        
errors++;
                        continue;
                    }
                    for (
cepp cep->ce_entriesceppcepp cepp->ce_next)
                    {
                        if (!
cepp->ce_vardata)
                        {
                            
config_error("%s:%i: adwords::except channel item without contents",
                                
cepp->ce_fileptr->cf_filenamecepp->ce_varlinenum);
                            
errors++;
                            continue;
                        }
                        if (!
strcmp(cepp->ce_varname"mask"))
                            ;
                        else
                        {
                            
config_error("%s:%i: unknown adwords::except channel directive %s",
                                
cepp->ce_fileptr->cf_filenamecepp->ce_varlinenumcepp->ce_varname);
                            
errors++;
                            continue;
                        }
                    }
                }
            }
            else 
            {
                
config_error("%s:%i: unknown directive adwords::%s",
                    
cep->ce_fileptr->cf_filenamecep->ce_varlinenum,
                    
cep->ce_varname);
                
errors++;
            }
        }
        *
errs errors;
        return 
errors ? -1;
    }
    else
        return 
0;
}

static 
int cb_config_run(ConfigFile *cfConfigEntry *ceint type)
{
    
ConfigEntry    *cep, *cepp;

    if (
type != CONFIG_MAIN)
        return 
0;

    if (!
strcmp(ce->ce_varname"adwords"))
    {
        for (
cep ce->ce_entriescepcep cep->ce_next)
        {
            if (!
strcmp(cep->ce_varname"enable"))
            {
                for (
cepp cep->ce_entriesceppcepp cepp->ce_next)
                {
                    if (!
strcmp(cepp->ce_varname"adwords"))
                        
myconf.enable_adwords config_checkval(cepp->ce_vardataCFG_YESNO);
                    else if (!
strcmp(cepp->ce_varname"bans"))
                        
myconf.enable_bans config_checkval(cepp->ce_vardataCFG_YESNO);
                    else if (!
strcmp(cepp->ce_varname"kills"))
                        
myconf.enable_kills config_checkval(cepp->ce_vardataCFG_YESNO);
                    else if (!
strcmp(cepp->ce_varname"blockings"))
                        
myconf.enable_blockings config_checkval(cepp->ce_vardataCFG_YESNO);
                    else if (!
strcmp(cepp->ce_varname"notifications"))
                        
myconf.enable_notifications config_checkval(cepp->ce_vardataCFG_YESNO);
                    else if (!
strcmp(cepp->ce_varname"warnings"))
                        
myconf.enable_warnings config_checkval(cepp->ce_vardataCFG_YESNO);
                }
            }
            else if (!
strcmp(cep->ce_varname"notification-channels"))
            {
                
ircstrdup(myconf.channelscep->ce_vardata);
            }
            else if (!
strcmp(cep->ce_varname"notification-method"))
            {
                if (!
strcmp(cep->ce_vardata"channel"))
                    
myconf.n_method NM_CHANNEL;
                else if (!
strcmp(cep->ce_vardata"private"))
                    
myconf.n_method NM_PRIVATE;
            }
            else if (!
strcmp(cep->ce_varname"kill-reason"))
            {
                if (
strcmp(cep->ce_vardata"no"))
                {
                    
ircstrdup(myconf.kill_reasoncep->ce_vardata);
                }
            }
            else if (!
strcmp(cep->ce_varname"ban-reason"))
            {
                if (
strcmp(cep->ce_vardata"no"))
                {
                    
ircstrdup(myconf.ban_reasoncep->ce_vardata);
                }
            }
            else if (!
strcmp(cep->ce_varname"block-message"))
            {
                if (
strcmp(cep->ce_vardata"no"))
                {
                    
ircstrdup(myconf.block_messagecep->ce_vardata);
                }
            }
            else if (!
strcmp(cep->ce_varname"warning-message"))
            {
                if (
strcmp(cep->ce_vardata"no"))
                {
                    
ircstrdup(myconf.warning_messagecep->ce_vardata);
                }
            }
            else if (!
strcmp(cep->ce_varname"require-mode-g"))
                
myconf.require_mode_g config_checkval(cep->ce_vardataCFG_YESNO);
            else if (!
strcmp(cep->ce_varname"ban-period"))
                
myconf.ban_period config_checkval(cep->ce_vardataCFG_TIME);
            else if (!
strcmp(cep->ce_varname"ban-type"))
            {
                if (!
strcmp(cep->ce_vardata"kline"))
                    
myconf.ban_type BAN_ACT_KLINE;
                else if (!
strcmp(cep->ce_vardata"gline"))
                    
myconf.ban_type BAN_ACT_GLINE;
                else if (!
strcmp(cep->ce_vardata"zline"))
                    
myconf.ban_type BAN_ACT_ZLINE;
                else if (!
strcmp(cep->ce_vardata"gzline"))
                    
myconf.ban_type BAN_ACT_GZLINE;
            }
            else if (!
strcmp(cep->ce_varname"except"))
            {
                if (!
strcmp(cep->ce_vardata"channel"))
                {
                    for (
cepp cep->ce_entriesceppcepp cepp->ce_next)
                        if (!
strcmp(cepp->ce_varname"mask"))
                            
AddExceptChan(cepp->ce_vardata);
                }
            }
            else if (!
strcmp(cep->ce_varname"adword"))
            {
                
ConfigEntry    *ce_matchtype, *ce_word, *ce_block;
                
Adword        *a;
                
int        regflags;

                
regflags DEF_REGFLAGS;
                
= (Adword *) MyMallocEx(sizeof(Adword));

                
/* block */
                
if ((ce_block config_find_entry(cep->ce_entries"block")))
                {
                    
a->block 1;
                    
regflags |= REG_NOSUB;
                }

                
/* matchtype */
                
if ((ce_matchtype config_find_entry(cep->ce_entries"matchtype")))
                {
                    if (!
strcmp(ce_matchtype->ce_vardata"regex"))
                        
a->type WT_REGEX;
                    else if (!
strcmp(ce_matchtype->ce_vardata"fast"))
                        
a->type WT_FAST;
                }

                
/* word */
                
if ((ce_word config_find_entry(cep->ce_entries"word")))
                {
                    if (!
a->type)
                        
a->type check_type(ce_word->ce_vardata);

                    if (
a->type WT_REGEX)
                    {
                        
ircstrdup(a->wordce_word->ce_vardata);
                        
a->expr = (regex_t *) MyMallocEx(sizeof(regex_t));
                        
regcomp(a->expra->wordregflags);
                    }
                    else
                    {
                        
/* We have to do this twice (because of "matchtype fast") */
                        
a->type check_type(ce_word->ce_vardata);
                        
a->word dump_fastword(a->typece_word->ce_vardata);
                    }
                }

                for (
cepp cep->ce_entriesceppcepp cepp->ce_next)
                {
                    if (!
strcmp(cepp->ce_varname"word"))
                        ;
                    else if (!
strcmp(cepp->ce_varname"block"))
                        ;
                    else if (!
strcmp(cepp->ce_varname"replace"))
                    {
                        
ircstrdup(a->replacecepp->ce_vardata);
                    }
                    else if (!
strcmp(cepp->ce_varname"channel"))
                    {
                        
ircstrdup(a->channelcepp->ce_vardata);
                    }
                    else if (!
strcmp(cepp->ce_varname"notify"))
                        
a->notify 1;
                    else if (!
strcmp(cepp->ce_varname"warn"))
                        
a->warn 1;
                    else if (!
strcmp(cepp->ce_varname"kill"))
                        
a->kill 1;
                    else if (!
strcmp(cepp->ce_varname"ban"))
                        
a->ban 1;
                    else if (!
strcmp(cepp->ce_varname"stoponmatch"))
                        
a->stoponmatch 1;
                    else if (!
strcmp(cepp->ce_varname"msgtype"))
                    {
                        if (!
strcmp(cepp->ce_vardata"all"))
                            
a->msgtype MT_ALL;
                        else if (!
strcmp(cepp->ce_vardata"privmsg"))
                            
a->msgtype MT_PRIVMSG;
                        else if (!
strcmp(cepp->ce_vardata"notice"))
                            
a->msgtype MT_NOTICE;
                        else if (!
strcmp(cepp->ce_vardata"ctcp"))
                            
a->msgtype MT_CTCP;
                        else if (!
strcmp(cepp->ce_vardata"non-ctcp"))
                            
a->msgtype MT_NONCTCP;
                    }
                    else if (!
strcmp(cepp->ce_varname"usertype"))
                    {
                        if (!
strcmp(cepp->ce_vardata"all"))
                            
a->usertype UT_ALL;
                        else if (!
strcmp(cepp->ce_vardata"registered"))
                            
a->usertype UT_REG;
                        else if (!
strcmp(cepp->ce_vardata"non-registered"))
                            
a->usertype UT_NONREG;
                    }
                }

                if (!
strcmp(cep->ce_vardata"message"))
                {
                    
AddListItem(aAdwordsMessage);
                }
                else if (!
strcmp(cep->ce_vardata"channel"))
                {
                    
AddListItem(aAdwordsChannel);
                }
                else if (!
strcmp(cep->ce_vardata"quit"))
                {
                    
AddListItem(aAdwordsQuit);
                }
#ifdef HOOKTYPE_PRE_LOCAL_PART
                
else if (!strcmp(cep->ce_vardata"part"))
                {
                    
AddListItem(aAdwordsPart);
                }
#endif
                
else if (!strcmp(cep->ce_vardata"all"))
                {
                    
AddListItem(aAdwordsMessage);
                    
AddListItem(adword_duplicate(aregflags), AdwordsChannel);
                    
AddListItem(adword_duplicate(aregflags), AdwordsQuit);
#ifdef HOOKTYPE_PRE_LOCAL_PART
                    
AddListItem(adword_duplicate(aregflags), AdwordsPart);
#endif
                
}
            }
        }
    }

    return 
0;
}

static 
int cb_stats(aClient *sptr)
{
    
sendto_one(sptr":%s %i %s :enable::adwords: %d",
        
me.nameRPL_TEXTsptr->namemyconf.enable_adwords);
    
sendto_one(sptr":%s %i %s :enable::bans: %d",
        
me.nameRPL_TEXTsptr->namemyconf.enable_bans);
    
sendto_one(sptr":%s %i %s :enable::kills: %d",
        
me.nameRPL_TEXTsptr->namemyconf.enable_kills);
    
sendto_one(sptr":%s %i %s :enable::blockings: %d",
        
me.nameRPL_TEXTsptr->namemyconf.enable_blockings);
    
sendto_one(sptr":%s %i %s :enable::notifications: %d",
        
me.nameRPL_TEXTsptr->namemyconf.enable_notifications);
    
sendto_one(sptr":%s %i %s :enable::warnings: %d",
        
me.nameRPL_TEXTsptr->namemyconf.enable_warnings);
    
sendto_one(sptr":%s %i %s :require-mode-g: %d",
        
me.nameRPL_TEXTsptr->namemyconf.require_mode_g);
    
sendto_one(sptr":%s %i %s :notification-method: %s",
        
me.nameRPL_TEXTsptr->name, (myconf.n_method == NM_PRIVATE) ? "private" : (myconf.n_method == NM_CHANNEL) ? "channel" "<unknown>");
    
sendto_one(sptr":%s %i %s :notification-channels: %s",
        
me.nameRPL_TEXTsptr->namemyconf.channels myconf.channels "<none>");
    
sendto_one(sptr":%s %i %s :kill-reason: %s",
        
me.nameRPL_TEXTsptr->namemyconf.kill_reason myconf.kill_reason DEF_KILL_REASON);
    
sendto_one(sptr":%s %i %s :ban-reason: %s",
        
me.nameRPL_TEXTsptr->namemyconf.ban_reason myconf.ban_reason DEF_BAN_REASON);
    
sendto_one(sptr":%s %i %s :block-message: %s",
        
me.nameRPL_TEXTsptr->namemyconf.block_message myconf.block_message DEF_BLOCK_MSG);
    
sendto_one(sptr":%s %i %s :warning-message: %s",
        
me.nameRPL_TEXTsptr->namemyconf.warning_message myconf.warning_message DEF_WARNING_MSG);
    
sendto_one(sptr":%s %i %s :ban-type: %s",
        
me.nameRPL_TEXTsptr->namefind_BanType(myconf.ban_type));
    
sendto_one(sptr":%s %i %s :ban-period: %s",
        
me.nameRPL_TEXTsptr->namepretty_time_val(myconf.ban_period));

    
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.namesptr->name'S');
    return 
0;
}

#ifdef NO_PLACE_HOST_BAN
void ban_client(aClient *cptrchar *typelong periodchar *reason)
{
    
char hostip[128], mo[100], mo2[100];
    
char *tkllayer[9] = {
        
me.name,    /*0  server.name */
        
"+",        /*1  +|- */
        
type,        /*2  ban type */
        
"*",        /*3  user */
        
NULL,        /*4  host */
        
NULL,
        
NULL,        /*6  expire_at */
        
NULL,        /*7  set_at */
        
NULL        /*8  reason */
    
};

    
strlcpy(hostipInet_ia2p(&cptr->ip), sizeof(hostip));

    
tkllayer[4] = hostip;
    
tkllayer[5] = me.name;
    
ircsprintf(mo"%li"period TStime());
    
ircsprintf(mo2"%li"TStime());
    
tkllayer[6] = mo;
    
tkllayer[7] = mo2;
    
tkllayer[8] = reason;

    
m_tkl(&me, &me9tkllayer);
    return;
}
#endif

/*
 * These stuffs are from src/badwords.c,
 * I modified them for my own purposes
 */

#ifndef SPAMFILTER_BAN_TIME
static char *our_strcasestr(char *haystackchar *needle)
{
    
int i;
    
int nlength strlen (needle);
    
int hlength strlen (haystack);

    if (
nlength hlength) return NULL;
    if (
hlength <= 0) return NULL;
    if (
nlength <= 0) return haystack;

    for (
0<= (hlength nlength); i++) {
        if (
strncasecmp (haystack ineedlenlength) == 0)
            return 
haystack i;
    }

    return 
NULL;
}
#endif

inline int my_fast_badword_match(Adword *adwordchar *line)
{
     
char *p;
    
int bwlen strlen(adword->word);
    if ((
adword->type WT_FAST_L) && (adword->type WT_FAST_R))
        return (
our_strcasestr(lineadword->word) ? 0);

    
line;
    while((
our_strcasestr(padword->word)))
    {
        if (!(
adword->type WT_FAST_L))
        {
            if ((
!= line) && isalnum(*(1)))
                goto 
next;
        }
        if (!(
adword->type WT_FAST_R))
        {
            if (
isalnum(*(bwlen)))
                goto 
next;
        }
        return 
1;
next:
        
+= bwlen;
    }
    return 
0;
}

/*
 * This code comes from src/badwords.c (fast_badword_replace
 * which was written by Syzop), I modified it a bit.
 * (Also made speed optimizations.)
 */

inline int my_fast_badword_replace(Adword *adwordchar *linechar *bufint max)
{
    
char    *searchw adword->word, *replacew adword->replace;
    
char    *pold line, *pnew buf;
    
char    *poldx line;
    
char    *startw, *endw;
    
char    *c_eol buf max 1;
    
int    replacensearchn;
    
int    cleaned 0;

    
replacen strlen(replacew);
    
searchn strlen(searchw);

    while (
1)
    {
        
pold our_strcasestr(poldsearchw);
        if (!
pold)
            break;
        
cleaned 1;
        
startw pold;
         if (
pold line)
        {
            while (
isalnum(*startw) && (startw != line))
                
startw--;
            if (!
isalnum(*startw))
                
startw++;
        }

        if (!(
adword->type WT_FAST_L) && (pold != startw))
        {
            
pold++;
            continue;
        }

        for (
endw pold; ((*endw != '\0') && (isalnum(*endw))); endw++);

        if (!(
adword->type WT_FAST_R) && (pold+searchn != endw))
        {
            
pold++;
            continue;
        }

        if (
poldx != startw)
        {
            
int tmp_n startw poldx;
            if (
pnew tmp_n >= c_eol)
            {
                
memcpy(pnewpoldxc_eol pnew);
                *
c_eol '\0';
                return 
1;
            }

            
memcpy(pnewpoldxtmp_n);
            
pnew += tmp_n;
        }

        if (
replacen)
        {
            if ((
pnew replacen) >= c_eol) {
                
memcpy(pnewreplacewc_eol pnew);
                *
c_eol '\0';
                return 
1;
            }
            
memcpy(pnewreplacewreplacen);
            
pnew += replacen;
        }
        
poldx pold endw;
    }

    if (*
poldx)
    {
        
strncpy(pnewpoldxc_eol pnew);
        *
c_eol '\0';
    }
    else
        *
pnew '\0';

    return 
cleaned;
}

/*
 * adword_checkmsg
 * ===============
 *
 * The badword checking stuff was copied from src/badwords.c,
 * I modified it a lot.
 */

#define SendNotice_channel \
        
sendto_channel_butone(&me, &mechptr, \
            
":%s PRIVMSG %s :[\2Adword\2] (%s:%s%s%s): %s", \
                    
me.namechptr->chnamefrom->name, \
            
cmdto ":" ""to to ""str)

#define SendNotice_private \
        
sendto_serv_butone_token(NULLme.nameMSG_GLOBOPSTOK_GLOBOPS, \
            
"[\2Adword\2] (%s:%s%s%s): %s", \
                    
from->namecmd, \
            
to ":" ""to to ""str); \
        
sendto_failops_whoare_opers( \
            
"[\2Adword\2] (%s:%s%s%s): %s", \
                    
from->namecmd, \
            
to ":" ""to to ""str)

static 
char *adword_checkmsg(aClient *cptraClient *fromchar *tochar *stru_int cmdtypeAdword *wordlist)
{
    static 
regmatch_t    pmatch[10];
    static 
char        cleanstr[4096], buf[4096];
    
char            *ptr, *ptr2, *backref;
    
int            matchlen 0stringlencleaned 0;
    
u_int            notify 0warn 0kill 0;
    
u_int            block 0ban 0ctcpi;
    
ChanList        *channels NULL, *ch;
    
Adword            *a;
    
ListStruct        *next;

    if (!
myconf.enable_adwords || !wordlist)
        return 
str;
    if (!
MyConnect(from) || !IsPerson(from) || IsAnOper(from))
        return 
str;

    
stringlen strlcpy(cleanstrStripControlCodes(str), sizeof cleanstr);

    
/* Check for adwords */

    
for (wordlistaa->next)
    {
        
/* 1. Some conditions before matching */

        
if (a->usertype == UT_REG && !IsRegNick(from))
            continue;
        if (
a->usertype == UT_NONREG && IsRegNick(from))
            continue;
        if (
cmdtype == CT_PRIVMSG || cmdtype == CT_NOTICE)
        {
            if (
a->msgtype == MT_NOTICE && cmdtype != CT_NOTICE)
                continue;
            if (
a->msgtype == MT_PRIVMSG && cmdtype == CT_NOTICE)
                continue;
            
ctcp = (*str == '\001' && str[strlen(str)-1] == '\001');
            if (
a->msgtype == MT_CTCP && !ctcp)
                continue;
            if (
a->msgtype == MT_NONCTCP && ctcp)
                continue;
        }

        
/* 2. Now try to match this word */

        
if (a->type WT_REGEX)
        {
            if (
regexec(a->exprcleanstr0NULL0))
                continue;
        }
        else
        {
            if (!
my_fast_badword_match(acleanstr))
                continue;
        }

        
/* 3. Check certain things if matched */

        
notify    |= a->notify;
        
warn    |= a->warn;
        
kill    |= a->kill;
        
ban    |= a->ban;
        
block    |= a->block;

        if (
myconf.enable_notifications &&
            (
myconf.n_method == NM_CHANNEL) && notify && a->channel)
        {
            
ch = (ChanList *) MyMallocEx(sizeof(ChanList));
            
ch->channel a->channel;
            
AddListItem(chchannels);
        }

        
/* 4. Do the replaces if needed */

        
if (a->replace && !block)
        {
            
buf[0] = 0;

            if (
a->type WT_REGEX)
            {
                
ptr cleanstr;

                if (!
find_backref(a->replace))
                {
                    while (!
regexec(a->exprptr1pmatch0))
                    {
                        if (
pmatch[0].rm_so == -1)
                            break;
                        
cleaned 1;
                        
matchlen += pmatch[0].rm_eo pmatch[0].rm_so;
                        
strlncat(bufptrsizeof bufpmatch[0].rm_so);
                        
strlcat(bufa->replacesizeof buf); 
                        
ptr += pmatch[0].rm_eo;
                    }
                }
                else
                {
                    while (!
regexec(a->exprptr10pmatch0))
                    {
                        if (
pmatch[0].rm_so == -1)
                            break;

                        
cleaned 1;
                        
matchlen += pmatch[0].rm_eo pmatch[0].rm_so;
                        
strlncat(bufptrsizeof bufpmatch[0].rm_so);
                        
ptr2 a->replace;

                        for (
backref find_backref(ptr2); backrefbackref find_backref(ptr2))
                        {
                            
backref[1] - '0';
                            
strlncat(bufptr2sizeof bufbackref ptr2);
                            if (
pmatch[i].rm_so != -1)
                                
strlncat(bufptr pmatch[i].rm_sosizeof buf,
                                    
pmatch[i].rm_eo pmatch[i].rm_so);
                            
ptr2 backref 2;
                        }

                        
strlcat(bufptr2sizeof buf);
                        
ptr += pmatch[0].rm_eo;
                    }
                }

                
strlcat(bufptrsizeof buf);
                
strcpy(cleanstrbuf);
                if (
matchlen == stringlen)
                    break;
            }
            else
            {
                
cleaned |= my_fast_badword_replace(acleanstrbuf512);
                
strcpy(cleanstrbuf);
            }
        }

        
/* 5. Post-checkings */

        
if (a->stoponmatch)
            break;
    }

    
/* Do other actions */

    
if (myconf.enable_notifications && notify)
    {
        
char *cmd find_CmdType(cmdtype);

        if (
myconf.n_method == NM_CHANNEL)
        {
            
char        *tmp, *name, *NULL;
            
aChannel    *chptr;

            if (
myconf.channels)
            {
                
tmp strdup(myconf.channels);

                    for (
name strtoken(&ptmp","); namename strtoken(&pNULL","))
                            if ((
chptr find_channel(nameNullChn)) != NullChn)
                        
SendNotice_channel;

                
MyFree(tmp);
            }

            for (
ch channelschch = (ChanList *) next)
            {
                
next = (ListStruct *) ch->next;

                        if ((
chptr find_channel(ch->channelNullChn)) != NullChn)
                    
SendNotice_channel;

                
DelListItem(chchannels);
                
MyFree(ch);
            }
        }
        else
        {
            
SendNotice_private;
        }
    }

    if (
myconf.enable_bans && ban)
    {
#ifndef NO_PLACE_HOST_BAN
        
place_host_ban(frommyconf.ban_type,
                
myconf.ban_reason myconf.ban_reason
                    
DEF_BAN_REASON,
                
myconf.ban_period);
#else
        
char *bantype;

        if ((
bantype find_BanFlag(myconf.ban_type)))
            
ban_client(frombantypemyconf.ban_period,
                
myconf.ban_reason myconf.ban_reason
                    
DEF_BAN_REASON);
#endif
    
}
    else if ((
cmdtype != CT_QUIT) && myconf.enable_kills && kill)
    {
        
/*
         * Can't find a better solution for killing a user due to an adword;
         * using the Event system seems to be working. The problem actually
         * is we shouldn't kill a user more than one time (fe. when ppl use
         * multiple targets in a PRIVMSG/NOTICE).
         */
        
strcpy(nickbuffrom->name);
        
EventAdd("adwords_kill"01, &adwords_event_killnickbuf);
    }
    else if (
myconf.enable_warnings && warn)
    {
        if (
myconf.enable_blockings && block)
            
sendto_one(from":%s NOTICE %s :%s",
                
me.namefrom->namemyconf.block_message ?
                    
myconf.block_message DEF_BLOCK_MSG);
        else
            
sendto_one(from":%s NOTICE %s :%s",
                
me.namefrom->namemyconf.warning_message ?
                    
myconf.warning_message DEF_WARNING_MSG);
    }

    
cleanstr[511] = '\0'/* cutoff, just to be sure */

    
return (myconf.enable_blockings && block) ?
        
NULL cleaned cleanstr str;
}


/*
 * cb_privmsg
 * ==========
 *
 * from:    who is sending the message
 * to:        who will receive it
 * str:        message text
 * notice:    tells whether it's a notice or privmsg
 */

static char *cb_privmsg(aClient *cptraClient *fromaClient *tochar *strint notice)
{
    if (!
IsClient(from) || IsULine(from) || IsULine(to)
        || (
myconf.require_mode_g && !IsFilteringWords(to)))
        return 
str;

    return 
adword_checkmsg(cptrfromto->namestr,
        
notice CT_NOTICE CT_PRIVMSGAdwordsMessage);
}

/*
 * cb_chanmsg
 * ==========
 *
 * from:    who is sending the message
 * to:        the channel where it will be sent to
 * str:        message text
 * notice:    tells whether it's a notice or privmsg
 */

static char *cb_chanmsg(aClient *cptraClient *fromaChannel *tochar *strint notice)
{
    
ConfigItem_except    *e;

    if (!
IsClient(from) || IsULine(from) || (myconf.require_mode_g
        
&& !(to->mode.mode MODE_STRIPBADWORDS)))
        return 
str;

    for (
conf_exceptchane= (ConfigItem_except *) e->next)
        if (!
match(e->maskto->chname))
            return 
str;

    return 
adword_checkmsg(cptrfromto->chnamestr,
        
noticeCT_NOTICE CT_PRIVMSGAdwordsChannel);
}

/*
 * cb_quit
 * =======
 *
 * sptr:    who is sending the message
 * comment:    message text
 */

static char *cb_quit(aClient *sptrchar *comment)
{
    
Membership *lp;

    if (
IsULine(sptr))
        return 
comment;

    if (
myconf.require_mode_g)
    {
        
u_int strip 0;

        for (
lp sptr->user->channellplp lp->next)
                if (
lp->chptr->mode.mode MODE_STRIPBADWORDS)
            {
                
strip 1;
                break;
            }

        if (!
strip)
            return 
comment;
    }

    return 
adword_checkmsg(sptrsptrNULLcomment,
        
CT_QUITAdwordsQuit);
}

#ifndef HOOKTYPE_PRE_LOCAL_QUIT
/* ugly */
int override_quit(Cmdoverride *ovraClient *cptraClient *sptrint parcchar *parv[])
{
    
char *ocomment = (parc && parv[1]) ? parv[1] : parv[0];
    static 
char comment[TOPICLEN 1];
    
Membership *lp;

    if (!
IsServer(cptr) && IsPerson(sptr))
    {
#ifdef STRIPBADWORDS
        
int blocked 0;
#endif
        
char *comment;
        if (
STATIC_QUIT)
        {
            return 
exit_client(cptrsptrsptrSTATIC_QUIT);
        }
        if (!
prefix_quit || strcmp(prefix_quit"no"))
            
ircsprintf(comment"%s ",
                    
BadPtr(prefix_quit) ? "Quit:" prefix_quit);
#ifdef STRIPBADWORDS
        
ocomment = (char *)stripbadwords_quit(ocomment, &blocked);
        if (
blocked)
            
ocomment parv[0];
#endif
        
ocomment cb_quit(sptrocomment);
        if (!
ocomment)
            
ocomment parv[0];
        if (!
IsAnOper(sptr) && ANTI_SPAM_QUIT_MSG_TIME)
            if (
sptr->firsttime+ANTI_SPAM_QUIT_MSG_TIME TStime())
                
ocomment parv[0];

        
/* Strip color codes if any channel is +S, use nick as reason if +c. */
        
if (IsPerson(sptr) && (strchr(ocomment'\003')))
        {
            
unsigned char filtertype 0/* 1=filter, 2=block, highest wins. */
            
for (lp sptr->user->channellplp lp->next)
            {
                if (
lp->chptr->mode.mode MODE_NOCOLOR)
                {
                    
filtertype 2;
                    break;
                }
                if (
lp->chptr->mode.mode MODE_STRIP)
                {
                    if (!
filtertype)
                        
filtertype 1;
                }
            }
            if (
filtertype == 1)
            {
                
ocomment StripColors(ocomment);
                if (*
ocomment == '\0')
                    
ocomment parv[0];
            } else
            if (
filtertype == 2)
                
ocomment parv[0];
        } 
/* (strip color codes) */

        
strncpy(socommentTOPICLEN - (comment));
        
comment[TOPICLEN] = '\0';
        return 
exit_client(cptrsptrsptrcomment);
    }
    else
    {
        return 
exit_client(cptrsptrsptrocomment);
    }
}
#endif

#ifdef HOOKTYPE_PRE_LOCAL_PART
/*
 * cb_partmsg
 * ==========
 *
 * sptr:    who is sending the message
 * chptr:    the channel where it will be sent to
 * comment:    message text
 */

static char *cb_partmsg(aClient *sptraChannel *chptrchar *comment)
{
    
ConfigItem_except       *e;

    if (!
comment)
        return 
NULL;
    if (
IsULine(sptr) || (myconf.require_mode_g && !(chptr->mode.mode MODE_STRIPBADWORDS)))
        return 
comment;

    for (
conf_exceptchane= (ConfigItem_except *) e->next)
        if (!
match(e->maskchptr->chname))
            return 
comment;

    return 
adword_checkmsg(sptrsptrchptr->chnamecommentCT_PARTAdwordsPart);
}
#endif


/*
 * m_adwords
 * =========
 *
 * parv[0]:    sender prefix
 * parv[1]:    option
 * parv[2]:    value (optional)
 *
 */

static int m_adwords(aClient *cptraClient *sptrint parcchar *parv[])
{
        
ConfigItem_except    *NULL;

    if (!
MyConnect(sptr) || !IsPerson(sptr) || !IsAnOper(sptr))
    {
        
sendto_one(sptrerr_str(ERR_NOPRIVILEGES), me.nameparv[0]);
        return -
1;
    }
    if (
parc || BadPtr(parv[1]))
    {
        
sendto_one(sptr":%s NOTICE %s :Usage:",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :    /adwords <option>",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :Options:",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :    message: shows you the adword message block list",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :    channel: shows you the adword channel block list",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :    quit: shows you the adword quit block list",
            
me.namesptr->name);
#ifdef HOOKTYPE_PRE_LOCAL_PART
        
sendto_one(sptr":%s NOTICE %s :    part: shows you the adword part block list",
            
me.namesptr->name);
#endif
        
sendto_one(sptr":%s NOTICE %s :    all: shows you all the adword block list",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :    exceptions: shows you the except channel mask list",
            
me.namesptr->name);
        
sendto_one(sptr":%s NOTICE %s :    config: displays adwords configuration",
            
me.namesptr->name);
        return 
0;
    }
    if (!
strcasecmp(parv[1], "message"))
    {
        
stats_wordlist(sptrAdwordsMessage'M');
        
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.nameparv[0], 'a');
    }
    else if (!
strcasecmp(parv[1], "channel"))
    {
        
stats_wordlist(sptrAdwordsChannel'C');
        
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.nameparv[0], 'a');
    }
    else if (!
strcasecmp(parv[1], "quit"))
    {
        
stats_wordlist(sptrAdwordsQuit'Q');
        
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.nameparv[0], 'a');
    }
#ifdef HOOKTYPE_PRE_LOCAL_PART
    
else if (!strcasecmp(parv[1], "part"))
    {
        
stats_wordlist(sptrAdwordsPart'P');
        
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.nameparv[0], 'a');
    }
#endif
    
else if (!strcasecmp(parv[1], "all"))
    {
        
stats_wordlist(sptrAdwordsMessage'M');
        
stats_wordlist(sptrAdwordsChannel'C');
        
stats_wordlist(sptrAdwordsQuit'Q');
#ifdef HOOKTYPE_PRE_LOCAL_PART
        
stats_wordlist(sptrAdwordsPart'P');
#endif
        
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.nameparv[0], 'a');
    }
        else if (!
strcasecmp(parv[1], "exceptions"))
        {
                for (
conf_exceptchane= (ConfigItem_except *) e->next)
                        
sendto_one(sptr":%s %i %s :m %s",
                                
me.nameRPL_TEXTsptr->namee->mask);
                
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.nameparv[0], 'm');
        }
    else if (!
strcasecmp(parv[1], "config"))
        
cb_stats(sptr);
    else
    {
        
sendto_one(sptr":%s NOTICE %s :Unknown option %s."
            " Valid options are: message | channel | all | exceptions | config"
,
            
me.namesptr->nameparv[1]);
        return -
1;
    }

    return 
0;
}

static 
void stats_wordlist(aClient *sptrAdword *wordlistchar wtype)
{
    
Adword *a;

    for (
wordlista= (Adword *) a->next)
        
sendto_one(sptr":%s %i %s :a %c %c %c %c %s %s%s%s" "%s%s" "%s%s",
            
me.nameRPL_TEXTsptr->name,
            
wtype,
            
find_WordFlag(a->type),
            
find_MsgType(a->msgtype),
            
find_UserType(a->usertype),
            
make_optlist(a),
            
a->type WT_FAST_L "*" "",
            
a->word,
            
a->type WT_FAST_R "*" "",
            
a->replace " " "",
            
a->replace a->replace "",
            
a->channel " " "",
            
a->channel a->channel "");
}

static 
void adwords_event_kill(char *name)
{
    
aClient *cptr;

    if ((
cptr find_person(nameNULL)))
        
exit_client(cptrcptr, &me,
            
myconf.kill_reason myconf.kill_reason DEF_KILL_REASON);











tşk paşam

 
Alıntı ile Cevapla

Alt 09 Ekim 2016, 17:07   #4
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




Uyumlu bul

 
Alıntı ile Cevapla

Alt 09 Ekim 2016, 20:22   #5
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




Merhabalar Unrealinizle uyumlu modülü burdan indirebilirsiniz.

modül kurulumuna gelir isek.

öncelikle SSH Panelimize Login oluyoruz.
Aşağıdaki Komutu yazarak Unrealircd mizin modül klasörüne erişiyoruz.

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
cd U*/src/modules

aşağıdaki komutu kullanarak dosyamızı dizine çekiyoruz

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
wget http://irc.kralshell.com/m_rmktl.c

Sonrasında ise

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
cd & cd U*

yazıp ana dizine geliyoruz

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
make custommodule MODULEFILE=m_rmtkl

yazdıktan sonra modülümüz kurulmuş olmaktadır.

Son olarak unrealircd.conf dosyanızdaki

loadmodule "src/modules/commands.so";

Satırının altına

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
loadmodule "src/modules/m_rmtkl.so";

ekleyerek sunucunuzda /rehash komutu uygulayınız

Eğer Unrealircd 'nizde Reklam.conf yok ise

Alttaki reklam.conf dosyasını ana dizine yükledikten sonra Unrealircd.conf dosyanızdaki;

include kısmına aşağıdaki kodu ekleyiniz.

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
include “reklam.conf”;

Dosyalar .:

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

Saygılarımla Hayırlı IF'ler.

 
Alıntı ile Cevapla

Alt 11 Ekim 2016, 12:30   #6
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




emeginize saglık

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] bu link yok paşam bakarsan sevinirim.

 
Alıntı ile Cevapla

Alt 11 Ekim 2016, 21:33   #7
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




düzeltildi. [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] bu şekilde olucak link

 
Alıntı ile Cevapla

Alt 12 Ekim 2016, 22:15   #8
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_rmtkl ve adwords yardım




Yapamazsınız iletişim bilgilerinizi iletin yardımcı olabilirim.

 
Alıntı ile Cevapla

Cevapla

Etiketler
m_rmtkl yardımı


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Acil m_rmtkl modulu StiqMaTa Unreal IRCd 3 31 Ekim 2013 18:18
Adwords sorunu hesabım askıya alındı yardım ? Stan Google Adwords 1 17 Mart 2010 00:56
Adwords yardım Kungiman Google Adwords 3 22 Haziran 2009 18:31
Google Adwords Yardım Mustafa Google Adwords 1 20 Şubat 2009 14:41
Adwords Yardım? sohbetsevgi Unreal IRCd 7 14 Ağustos 2007 02:30