00001 /* Time-delay routine include stuff. 00002 * 00003 * (C) 2003-2007 Anope Team 00004 * Contact us at info@anope.org 00005 * 00006 * Please read COPYING and README for furhter details. 00007 * 00008 * Based on the original code of Epona by Lara. 00009 * Based on the original code of Services by Andy Church. 00010 * 00011 * $Id: timeout.h 1265 2007-08-26 15:33:06Z geniusdex $ 00012 * 00013 */ 00014 00015 #ifndef TIMEOUT_H 00016 #define TIMEOUT_H 00017 00018 #include <time.h> 00019 00020 00021 /* Definitions for timeouts: */ 00022 typedef struct timeout_ Timeout; 00023 struct timeout_ { 00024 Timeout *next, *prev; 00025 time_t settime, timeout; 00026 int repeat; /* Does this timeout repeat indefinitely? */ 00027 void (*code)(Timeout *); /* This structure is passed to the code */ 00028 void *data; /* Can be anything */ 00029 }; 00030 00031 00032 /* Check the timeout list for any pending actions. */ 00033 extern void check_timeouts(void); 00034 00035 /* Add a timeout to the list to be triggered in `delay' seconds. Any 00036 * timeout added from within a timeout routine will not be checked during 00037 * that run through the timeout list. 00038 */ 00039 extern Timeout *add_timeout(int delay, void (*code)(Timeout *), int repeat); 00040 00041 /* Remove a timeout from the list (if it's there). */ 00042 extern void del_timeout(Timeout *t); 00043 00044 #ifdef DEBUG_COMMANDS 00045 /* Send the list of timeouts to the given user. */ 00046 extern int send_timeout_list(User *u); 00047 #endif 00048 00049 00050 #endif /* TIMEOUT_H */
1.5.1-20070107