From 876fda63ece531caa69d8ff419ef460f9ecd6776 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 15 Jun 2019 17:06:41 +0200 Subject: [PATCH] Export tkl_type_string via efuncs (actually, the name may change...) --- include/h.h | 1 + include/modules.h | 1 + src/modules.c | 4 +++- src/modules/m_tkl.c | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/h.h b/include/h.h index 8de796f8f..c85d0ada6 100644 --- a/include/h.h +++ b/include/h.h @@ -629,6 +629,7 @@ extern MODVAR int (*register_user)(aClient *cptr, aClient *sptr, char *nick, cha extern MODVAR int (*tkl_hash)(unsigned int c); extern MODVAR char (*tkl_typetochar)(int type); extern MODVAR int (*tkl_chartotype)(char c); +extern MODVAR char *(*tkl_type_string)(aTKline *tk); extern MODVAR aTKline *(*tkl_add_line)(int type, char *usermask, char *hostmask, char *reason, char *setby, TS expire_at, TS set_at, TS spamf_tkl_duration, char *spamf_tkl_reason, MatchType match_type, int soft); extern MODVAR aTKline *(*tkl_del_line)(aTKline *tkl); diff --git a/include/modules.h b/include/modules.h index 0381c17c9..30eb8d4d4 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1199,6 +1199,7 @@ _UNREAL_ERROR(_hook_error_incompatible, "Incompatible hook function. Check argum #define EFUNC_PARSE_MESSAGE_TAGS 61 #define EFUNC_MTAGS_TO_STRING 62 #define EFUNC_TKL_CHARTOTYPE 63 +#define EFUNC_TKL_TYPE_STRING 64 /* Module flags */ #define MODFLAG_NONE 0x0000 diff --git a/src/modules.c b/src/modules.c index afb21e80e..c38405533 100644 --- a/src/modules.c +++ b/src/modules.c @@ -92,6 +92,7 @@ int (*register_user)(aClient *cptr, aClient *sptr, char *nick, char *username, c int (*tkl_hash)(unsigned int c); char (*tkl_typetochar)(int type); int (*tkl_chartotype)(char c); +char *(*tkl_type_string)(aTKline *tk); aTKline *(*tkl_add_line)(int type, char *usermask, char *hostmask, char *reason, char *setby, TS expire_at, TS set_at, TS spamf_tkl_duration, char *spamf_tkl_reason, MatchType match_type, int soft); aTKline *(*tkl_del_line)(aTKline *tkl); @@ -210,7 +211,8 @@ static const EfunctionsList efunction_table[MAXEFUNCTIONS] = { /* 61 */ {"parse_message_tags", (void *)&parse_message_tags, &parse_message_tags_default_handler}, /* 62 */ {"mtags_to_string", (void *)&mtags_to_string, &mtags_to_string_default_handler}, /* 63 */ {"tkl_chartotype", (void *)&tkl_chartotype, NULL}, -/* 64 */ {NULL, NULL, NULL}, +/* 64 */ {"tkl_type_string", (void *)&tkl_type_string, NULL}, +/* 65 */ {NULL, NULL, NULL}, }; #ifdef UNDERSCORE diff --git a/src/modules/m_tkl.c b/src/modules/m_tkl.c index ff69d3888..ca93bce97 100644 --- a/src/modules/m_tkl.c +++ b/src/modules/m_tkl.c @@ -53,6 +53,7 @@ int m_tkl_line(aClient *cptr, aClient *sptr, int parc, char *parv[], char* type) int _tkl_hash(unsigned int c); char _tkl_typetochar(int type); int _tkl_chartotype(char c); +char *_tkl_type_string(aTKline *tk); aTKline *_tkl_add_line(int type, char *usermask, char *hostmask, char *reason, char *setby, TS expire_at, TS set_at, TS spamf_tkl_duration, char *spamf_tkl_reason, MatchType match_type, int soft); void _tkl_del_line(aTKline *tkl); @@ -107,6 +108,7 @@ MOD_TEST(m_tkl) EfunctionAdd(modinfo->handle, EFUNC_TKL_HASH, _tkl_hash); EfunctionAdd(modinfo->handle, EFUNC_TKL_TYPETOCHAR, TO_INTFUNC(_tkl_typetochar)); EfunctionAdd(modinfo->handle, EFUNC_TKL_CHARTOTYPE, TO_INTFUNC(_tkl_chartotype)); + EfunctionAddPChar(modinfo->handle, EFUNC_TKL_TYPE_STRING, _tkl_type_string); EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_LINE, TO_PVOIDFUNC(_tkl_add_line)); EfunctionAddVoid(modinfo->handle, EFUNC_TKL_DEL_LINE, _tkl_del_line); EfunctionAddVoid(modinfo->handle, EFUNC_TKL_CHECK_LOCAL_REMOVE_SHUN, _tkl_check_local_remove_shun); @@ -2033,7 +2035,7 @@ void _tkl_synch(aClient *sptr) } /** Show TKL type as a string (used when adding/removing) */ -char *tkl_type_string(aTKline *tk) +char *_tkl_type_string(aTKline *tk) { static char txt[256];