mirror of
https://github.com/pissnet/pissircd.git
synced 2025-08-11 20:51:35 +01:00
.
This commit is contained in:
parent
a245aa8369
commit
49ad7cb797
4 changed files with 104 additions and 3 deletions
36
include/events.h
Normal file
36
include/events.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/************************************************************************
|
||||
* Unreal Internet Relay Chat Daemon, include/events.h
|
||||
* (C) Carsten V. Munk 2001 <stskeeps@tspre.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define EVENT(x) void (x) (void *data)
|
||||
|
||||
void EventAdd(char *name, long every, long howmany,
|
||||
vFP event, void *data);
|
||||
|
||||
typedef struct _event Event;
|
||||
|
||||
struct _event {
|
||||
char *name;
|
||||
time_t every;
|
||||
long howmany;
|
||||
vFP event;
|
||||
void *data;
|
||||
time_t last;
|
||||
};
|
|
@ -1400,6 +1400,6 @@ extern char *gnulicense[];
|
|||
#endif
|
||||
#define HASH_TEST HASH_CHECK
|
||||
#include "modules.h"
|
||||
|
||||
#include "events.h"
|
||||
#endif /* __struct_include__ */
|
||||
|
||||
|
|
65
src/events.c
Normal file
65
src/events.c
Normal file
|
@ -0,0 +1,65 @@
|
|||
/************************************************************************
|
||||
* IRC - Internet Relay Chat, events.c
|
||||
* (C) 2001 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
|
||||
*
|
||||
* See file AUTHORS in IRC package for additional names of
|
||||
* the programmers.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#include "numeric.h"
|
||||
#include "msg.h"
|
||||
#include "channel.h"
|
||||
#include "userload.h"
|
||||
#include "version.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"
|
||||
|
||||
ID_Copyright("(C) Carsten Munk 1999");
|
||||
|
||||
Event *events = NULL;
|
||||
|
||||
void DoEvents(void)
|
||||
{
|
||||
Event *eventptr;
|
||||
|
||||
for (eventptr = events; events; events = events->next)
|
||||
if ((TStime() - eventptr->last) >= eventptr->every)
|
||||
{
|
||||
if (eventptr->howmany > 0)
|
||||
{
|
||||
eventptr->howmany--;
|
||||
if (eventptr->howmany == 0)
|
||||
{
|
||||
/* Mark event for deletion, or delete it
|
||||
*/
|
||||
}
|
||||
}
|
||||
eventptr->last = TStime();
|
||||
(*evenptr->event)(eventptr->data);
|
||||
}
|
||||
}
|
|
@ -1186,9 +1186,9 @@ void SocketLoop(void *dummy)
|
|||
loop.do_tkl_sweep = 0;
|
||||
}
|
||||
/* we want accuarte time here not the fucked up TStime() :P -Stskeeps */
|
||||
if ((TStime() - last_tune) > 300)
|
||||
if ((timeofday - last_tune) > 300)
|
||||
{
|
||||
last_tune = time(NULL);
|
||||
last_tune = timeofday;
|
||||
save_tunefile();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue