1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 11:26:40 +02:00

Module API: EventAddEx() -> EventAdd()

This commit is contained in:
Bram Matthys
2019-06-12 19:09:33 +02:00
parent e3013ae067
commit ca9b04a0fa
17 changed files with 27 additions and 29 deletions
+1 -3
View File
@@ -638,9 +638,7 @@ extern MODVAR Callback *Callbacks[MAXCALLBACKS], *RCallbacks[MAXCALLBACKS];
extern MODVAR Efunction *Efunctions[MAXEFUNCTIONS];
extern MODVAR ClientCapability *clicaps;
#define EventAdd(name, every, howmany, event, data) EventAddEx(NULL, name, every, howmany, event, data)
extern Event *EventAddEx(Module *, char *name, long every, long howmany,
vFP event, void *data);
extern Event *EventAdd(Module *, char *name, long every, long howmany, vFP event, void *data);
extern Event *EventDel(Event *event);
extern Event *EventMarkDel(Event *event);
extern Event *EventFind(char *name);
+9 -9
View File
@@ -56,7 +56,7 @@ void UnlockEventSystem(void)
}
Event *EventAddEx(Module *module, char *name, long every, long howmany,
Event *EventAdd(Module *module, char *name, long every, long howmany,
vFP event, void *data)
{
Event *newevent;
@@ -208,14 +208,14 @@ 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);
EventAdd(NULL, "tunefile", 300, 0, save_tunefile, NULL);
EventAdd(NULL, "garbage", GARBAGE_COLLECT_EVERY, 0, garbage_collect, NULL);
EventAdd(NULL, "loop", 0, 0, loop_event, NULL);
EventAdd(NULL, "unrealdns_removeoldrecords", 15, 0, unrealdns_removeoldrecords, NULL);
EventAdd(NULL, "check_pings", 1, 0, check_pings, NULL);
EventAdd(NULL, "check_deadsockets", 1, 0, check_deadsockets, NULL);
EventAdd(NULL, "check_unknowns", 1, 0, check_unknowns, NULL);
EventAdd(NULL, "try_connections", 2, 0, try_connections, NULL);
UnlockEventSystem();
}
+1 -1
View File
@@ -737,7 +737,7 @@ long v;
if (v > 5)
v = 5; /* accuracy, please */
}
EventAddEx(NULL, "bucketcleaning", v, 0, e_clean_out_throttling_buckets, NULL);
EventAdd(NULL, "bucketcleaning", v, 0, e_clean_out_throttling_buckets, NULL);
}
int hash_throttling(char *ip)
+1 -1
View File
@@ -230,7 +230,7 @@ static mp_pool_t *mp_allocated_pools = NULL;
void
mp_pool_init(void)
{
EventAddEx(NULL, "mp_pool_garbage_collect", 119, 0, &mp_pool_garbage_collect, NULL);
EventAdd(NULL, "mp_pool_garbage_collect", 119, 0, &mp_pool_garbage_collect, NULL);
}
/** Helper: Allocate and return a new memory chunk for <b>pool</b>. Does not
+1 -1
View File
@@ -164,7 +164,7 @@ MOD_INIT(floodprot)
MOD_LOAD(floodprot)
{
EventAddEx(ModInfo->handle, "modef_event", 10, 0, modef_event, NULL);
EventAdd(ModInfo->handle, "modef_event", 10, 0, modef_event, NULL);
floodprot_rehash_complete();
return MOD_SUCCESS;
}
+1 -1
View File
@@ -103,7 +103,7 @@ MOD_INIT(history)
MOD_LOAD(history)
{
EventAddEx(modinfo->handle, "history_clean", HISTORY_TIMER_EVERY, 0, history_clean, NULL);
EventAdd(modinfo->handle, "history_clean", HISTORY_TIMER_EVERY, 0, history_clean, NULL);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -113,7 +113,7 @@ MOD_INIT(connthrottle)
MOD_LOAD(connthrottle)
{
rehash_read_settings();
EventAddEx(modinfo->handle, "connthrottle_evt", 1, 0, connthrottle_evt, NULL);
EventAdd(modinfo->handle, "connthrottle_evt", 1, 0, connthrottle_evt, NULL);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -91,7 +91,7 @@ ExtbanInfo extban;
return MOD_FAILED;
}
EventAddEx(modinfo->handle, "timedban_timeout", TIMEDBAN_TIMER, 0, timedban_timeout, NULL);
EventAdd(modinfo->handle, "timedban_timeout", TIMEDBAN_TIMER, 0, timedban_timeout, NULL);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -100,7 +100,7 @@ MOD_INIT(jointhrottle)
MOD_LOAD(jointhrottle)
{
EventAddEx(ModInfo->handle, "jointhrottle_cleanup_structs", 60, 0, jointhrottle_cleanup_structs, NULL);
EventAdd(ModInfo->handle, "jointhrottle_cleanup_structs", 60, 0, jointhrottle_cleanup_structs, NULL);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -81,7 +81,7 @@ MOD_LOAD(link_security)
cap.parameter = link_security_capability_parameter;
ClientCapabilityAdd(modinfo->handle, &cap, NULL);
EventAddEx(modinfo->handle, "checklinksec", 2, 0, checklinksec, NULL);
EventAdd(modinfo->handle, "checklinksec", 2, 0, checklinksec, NULL);
checklinksec(NULL);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -48,7 +48,7 @@ MOD_TEST(m_list)
MOD_INIT(m_list)
{
CommandAdd(modinfo->handle, MSG_LIST, m_list, MAXPARA, M_USER);
EventAddEx(modinfo->handle, "send_queued_list_data", 1, 0, send_queued_list_data, NULL);
EventAdd(modinfo->handle, "send_queued_list_data", 1, 0, send_queued_list_data, NULL);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -145,7 +145,7 @@ MOD_INIT(m_tkl)
/* Is first run when server is 100% ready */
MOD_LOAD(m_tkl)
{
EventAddEx(TklModInfo->handle, "tklexpire", 5, 0, tkl_check_expire, NULL);
EventAdd(TklModInfo->handle, "tklexpire", 5, 0, tkl_check_expire, NULL);
return MOD_SUCCESS;
}
+3 -3
View File
@@ -167,9 +167,9 @@ MOD_LOAD(reputation)
load_db();
if (reputation_starttime == 0)
reputation_starttime = TStime();
EventAddEx(ModInf.handle, "delete_old_records", DELETE_OLD_EVERY, 0, delete_old_records, NULL);
EventAddEx(ModInf.handle, "add_scores", BUMP_SCORE_EVERY, 0, add_scores, NULL);
EventAddEx(ModInf.handle, "save_db", SAVE_DB_EVERY, 0, save_db_evt, NULL);
EventAdd(ModInf.handle, "delete_old_records", DELETE_OLD_EVERY, 0, delete_old_records, NULL);
EventAdd(ModInf.handle, "add_scores", BUMP_SCORE_EVERY, 0, add_scores, NULL);
EventAdd(ModInf.handle, "save_db", SAVE_DB_EVERY, 0, save_db_evt, NULL);
return MOD_SUCCESS;
}
+1 -1
View File
@@ -151,7 +151,7 @@ MOD_INIT(tkldb)
MOD_LOAD(tkldb)
{
EventAddEx(modinfo->handle, "tkldb_write_tkldb", TKL_DB_SAVE_EVERY, 0, write_tkldb_evt, NULL);
EventAdd(modinfo->handle, "tkldb_write_tkldb", TKL_DB_SAVE_EVERY, 0, write_tkldb_evt, NULL);
if (ModuleGetError(modinfo->handle) != MODERR_NOERROR)
{
config_error("A critical error occurred when loading module %s: %s", MOD_HEADER(tkldb).name, ModuleGetErrorStr(modinfo->handle));
+1 -1
View File
@@ -183,7 +183,7 @@ int optmask;
}
ares_set_socket_callback(resolver_channel, unrealdns_sock_create_cb, NULL);
unrealdns_timeout_hdl = EventAddEx(NULL, "unrealdns_timeout", 0, 0, unrealdns_timeout, NULL);
unrealdns_timeout_hdl = EventAdd(NULL, "unrealdns_timeout", 0, 0, unrealdns_timeout, NULL);
}
void reinit_resolver(aClient *sptr)
+1 -1
View File
@@ -10917,7 +10917,7 @@ void special_delayed_unloading(void)
{
config_warn("Delaying module unloading of '%s' due to moddata", m->header->name);
m->flags |= MODFLAG_DELAYED;
EventAddEx(NULL, "e_unload_module_delayed", 5, 1, e_unload_module_delayed, m->header->name);
EventAdd(NULL, "e_unload_module_delayed", 5, 1, e_unload_module_delayed, m->header->name);
}
}
}
+1 -1
View File
@@ -382,7 +382,7 @@ void url_init(void)
multihandle = curl_multi_init();
curl_multi_setopt(multihandle, CURLMOPT_SOCKETFUNCTION, url_socket_cb);
curl_socket_timeout_hdl = EventAddEx(NULL, "curl_socket_timeout", 1, 0, curl_socket_timeout, NULL);
curl_socket_timeout_hdl = EventAdd(NULL, "curl_socket_timeout", 1, 0, curl_socket_timeout, NULL);
}
/*