X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/fb38e2bcac60ef70a5515bc2a2c2f308b4d58280..5a2c7cf6485440d208e5f0ec319e22b6fa317a41:/src/hash.c diff --git a/src/hash.c b/src/hash.c index 3a4cc1a..51c355c 100644 --- a/src/hash.c +++ b/src/hash.c @@ -855,21 +855,25 @@ int ChannelExemptExists(struct chanNode *channel, const char *exempt) } static topic_func_t *tf_list; +static void **tf_list_extra; static unsigned int tf_size = 0, tf_used = 0; void -reg_topic_func(topic_func_t handler) +reg_topic_func(topic_func_t handler, void *extra) { if (tf_used == tf_size) { if (tf_size) { tf_size <<= 1; tf_list = realloc(tf_list, tf_size*sizeof(topic_func_t)); + tf_list_extra = realloc(tf_list_extra, tf_size*sizeof(void*)); } else { tf_size = 8; tf_list = malloc(tf_size*sizeof(topic_func_t)); + tf_list_extra = malloc(tf_size*sizeof(void*)); } } - tf_list[tf_used++] = handler; + tf_list[tf_used] = handler; + tf_list_extra[tf_used++] = extra; } void @@ -901,7 +905,7 @@ SetChannelTopic(struct chanNode *channel, struct userNode *service, struct userN * that it has reverted the topic change, and that further * hooks should not be called. */ - if (tf_list[n](user, channel, old_topic)) + if (tf_list[n](user, channel, old_topic, tf_list_extra[n])) break; } } @@ -1005,4 +1009,5 @@ hash_cleanup(void) free(pf_list); free(kf_list); free(tf_list); + free(tf_list_extra); }