1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 14:23:12 +02:00

Rename place_host_ban() to take_action() since it is not only about banning...

This commit is contained in:
Bram Matthys
2023-07-08 19:54:40 +02:00
parent 8f4a19978a
commit 5d65e4a400
11 changed files with 26 additions and 26 deletions
+1 -1
View File
@@ -697,7 +697,7 @@ CMD_OVERRIDE_FUNC(override_msg)
log_data_string("scripts", logbuf));
/* Take the action */
retval = place_host_ban(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time, 0);
retval = take_action(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time, 0);
if (retval == 1)
return;
if (retval == BAN_ACT_BLOCK)
+1 -1
View File
@@ -878,7 +878,7 @@ int antirandom_preconnect(Client *client)
"[antirandom] denied access to user with score $score: $client.details:$client.user.realname",
log_data_integer("score", score));
}
if (place_host_ban(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time, 0))
if (take_action(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time, 0))
return HOOK_DENY;
}
return HOOK_CONTINUE;
+3 -3
View File
@@ -54,7 +54,7 @@ int authprompt_config_test(ConfigFile *, ConfigEntry *, int, int *);
int authprompt_config_run(ConfigFile *, ConfigEntry *, int);
int authprompt_sasl_continuation(Client *client, const char *buf);
int authprompt_sasl_result(Client *client, int success);
int authprompt_place_host_ban(Client *client, BanActionValue action, const char *reason, long duration);
int authprompt_take_action(Client *client, BanActionValue action, const char *reason, long duration);
int authprompt_find_tkline_match(Client *client, TKL *tk);
int authprompt_pre_local_handshake_timeout(Client *client, const char **comment);
int authprompt_pre_connect(Client *client);
@@ -93,7 +93,7 @@ MOD_INIT()
HookAdd(modinfo->handle, HOOKTYPE_CONFIGRUN, 0, authprompt_config_run);
HookAdd(modinfo->handle, HOOKTYPE_SASL_CONTINUATION, 0, authprompt_sasl_continuation);
HookAdd(modinfo->handle, HOOKTYPE_SASL_RESULT, 0, authprompt_sasl_result);
HookAdd(modinfo->handle, HOOKTYPE_PLACE_HOST_BAN, 0, authprompt_place_host_ban);
HookAdd(modinfo->handle, HOOKTYPE_TAKE_ACTION, 0, authprompt_take_action);
HookAdd(modinfo->handle, HOOKTYPE_FIND_TKLINE_MATCH, 0, authprompt_find_tkline_match);
HookAdd(modinfo->handle, HOOKTYPE_PRE_LOCAL_HANDSHAKE_TIMEOUT, 0, authprompt_pre_local_handshake_timeout);
/* For HOOKTYPE_PRE_LOCAL_CONNECT we want a low priority, so we are called last.
@@ -398,7 +398,7 @@ void authprompt_send_auth_required_message(Client *client)
}
/* Called upon "place a host ban on this user" (eg: spamfilter, blacklist, ..) */
int authprompt_place_host_ban(Client *client, BanActionValue action, const char *reason, long duration)
int authprompt_take_action(Client *client, BanActionValue action, const char *reason, long duration)
{
/* If it's a soft-xx action and the user is not logged in
* and the user is not yet online, then we will handle this user.
+1 -1
View File
@@ -753,7 +753,7 @@ int blacklist_action(Client *client, char *opernotice, BanAction *ban_action, ch
log_data_string("ban_action", ban_actions_to_string(ban_action)),
log_data_string("ban_reason", ban_reason),
log_data_integer("ban_time", ban_time));
return place_host_ban(client, ban_action, ban_reason, ban_time, 0);
return take_action(client, ban_action, ban_reason, ban_time, 0);
}
void blacklist_hit(Client *client, Blacklist *bl, int reply)
+1 -1
View File
@@ -619,7 +619,7 @@ int ban_version(Client *client, const char *text)
if (find_tkl_exception(TKL_BAN_VERSION, client))
return 0; /* we are exempt */
return place_host_ban(client, ban->action, ban->reason, BAN_VERSION_TKL_TIME, 0);
return take_action(client, ban->action, ban->reason, BAN_VERSION_TKL_TIME, 0);
}
return 0;
+6 -6
View File
@@ -90,7 +90,7 @@ TKL *_find_tkline_match_zap(Client *client);
void _tkl_stats(Client *client, int type, const char *para, int *cnt);
void _tkl_sync(Client *client);
CMD_FUNC(_cmd_tkl);
int _place_host_ban(Client *client, BanAction *action, char *reason, long duration, int skip_set);
int _take_action(Client *client, BanAction *action, char *reason, long duration, int skip_set);
int _match_spamfilter(Client *client, const char *str_in, int type, const char *cmd, const char *target, int flags, TKL **rettk);
int _match_spamfilter_mtags(Client *client, MessageTag *mtags, char *cmd);
int check_mtag_spamfilters_present(void);
@@ -207,7 +207,7 @@ MOD_TEST()
EfunctionAddVoid(modinfo->handle, EFUNC_TKL_STATS, _tkl_stats);
EfunctionAddVoid(modinfo->handle, EFUNC_TKL_SYNCH, _tkl_sync);
EfunctionAddVoid(modinfo->handle, EFUNC_CMD_TKL, _cmd_tkl);
EfunctionAdd(modinfo->handle, EFUNC_PLACE_HOST_BAN, _place_host_ban);
EfunctionAdd(modinfo->handle, EFUNC_TAKE_ACTION, _take_action);
EfunctionAdd(modinfo->handle, EFUNC_MATCH_SPAMFILTER, _match_spamfilter);
EfunctionAdd(modinfo->handle, EFUNC_MATCH_SPAMFILTER_MTAGS, _match_spamfilter_mtags);
EfunctionAdd(modinfo->handle, EFUNC_JOIN_VIRUSCHAN, _join_viruschan);
@@ -4780,7 +4780,7 @@ void ban_action_run_all_sets(Client *client, BanAction *action)
* @note Be sure to check IsDead(client) if return value is 1 and you are
* considering to continue processing.
*/
int _place_host_ban(Client *client, BanAction *actions, char *reason, long duration, int skip_set)
int _take_action(Client *client, BanAction *actions, char *reason, long duration, int skip_set)
{
BanAction *action;
int previous_highest = 0;
@@ -4851,7 +4851,7 @@ int _place_host_ban(Client *client, BanAction *actions, char *reason, long durat
tkllayer[7] = mo2;
tkllayer[8] = reason;
cmd_tkl(&me, NULL, 9, tkllayer);
RunHookReturnInt(HOOKTYPE_PLACE_HOST_BAN, !=99, client, action->action, reason, duration);
RunHookReturnInt(HOOKTYPE_TAKE_ACTION, !=99, client, action->action, reason, duration);
if ((action->action == BAN_ACT_SHUN) || (action->action == BAN_ACT_SOFT_SHUN))
{
find_shun(client);
@@ -4866,7 +4866,7 @@ int _place_host_ban(Client *client, BanAction *actions, char *reason, long durat
}
case BAN_ACT_SOFT_KILL:
case BAN_ACT_KILL:
RunHookReturnInt(HOOKTYPE_PLACE_HOST_BAN, !=99, client, action->action, reason, duration);
RunHookReturnInt(HOOKTYPE_TAKE_ACTION, !=99, client, action->action, reason, duration);
exit_client(client, NULL, reason);
break;
case BAN_ACT_SOFT_TEMPSHUN:
@@ -5237,7 +5237,7 @@ int _match_spamfilter(Client *client, const char *str_in, int target, const char
/* Spamfilter matched, take action: */
reason = unreal_decodespace(tkl->ptr.spamfilter->tkl_reason);
ret = place_host_ban(client, tkl->ptr.spamfilter->action, reason, tkl->ptr.spamfilter->tkl_duration, 1);
ret = take_action(client, tkl->ptr.spamfilter->action, reason, tkl->ptr.spamfilter->tkl_duration, 1);
if (!IsDead(client))
{
if ((ret == BAN_ACT_BLOCK) || (ret == BAN_ACT_SOFT_BLOCK))