And writing time to the channel ban m_notext.c

These are old archives. They are kept for historic purposes only.
Post Reply
toXic
Posts: 9
Joined: Sun Feb 28, 2010 10:55 am
Location: Turkey/Samsun

And writing time to the channel ban m_notext.c

Post by toXic » Tue Sep 14, 2010 5:28 pm

static int ibo = 60;

can change the amount of time here. Text 60 seconds before logging on to the channel at the user if the user whether the message is blocked and the Status Text information send private. User if written in the framework of this process, # Kanalina taken control. Also this time, in the framework written in messages, #Botkontrol on channel is shown. Introduction 1 min in yazilip blocked all the messages, user's IP address with a history log file is saved. However, only NETWORK Admins Report this log file, IRC over the command, with the help can read. Use the command only network administrator. To read a file via IRC / knowledges, use the command.

Code: Select all

/*
*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 RPL_OPERS  337

#define MSG_knowledges "knowledges"
#define TOK_knowledges  "BL"

DLLFUNC char *m_notext(aClient *, aClient *, aClient *, char *, int);
DLLFUNC int m_knowledges(aClient *sptr);



//seconds
  static int ibo = 60;

#define modulismi "m_channotext"
#define aciklama "Forbiddin text to channels 1 min. (toXic)"
#define aciklama2 "Forbiddin text to channels 1 min. (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);


  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 "forbids.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;
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 + ibo > 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, ibo - (TStime() - sptr->firsttime));
}
 time_t irc_time;
                 struct tm tdate;
                 irc_time = time(NULL);
                 tdate = *localtime(&irc_time);
                 FILE * pFile;
                 pFile = fopen ("forbids.txt", "a");
                 fprintf (pFile, "Date: %02d-%02d-%02d Time: %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 PRIVMSG %s :To Use message wait for \2(%d)\2 minute. ", sptr->name,  ibo - (TStime() - sptr->firsttime));
sendto_one(sptr, ":%s NOTICE %s :Please register your nick..", me.name, 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;

   }

Post Reply