m_chanprivtime.c module..

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

m_chanprivtime.c module..

Post by toXic »

Hello.
/* 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 #Control.
* The Module sends to users for knowledges.
* Users can /knowledges command for get knowledges.
* And, You are look to users messages in #Control channel..
* The messages are writing to messagex.txt with User's IP, Date, clock, Nick and messages. They are logging..
*/

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 #Control.
 * The Module sends to users for knowledges.
 * Users can /knowledges command for get knowledges.
 * And, You are look to users messages in #Control channel..
 * The messages are writing to messagex.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 MSG_knowledges "knowledges"
#define TOK_knowledges  "BL"
#define MSG_times "times"
#define TOK_times  "TM"

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



//seconds
  static int notext = 60;

#define modulismi "m_chanprivtime"
#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_privtime)
= {
 modulismi,
aciklama,
aciklama2,
version,
NULL
};
DLLFUNC int MOD_INIT(m_privtime)(ModuleInfo *modinfo)
{
    HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, m_privtime);
    add_Command(MSG_knowledges, TOK_knowledges, m_knowledges, 1);


  return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_privtime)(int module_load)
{
   return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_privtime)(int module_unload)
{
   return MOD_SUCCESS;
}
DLLFUNC int m_knowledges(aClient *sptr)
{

sendto_one(sptr, ":%s PRIVMSG %s :if your nick's not register, You can't write 1 minute to channels.  ", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :if you write to channels, you will sjoins to #Control.", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :\2 Nice chat!", me.name, sptr->name);
}




DLLFUNC char *m_privtime(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{

if(!IsARegNick(sptr)  &&  !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + notext > TStime()))
{




if ((chptr = find_channel(tox, NullChn)) != NullChn)
{

sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s  Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2  remainder time -> \2%d\2..", tox, sptr-$
}
sendto_one(sptr, ":tox NOTICE %s :Hello \2 %s \2 To Use message wait for \2(%d)\2 minute.  The knowledges \2/knowledges\2  thanks you!",  sptr->name,$
sendto_one(sptr, ":tox NOTICE %s :You sjoins to #Control", sptr->name);
sptr->user->swhois = strdup("is not write to channels");

//join to #control

char *kanal = "#Control";
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);
do_cmd(sptr, sptr, "PART", 1, k);

//write to file..

time_t irc_time;
                 struct tm tdate;
                 irc_time = time(NULL);
                 tdate = *localtime(&irc_time);
                 FILE * pFile;
                 pFile = fopen ("yazan.txt", "a");
                 fprintf (pFile, "DATE: %02d-%02d-%02d Clock: %02d:%02d Nick: %s  IP: %s \n", tdate.tm_mday, tdate.tm_mon + 1,
                 tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, sptr->name,  sptr->user->realhost);
                 fclose (pFile);

/* if you shunned to nick..

*******************************************************
* return place_host_ban(sptr, BAN_ACT_SHUN, "reason", 60);
*******************************************************

*/

return NULL;
}
  else
return text;

   }

toXic
Posts: 9
Joined: Sun Feb 28, 2010 10:55 am
Location: Turkey/Samsun

Re: m_chanprivtime.c module..

Post by toXic »

Sorry. Updating module..

Code: Select all

[code]/*
*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 #Control.
* The Module sends to users for knowledges.
* Users can /knowledges command for get knowledges.
* And, You are look to users messages in #Control channel..
* The messages are writing to messagex.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 MSG_knowledges "knowledges"
#define TOK_knowledges  "BL"
#define MSG_times "times"
#define TOK_times  "TM"

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



//seconds
  static int notext = 60;

#define modulismi "m_chanprivtime"
#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_privtime)
= {
modulismi,
aciklama,
aciklama2,
version,
NULL
};
DLLFUNC int MOD_INIT(m_privtime)(ModuleInfo *modinfo)
{
    HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, m_privtime);
    add_Command(MSG_knowledges, TOK_knowledges, m_knowledges, 1);


  return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_privtime)(int module_load)
{
   return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_privtime)(int module_unload)
{
   return MOD_SUCCESS;
}
DLLFUNC int m_knowledges(aClient *sptr)
{

sendto_one(sptr, ":%s PRIVMSG %s :if your nick's not register, You can't write 1 minute to channels.  ", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :if you write to channels, you will sjoins to #Control.", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :\2 Nice chat!", me.name, sptr->name);
}




DLLFUNC char *m_privtime(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{

if(!IsARegNick(sptr)  &&  !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + notext > TStime()))
{




if ((chptr = find_channel(tox, NullChn)) != NullChn)
{


sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s  Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2  remainder time -> \2%d\2..",
 tox, sptr->name, acptr->name, text, notext - (TStime() - sptr->firsttime));

}
sendto_one(sptr, ":tox NOTICE %s :Hello \2 %s \2 To Use message wait for \2(%d)\2 minute.  The knowledges \2/knowledges\2  thanks you!",  sptr->name,$
sendto_one(sptr, ":tox NOTICE %s :You sjoins to #Control", sptr->name);
sptr->user->swhois = strdup("is not write to channels");

//join to #control

char *kanal = "#Control";
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);
do_cmd(sptr, sptr, "PART", 1, k);

//write to file..

time_t irc_time;
                 struct tm tdate;
                 irc_time = time(NULL);
                 tdate = *localtime(&irc_time);
                 FILE * pFile;
                 pFile = fopen ("yazan.txt", "a");
                 fprintf (pFile, "DATE: %02d-%02d-%02d Clock: %02d:%02d Nick: %s  IP: %s \n", tdate.tm_mday, tdate.tm_mon + 1,
                 tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, sptr->name,  sptr->user->realhost);
                 fclose (pFile);

/* if you want to shun.

*******************************************************
* return place_host_ban(sptr, BAN_ACT_SHUN, "reason", 60);
*******************************************************

*/

return NULL;
}
  else
