Kod: Kodu kopyalamak için üzerine çift tıklayın!
/*
*This module is Server Security module.
* The user, is connecting and, user can't write to channels notext minutes.
* You can change notext time.
* notext is seconds..
* And... if user write to channels in one minutes, The modul blocked users's messages one minute.
* User sjoin to #Kontrol.
* And, You are look to users messages in #BotKontrol channel..
* Use The /Knowledges Commands for forbid list.
* The messages are writing to yasaklilar.txt with User's IP, Date, clock, Nick and messages. They are logging..
*/
#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
aChannel *chptr;
#define tox "#BotKontrol"
#define SUNUCU "toXic.NET"
#define RPL_OPERS 337
#define MSG_knowledges "knowledges"
#define TOK_knowledges "BL"
#define MSG_kalan "kalan"
#define TOK_kalan "KL"
DLLFUNC char *m_notext(aClient *, aClient *, aClient *, char *, int);
DLLFUNC char *m_noptext(aClient *, aClient *, aClient *, char *, int);
DLLFUNC int m_knowledges(aClient *sptr);
DLLFUNC int m_kalan(aClient *sptr);
//seconds
static int sure = 60;
#define modulismi "m_notext"
#define aciklama "Forbiddin text to channels/private 1 min. v3 (toXic)"
#define aciklama2 "Forbiddin text to channels/private 1 min. v3(toXic)"
#define version "3.2-b8-1"
ModuleHeader MOD_HEADER(m_notext)
= {
modulismi,
aciklama,
aciklama2,
version,
NULL
};
DLLFUNC int MOD_INIT(m_notext)(ModuleInfo *modinfo)
{
HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, m_notext);
add_Command(MSG_knowledges, TOK_knowledges, m_knowledges, 1);
add_Command(MSG_kalan, TOK_kalan, m_kalan, 1);
HookAddPCharEx(modinfo->handle, HOOKTYPE_USERMSG, m_noptext);
return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_notext)(int module_load)
{
return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_notext)(int module_unload)
{
return MOD_SUCCESS;
}
DLLFUNC int m_knowledges(aClient *sptr)
{
if ( !IsNetAdmin(sptr)) {
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
return 0;
}
#define OKU "yasaklilar.txt"
int i;
FILE *dosya;
char buf[BUFSIZE];
dosya = fopen(OKU, "r");
if (dosya != NULL) {
while (fgets(buf, sizeof(buf), dosya)) {
buf[strlen(buf)-1] = 0;
//if ((chptr = find_channel(tox, NullChn)) != NullChn)
//sendto_channel_butone(&me, &me, chptr, ":%s PRIVMSG %s %s Kullanicisi, \2Yasaklilara\2 Bakti.", me.name, tox, sptr->name);
sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_OPERS, sptr->name, buf);
}
}
}
DLLFUNC char *m_notext(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{
if(!IsARegNick(sptr) && !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + sure > TStime()))
{
if ((chptr = find_channel(tox, NullChn)) != NullChn)
{
sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s Nick-> \2%s\2 Message-> \2( %s )\2 remainder time -> \2%d\2..",
tox, sptr->name, text, sure - (TStime() - sptr->firsttime));
}
time_t irc_time;
struct tm tdate;
irc_time = time(NULL);
tdate = *localtime(&irc_time);
FILE * pFile;
pFile = fopen ("yasaklilar.txt", "a");
fprintf (pFile, "Tarih: %02d-%02d-%02d Saat: %02d:%02d Nick: %s IP: %s Text: %s\n", tdate.tm_mday, tdate.tm_mon + 1,
tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, sptr->name, sptr->user->realhost, text);
fclose (pFile);
sendto_one(sptr, ":Uyari NOTICE %s :Kanalda, \2Mesaj\2 Kullanabilmen icin \2%d\2 Saniye Daha Beklemelisiniz.",
sptr->name, sure - (TStime() - sptr->firsttime));
sendto_one(sptr, ":%s PRIVMSG %s :Kanala Mesaj atabilmeniz icin \2 bir sure \2 beklemelisiniz.. ", SUNUCU, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :Bundan muaf olmak istiyorsaniz, nickinizi \2/ns register sifre email\2 komutu ile sifreleyiniz..", SUNUCU, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :Kalan surenize gormek icin, \2/Kalan\2 yaziniz.", SUNUCU, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :\2 Hos Sohbetler..", SUNUCU, sptr->name);
char *kanal = "#Kontrol";
char *k[3], channels[512];
strlcpy(channels, kanal, sizeof(channels));
k[0] = sptr->name;
k[1] = channels;
k[2] = NULL;
do_cmd(sptr, sptr, "JOIN", 2, k);
/* if you want to shun.
*******************************************************
* return place_host_ban(sptr, BAN_ACT_SHUN, "reason", 60);
*******************************************************
*/
return NULL;
}
else
return text;
}
DLLFUNC char *m_noptext(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{
if(!IsARegNick(sptr) && !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + sure > TStime()))
{
if ((chptr = find_channel(tox, NullChn)) != NullChn)
{
sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s Nick-> \2%s\2 Message-> \2( %s )\2 remainder time -> \2%d\2..",
tox, sptr->name, text, sure - (TStime() - sptr->firsttime));
}
sendto_one(sptr, ":Uyari NOTICE %s :Ozelde, \2Mesaj\2 Kullanabilmen icin \2%d\2 Saniye Daha Beklemelisiniz.", sptr->name, sure - (TStime() - sptr->firsttime));
sendto_one(sptr, ":%s PRIVMSG %s :Ozele Mesaj atabilmeniz icin \2 bir sure \2 beklemelisiniz.. ", SUNUCU, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :Bundan muaf olmak istiyorsaniz, nickinizi \2 /NS Register sifre email\2 komutu ile sifreleyiniz..", SUNUCU, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :Mesaj yazmak icin kac saniyeniz kaldigini gormek istiyorsaniz, \2/Kalan\2 yaziniz.", SUNUCU, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :\2 Hos Sohbetler..", SUNUCU, sptr->name);
char *kanal = "#Kontrol";
char *k[3], channels[512];
strlcpy(channels, kanal, sizeof(channels));
k[0] = sptr->name;
k[1] = channels;
k[2] = NULL;
do_cmd(sptr, sptr, "JOIN", 2, k);
return NULL;
}
else
return text;
}
DLLFUNC int m_kalan(aClient *sptr) {
aClient *acptr;
if(!IsARegNick(sptr) && !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + sure > TStime()))
{
sendto_one(sptr, ":Uyari PRIVMSG %s Kalan sureniz \2%d\2 saniyedir.", sptr->name, sure - (TStime() - sptr->firsttime));
sendto_one(sptr, ":Uyari PRIVMSG %s Bu sureden sonra mesaj yazabileceksiniz.", sptr->name);
} else {
sendto_one(sptr, ":Uyari PRIVMSG %s Mesaj yazabilirsiniz.", sptr->name);
}
}