1 | /* |
1 | /* |
2 | * Copyright © 2005 atheme.org. |
2 | * Copyright © 2005 atheme.org. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
4 | * |
4 | * |
5 | * Event stuff. |
5 | * Event stuff. |
6 | * |
6 | * |
7 | * $Id: event.h,v 1.2 2007/07/21 01:29:07 pippijn Exp $ |
7 | * $Id: event.h,v 1.3 2007/08/28 17:08:06 pippijn Exp $ |
8 | */ |
8 | */ |
9 | |
9 | |
10 | #ifndef EVENT_H |
10 | #ifndef EVENT_H |
11 | #define EVENT_H |
11 | #define EVENT_H |
12 | |
12 | |
13 | typedef void EVH (void *); |
13 | typedef void EVH (void *); |
14 | |
14 | |
15 | /* event list struct */ |
15 | /* event list struct */ |
16 | struct ev_entry |
16 | struct ev_entry : zero_initialised |
17 | { |
17 | { |
18 | EVH *func; |
18 | EVH *func; |
19 | void *arg; |
19 | void *arg; |
20 | const char *name; |
20 | char const *name; |
21 | time_t frequency; |
21 | time_t frequency; |
22 | time_t when; |
22 | time_t when; |
23 | bool active; |
23 | bool active; |
24 | }; |
24 | }; |
25 | |
25 | |
26 | E struct ev_entry event_table[MAX_EVENTS]; |
26 | E struct ev_entry event_table[MAX_EVENTS]; |
27 | E const char *last_event_ran; |
27 | E char const *last_event_ran; |
28 | |
28 | |
29 | E unsigned int event_add (const char *name, EVH * func, void *arg, time_t when); |
29 | E unsigned int event_add (char const * const name, EVH * func, void *arg, time_t when); |
30 | E unsigned int event_add_once (const char *name, EVH * func, void *arg, time_t when); |
30 | E unsigned int event_add_once (char const * const name, EVH * func, void *arg, time_t when); |
31 | E void event_run (void); |
31 | E void event_run (void); |
32 | E time_t event_next_time (void); |
32 | E time_t event_next_time (void); |
33 | E void event_delete (EVH * func, void *arg); |
33 | E void event_delete (EVH * func, void *arg); |
34 | E unsigned int event_find (EVH * func, void *arg); |
34 | E unsigned int event_find (EVH * func, void *arg); |
35 | |
35 | |