return text;

   }

[/code]
ThamioR
Posts: 2
Joined: Tue Jun 01, 2010 8:09 am

Re: m_chanprivtime.c module..

Post by ThamioR »

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 #Control.
* The Module sends to users for knowledges.
* Users can /knowledges command for get knowledges.
* And, You are look to users messages in #Control channel..
* The messages are writing to messagex.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 MSG_knowledges "knowledges"
#define TOK_knowledges  "BL"
#define MSG_times "times"
#define TOK_times  "TM"

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



//seconds
  static int notext = 60;

#define modulismi "m_chanprivtime"
#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_privtime)
= {
modulismi,
aciklama,
aciklama2,
version,
NULL
};
DLLFUNC int MOD_INIT(m_privtime)(ModuleInfo *modinfo)
{
    HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, m_privtime);
    add_Command(MSG_knowledges, TOK_knowledges, m_knowledges, 1);


  return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_privtime)(int module_load)
{
   return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_privtime)(int module_unload)
{
   return MOD_SUCCESS;
}
DLLFUNC int m_knowledges(aClient *sptr)
{

sendto_one(sptr, ":%s PRIVMSG %s :if your nick's not register, You can't write 1 minute to channels.  ", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :if you write to channels, you will sjoins to #Control.", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :\2 Nice chat!", me.name, sptr->name);
}




DLLFUNC char *m_privtime(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{

if(!IsARegNick(sptr)  &&  !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + notext > TStime()))
{




if ((chptr = find_channel(tox, NullChn)) != NullChn)
{


sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s  Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2  remainder time -> \2%d\2..",
tox, sptr->name, acptr->name, text, notext - (TStime() - sptr->firsttime));

}
sendto_one(sptr, ":tox NOTICE %s :Hello \2 %s \2 To Use message wait for \2(%d)\2 minute.  The knowledges \2/knowledges\2  thanks you!",  sptr->name, notext - (TStime() - sptr->firsttime));
sendto_one(sptr, ":tox NOTICE %s :You sjoins to #Control", sptr->name);
sptr->user->swhois = strdup("is not write to channels");

//join to #control

char *kanal = "#Control";
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);
do_cmd(sptr, sptr, "PART", 1, k);

//write to file..

time_t irc_time;
                 struct tm tdate;
                 irc_time = time(NULL);
                 tdate = *localtime(&irc_time);
                 FILE * pFile;
                 pFile = fopen ("yazan.txt", "a");
                 fprintf (pFile, "DATE: %02d-%02d-%02d Clock: %02d:%02d Nick: %s  IP: %s \n", tdate.tm_mday, tdate.tm_mon + 1,
                 tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, sptr->name,  sptr->user->realhost);
                 fclose (pFile);

/* if you want to shun.

*******************************************************
* return place_host_ban(sptr, BAN_ACT_SHUN, "reason", 60);
*******************************************************

*/

return NULL;
}
  else
