• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.
  • Sohbetokey.com ile canlı okey oynamaya ne dersin? Hem sohbet et, hem mobil okey oyna!
  • Soru mu? Sorun mu? ''Bir Sorum Var?'' sistemimiz aktiftir. Paylaşın beraber çözüm üretelim.

DelajJOIN Modul'u

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

diShy

Onursal Üye
Üyelik Tarihi
27 Kas 2009
Konular
32,527
Mesajlar
50,860
MFC Puanı
2,580
Released from : C-IRC Modules
Description : Delays the joining process till the given time is up
Written by : srcmaster <srcmastercRypthon.org>




Kod:
/* 
 ********************************************************************* 
 *
 **
 ***   Released from   : C-IRC Modules
 ****  Description     : Delays the joining process till the given time is up
 ****  Written by      : srcmaster <srcmaster[USER=27376]cRy[/USER]pthon.org>
 ***   Web page        : Crypthon [srcmaster's homepage]
 **
 *
 **   Changes:
 *
 **   1.0
 *       - Initial release
 * 
 *
 **   Configuration line: set { join-delay 5s; };
 *
 *********************************************************************
 */
#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
#define J(x) auser[x->slot]
typedef struct _JEvent {
 Event *event;
} JEvent;
static JEvent *auser[4096];
static Hook *JH, *PCH, *QH = NULL;
ModuleInfo joindelay;
DLLFUNC int joindelay_ct(ConfigFile *, ConfigEntry *, int, int *);
DLLFUNC int joindelay_cr(ConfigFile *, ConfigEntry *, int);
DLLFUNC int joindelay_r();
DLLFUNC int joindelay_cpt(int *);
static int ptime = 0;
static int pre_connect_h(aClient *);
static int quit_h(aClient *, char *);
static int join_h(aClient *, aChannel *, char *[]);
static void join_stuff(aClient *);
ModuleHeader MOD_HEADER(joindelay) = {
 "joindelay",
 "$Id: m_joindelay.c,v 1.0 2011/02/07 00:15:48 srcmaster Exp $",
 "Adds a delay to the join command by srcmaster",
 "3.2-b8-1",
 NULL 
};
ModuleInfo joindelay;
DLLFUNC int MOD_TEST(joindelay)(ModuleInfo *module)
{
 bcopy(module, &joindelay, module->size);
 HookAddEx(joindelay.handle, HOOKTYPE_CONFIGTEST, joindelay_ct);
 HookAddEx(joindelay.handle, HOOKTYPE_CONFIGPOSTTEST, joindelay_cpt);
 return MOD_SUCCESS;
}
DLLFUNC int MOD_INIT(joindelay)(ModuleInfo *module)
{
 JH = HookAddEx(joindelay.handle, HOOKTYPE_PRE_LOCAL_JOIN, join_h);
 PCH = HookAddEx(joindelay.handle, HOOKTYPE_PRE_LOCAL_CONNECT, pre_connect_h);
 QH = HookAddEx(joindelay.handle, HOOKTYPE_LOCAL_QUIT, quit_h);
 HookAddEx(joindelay.handle, HOOKTYPE_CONFIGRUN, joindelay_cr);
 if (!JH || !PCH || !QH)
  return MOD_FAILED;
 return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(joindelay)(int module_load)
{
 return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(joindelay)(int module_unload)
{
 HookDel(JH);
 HookDel(PCH);
 HookDel(QH);
 return MOD_SUCCESS;
}
DLLFUNC int joindelay_ct(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
int errors = 0;
 if (type != CONFIG_SET)
  return 0;
 if (!strcmp(ce->ce_varname, "join-delay"))
 {
  if (!ce->ce_vardata)
  {
   config_error("Make sure you have the join-delay set!");
   errors++;
  }
  ptime = 1; // i know, i know...
  *errs = errors;
  return errors ? -1 : 1;
 }
 else return 0;
}
DLLFUNC int joindelay_cr(ConfigFile *cf, ConfigEntry *ce, int type)
{
 if (type != CONFIG_SET)
  return 0;
 if (!strcmp(ce->ce_varname, "join-delay"))
 {
  ptime = config_checkval(ce->ce_vardata, CFG_TIME);
  return 1;
 }
 else return 0;
}
DLLFUNC int joindelay_cpt(int *errs)
{
int errors = 0;
 if (!ptime)
 {
  config_error("Make sure you have the join-delay set!");
  errors++;
 }
 *errs = errors;
 return errors ? -1 : 1;
}
static int join_h(aClient *cptr, aChannel *chptr, char *parv[])
{
 if (!IsAnOper(cptr) && (TStime() - cptr->firsttime) < ptime)
 {
  sendto_one(cptr, ":%s %s %s :*** Guvenlik taramalarindan geciyorsunuz. (\2wingate/socks/tor/proxy\2)", me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
  sendto_one(cptr, ":%s %s %s :*** Kalan tarama suresi \2%d\2 saniye, lutfen sabirli olunuz kanallara aktarilacaksiniz...", me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name, ptime - (TStime() - cptr->firsttime));
  return HOOK_DENY;
    }
    else return HOOK_CONTINUE;
}
static void join_stuff(aClient *cptr)
{
 if (IsAnOper(cptr))
  return;
 if (!BadPtr(AUTO_JOIN_CHANS) && strcmp(AUTO_JOIN_CHANS, "0"))
 {
  char *chans[3] = {
   cptr->name,
   AUTO_JOIN_CHANS,
   NULL
  };
  do_cmd(cptr, cptr, "JOIN", 3, chans);
 }
}
static int pre_connect_h(aClient *cptr)
{
 if (MyConnect(cptr))
 {
  J(cptr) = MyMallocEx(sizeof(JEvent));
  J(cptr)->event = EventAddEx(joindelay.handle, "join-stuff", ptime, 1, join_stuff, cptr);
 }
 return HOOK_CONTINUE;
}
DLLFUNC int quit_h(aClient *cptr, char *comment)
{
 if (MyConnect(cptr))
 {
  if (J(cptr))
  {
   memset(J(cptr), 0, sizeof(JEvent));
   MyFree(J(cptr));
   J(cptr) = NULL;
  }
 }
 return 0;
}
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst