Bu modul işini görür sanırım. m_noaction.c olarak kaydet.
PHP Kod: Kodu kopyalamak için üzerine çift tıklayın!
/**************************************************
* Channel message that disables CTCP *
* ACTION's (/me's or /ame's) on channels. *
* Diablo
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
*
* Version 1.0-b1 *
**************************************************/
#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
static char *noaction_msg = NULL;
ModuleInfo NoActionModInfo;
static Hook *CheckChanMsg = NULL, *HookConfRun = NULL, *HookConfTest = NULL;
DLLFUNC char *m_noaction(aClient *, aClient *, aChannel *, char *, int);
DLLFUNC int noaction_config_test(ConfigFile *, ConfigEntry *, int, int *);
DLLFUNC int noaction_config_run(ConfigFile *, ConfigEntry *, int);
ModuleHeader Mod_Header
= {
"m_noaction v1.0",
"Channel message that disables CTCP ACTION's",
"Diablo",
"3.2-b8-1",
NULL
};
DLLFUNC int Mod_Test(ModuleInfo *modinfo)
{
HookConfTest = HookAddEx(NoActionModInfo.handle, HOOKTYPE_CONFIGTEST, noaction_config_test);
return MOD_SUCCESS;
}
DLLFUNC int Mod_Init(ModuleInfo *modinfo)
{
bcopy(modinfo,&NoActionModInfo, modinfo->size);
noaction_msg = strdup("Action Yazmak Yasaktir.");
CheckChanMsg = HookAddPCharEx(NoActionModInfo.handle, HOOKTYPE_CHANMSG, m_noaction);
HookConfRun = HookAddEx(NoActionModInfo.handle, HOOKTYPE_CONFIGRUN, noaction_config_run);
return MOD_SUCCESS;
}
DLLFUNC int Mod_Load(int module_load)
{
return MOD_SUCCESS;
}
DLLFUNC int Mod_Unload(int module_unload)
{
HookDel(CheckChanMsg);
HookDel(HookConfRun);
HookDel(HookConfTest);
return MOD_SUCCESS;
}
DLLFUNC int noaction_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
{
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "noaction-msg"))
{
if (ce->ce_vardata)
{
if (noaction_msg)
free(noaction_msg);
noaction_msg = strdup(ce->ce_vardata);
}
return 1;
}
return 0;
}
DLLFUNC int noaction_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "noaction-msg"))
{
if (!ce->ce_vardata)
{
config_error("%s:%i: set::noaction-msg without contents", ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
*errs = 1;
return -1;
}
return 1;
}
return 0;
}
DLLFUNC char *m_noaction(aClient *cptr, aClient *sptr, aChannel *chptr, char *text, int notice)
{
if (!IsAnOper(sptr) && !IsULine(sptr) && !IsServer(sptr) && *text == 1 && !myncmp(text+1, "ACTION ", 7))
{
sendto_one(sptr, ":%s NOTICE %s :%s %s", me.name, sptr->name, chptr->chname, noaction_msg);
return NULL;
} else
return text;
}