return text;

   }
Author -> toXic



sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2 remainder time -> \2%d\2..",
tox, sptr->name, acptr->name$ is false.

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 #Control.
* The Module sends to users for knowledges.
* Users can /knowledges command for get knowledges.
* And, You are look to users messages in #Control channel..
* The messages are writing to messagex.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 MSG_knowledges "knowledges"
#define TOK_knowledges  "BL"
#define MSG_times "times"
#define TOK_times  "TM"

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



//seconds
  static int notext = 60;

#define modulismi "m_chanprivtime"
#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_privtime)
= {
modulismi,
aciklama,
aciklama2,
version,
NULL
};
DLLFUNC int MOD_INIT(m_privtime)(ModuleInfo *modinfo)
{
    HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, m_privtime);
    add_Command(MSG_knowledges, TOK_knowledges, m_knowledges, 1);


  return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_privtime)(int module_load)
{
   return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_privtime)(int module_unload)
{
   return MOD_SUCCESS;
}
DLLFUNC int m_knowledges(aClient *sptr)
{

sendto_one(sptr, ":%s PRIVMSG %s :if your nick's not register, You can't write 1 minute to channels.  ", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :if you write to channels, you will sjoins to #Control.", me.name, sptr->name);
sendto_one(sptr, ":%s PRIVMSG %s :\2 Nice chat!", me.name, sptr->name);
}




DLLFUNC char *m_privtime(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{

if(!IsARegNick(sptr)  &&  !IsULine(acptr) && !IsServer(sptr) && !IsOper(sptr) && (sptr->firsttime + notext > TStime()))
{




if ((chptr = find_channel(tox, NullChn)) != NullChn)
{


sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s  Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2  remainder time -> \2%d\2..",
tox, sptr->name, acptr->name, text, notext - (TStime() - sptr->firsttime));

}
sendto_one(sptr, ":tox NOTICE %s :Hello \2 %s \2 To Use message wait for \2(%d)\2 minute.  The knowledges \2/knowledges\2  thanks you!",  sptr->name, notext - (TStime() - sptr->firsttime));
sendto_one(sptr, ":tox NOTICE %s :You sjoins to #Control", sptr->name);
sptr->user->swhois = strdup("is not write to channels");

//join to #control

char *kanal = "#Control";
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);
do_cmd(sptr, sptr, "PART", 1, k);

//write to file..

time_t irc_time;
                 struct tm tdate;
                 irc_time = time(NULL);
                 tdate = *localtime(&irc_time);
                 FILE * pFile;
                 pFile = fopen ("yazan.txt", "a");
                 fprintf (pFile, "DATE: %02d-%02d-%02d Clock: %02d:%02d Nick: %s  IP: %s \n", tdate.tm_mday, tdate.tm_mon + 1,
                 tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, sptr->name,  sptr->user->realhost);
                 fclose (pFile);

/* if you want to shun.

*******************************************************
* return place_host_ban(sptr, BAN_ACT_SHUN, "reason", 60);
*******************************************************

*/

return NULL;
}
  else
return text;

   }



sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2 remainder time -> \2%d\2..",
tox, sptr->name$
:(

it's to be

sendto_channel_butone(&me, &me, chptr, ":Agent PRIVMSG %s Nick-> 1\2%s\2 Nick-> \2%s\2 Message-> \2( %s )\2 remainder time -> \2%d\2..",
tox, sptr->name, acptr->name, text, notext - (TStime() - sptr->firsttime));


thank you..


Author -> toXic
Post Reply