Ejemplo n.º 1
0
int    channeldumper_Load(int module_load)
#endif
{
	LockEventSystem();
	ChannelDumpEvent = EventAddEx(ChannelDumperModInfo.handle, "e_channeldump", 5, 0, e_channeldump, NULL);
	UnlockEventSystem();
	return MOD_SUCCESS;
}
Ejemplo n.º 2
0
int	channeldumper_Unload(int module_unload)
#endif
{
	tainted--;
	LockEventSystem();
	EventDel(ChannelDumpEvent);
	UnlockEventSystem();
	return MOD_SUCCESS;
}
Ejemplo n.º 3
0
/* Called when module is unloaded */
DLLFUNC int MOD_UNLOAD(m_htm)(int module_unload)
{
    if (del_Command(MSG_HTM, TOK_HTM, m_htm) < 0)
    {
        sendto_realops("Failed to delete commands when unloading %s",
                       MOD_HEADER(m_htm).name);
    }
#ifndef NO_FDLIST
    LockEventSystem();
    EventDel(e_lcf);
    EventDel(e_htmcalc);
    UnlockEventSystem();
#endif
    return MOD_SUCCESS;
}
Ejemplo n.º 4
0
void	SetupEvents(void)
{
	LockEventSystem();

	/* Start events */
	EventAddEx(NULL, "tunefile", 300, 0, save_tunefile, NULL);
	EventAddEx(NULL, "garbage", GARBAGE_COLLECT_EVERY, 0, garbage_collect, NULL);
	EventAddEx(NULL, "loop", 0, 0, loop_event, NULL);
	EventAddEx(NULL, "unrealdns_removeoldrecords", 15, 0, unrealdns_removeoldrecords, NULL);
	EventAddEx(NULL, "check_pings", 1, 0, check_pings, NULL);
	EventAddEx(NULL, "check_deadsockets", 1, 0, check_deadsockets, NULL);
	EventAddEx(NULL, "check_unknowns", 1, 0, check_unknowns, NULL);
	EventAddEx(NULL, "try_connections", 2, 0, try_connections, NULL);

	UnlockEventSystem();
}
Ejemplo n.º 5
0
/* This is called on module init, before Server Ready */
DLLFUNC int MOD_INIT(m_htm)(ModuleInfo *modinfo)
{
    /*
     * We call our add_Command crap here
    */
    add_Command(MSG_HTM, TOK_HTM, m_htm, MAXPARA);
    ConfRun = HookAddEx(HtmModInfo->handle, HOOKTYPE_CONFIGRUN, htm_config_run);
    ServerStats = HookAddEx(HtmModInfo->handle, HOOKTYPE_STATS, htm_stats);
#ifndef NO_FDLIST
    LockEventSystem();
    e_lcf = EventAddEx(HtmModInfo->handle, "lcf", LCF, 0, lcf_check, NULL);
    e_htmcalc = EventAddEx(HtmModInfo->handle, "htmcalc", 1, 0, htm_calc, NULL);
    UnlockEventSystem();
#endif
    MARK_AS_OFFICIAL_MODULE(modinfo);
    return MOD_SUCCESS;
}
Ejemplo n.º 6
0
void	SetupEvents(void)
{
	LockEventSystem();

	/* Start events */
	EventAddEx(NULL, "tunefile", 300, 0, save_tunefile, NULL);
	EventAddEx(NULL, "garbage", GARBAGE_COLLECT_EVERY, 0, garbage_collect, NULL);
	EventAddEx(NULL, "loop", 0, 0, loop_event, NULL);
#ifndef NO_FDLIST
	EventAddEx(NULL, "fdlistcheck", 1, 0, e_check_fdlists, NULL);
#endif
#ifdef JOINTHROTTLE
	EventAddEx(NULL, "cmodej_cleanup_structs", 60, 0, cmodej_cleanup_structs, NULL);
#endif
	EventAddEx(NULL, "unrealdns_removeoldrecords", 15, 0, unrealdns_removeoldrecords, NULL);
	UnlockEventSystem();
}
Ejemplo n.º 7
0
DLLFUNC int m_htm(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
    int  x = HUNTED_NOSUCH;
    char *command, *param;
    if (!IsOper(sptr))
    {
        sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
        return 0;
    }

    switch(parc) {
    case 1:
        break;
    case 2:
        x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s", 1, parc, parv);
        break;
    case 3:
        x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s", 1, parc, parv);
        break;
    default:
        x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s %s", 1, parc, parv);
    }

    switch (x) {
    case HUNTED_NOSUCH:
        command = (parv[1]);
        param = (parv[2]);
        break;
    case HUNTED_ISME:
        command = (parv[2]);
        param = (parv[3]);
        break;
    default:
        return 0;
    }

#ifndef NO_FDLIST

    if (!command)
    {
        sendto_one(sptr,
                   ":%s NOTICE %s :*** Current incoming rate: %0.2f kb/s",
                   me.name, parv[0], currentrate);
        sendto_one(sptr,
                   ":%s NOTICE %s :*** Current outgoing rate: %0.2f kb/s",
                   me.name, parv[0], currentrate2);
        sendto_one(sptr,
                   ":%s NOTICE %s :*** Highest incoming rate: %0.2f kb/s",
                   me.name, parv[0], highest_rate);
        sendto_one(sptr,
                   ":%s NOTICE %s :*** Highest outgoing rate: %0.2f kb/s",
                   me.name, parv[0], highest_rate2);
        sendto_one(sptr,
                   ":%s NOTICE %s :*** High traffic mode is currently \2%s\2",
                   me.name, parv[0], (lifesux ? "ON" : "OFF"));
        sendto_one(sptr,
                   ":%s NOTICE %s :*** High traffic mode is currently in \2%s\2 mode",
                   me.name, parv[0], (noisy_htm ? "NOISY" : "QUIET"));
        sendto_one(sptr,
                   ":%s NOTICE %s :*** HTM will be activated if incoming > %i kb/s",
                   me.name, parv[0], LRV);
    }

    else
    {
        if (!stricmp(command, "ON"))
        {
            EventInfo mod;
            lifesux = 1;
            sendto_one(sptr,
                       ":%s NOTICE %s :High traffic mode is now ON.",
                       me.name, parv[0]);
            sendto_ops
            ("%s (%s@%s) forced High traffic mode to activate",
             parv[0], sptr->user->username,
             GetHost(sptr));
            LCF = 60;	/* 60 seconds */
            mod.flags = EMOD_EVERY;
            mod.every = LCF;
            LockEventSystem();
            EventMod(e_lcf, &mod);
            UnlockEventSystem();
        }
        else if (!stricmp(command, "OFF"))
        {
            EventInfo mod;
            lifesux = 0;
            LCF = LOADCFREQ;
            mod.flags = EMOD_EVERY;
            mod.every = LCF;
            LockEventSystem();
            EventMod(e_lcf, &mod);
            UnlockEventSystem();
            sendto_one(sptr,
                       ":%s NOTICE %s :High traffic mode is now OFF.",
                       me.name, parv[0]);
            sendto_ops
            ("%s (%s@%s) forced High traffic mode to deactivate",
             parv[0], sptr->user->username,
             GetHost(sptr));
        }
        else if (!stricmp(command, "TO"))
        {
            if (!param)
                sendto_one(sptr,
                           ":%s NOTICE %s :You must specify an integer value",
                           me.name, parv[0]);
            else
            {
                int  new_val = atoi(param);
                if (new_val < 10)
                    sendto_one(sptr,
                               ":%s NOTICE %s :New value must be > 10",
                               me.name, parv[0]);
                else
                {
                    LRV = new_val;
                    sendto_one(sptr,
                               ":%s NOTICE %s :New max rate is %dkb/s",
                               me.name, parv[0], LRV);
                    sendto_ops
                    ("%s (%s@%s) changed the High traffic mode max rate to %dkb/s",
                     parv[0], sptr->user->username,
                     GetHost(sptr), LRV);
                }
            }
        }
        else if (!stricmp(command, "QUIET"))
        {
            noisy_htm = 0;
            sendto_one(sptr,
                       ":%s NOTICE %s :High traffic mode is now QUIET",
                       me.name, parv[0]);
            sendto_ops("%s (%s@%s) set High traffic mode to QUIET",
                       parv[0], sptr->user->username,
                       GetHost(sptr));
        }

        else if (!stricmp(command, "NOISY"))
        {
            noisy_htm = 1;
            sendto_one(sptr,
                       ":%s NOTICE %s :High traffic mode is now NOISY",
                       me.name, parv[0]);
            sendto_ops("%s (%s@%s) set High traffic mode to NOISY",
                       parv[0], sptr->user->username,
                       GetHost(sptr));
        }
        else
            sendto_one(sptr, ":%s NOTICE %s :Unknown option: %s",
                       me.name, parv[0], command);
    }


#else
    sendto_one(sptr,
               ":%s NOTICE %s :*** High traffic mode and fdlists are not enabled on this server",
               me.name, sptr->name);
#endif
    return 0;
}